Fix some PHPstan warnings for PHP 8 support

This commit is contained in:
Benjamin Renard 2023-07-26 17:08:21 +02:00
parent 8c108d0ebb
commit 8321c1cdd2
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC
4 changed files with 8 additions and 2 deletions

View file

@ -9,7 +9,7 @@ error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
// Root directory path // Root directory path
$script = null; $script = null;
if (defined('__FILE__') && constant('__FILE__')) { if (defined('__FILE__') && constant('__FILE__')) { // @phpstan-ignore-line
$script = __FILE__; $script = __FILE__;
} }
else { else {

View file

@ -8,7 +8,7 @@ error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
// Root directory path // Root directory path
$script = null; $script = null;
if (defined('__FILE__') && constant('__FILE__')) { if (defined('__FILE__') && constant('__FILE__')) { // @phpstan-ignore-line
$script = __FILE__; $script = __FILE__;
} }
else { else {

View file

@ -23,6 +23,11 @@ class HookEvent implements JsonSerializable {
return null; return null;
} }
/**
* Return data to serialize a HookEvent object as JSON
* @return array<string,mixed>
*/
#[\ReturnTypeWillChange]
public function jsonSerialize() { public function jsonSerialize() {
return array ( return array (
'name' => $this -> name, 'name' => $this -> name,

View file

@ -21,6 +21,7 @@ class Session {
// In CLI or Phpstan context, do not initialize // In CLI or Phpstan context, do not initialize
if ( if (
php_sapi_name() == "cli" php_sapi_name() == "cli"
// @phpstan-ignore-next-line
|| (defined('__PHPSTAN_RUNNING__') && constant('__PHPSTAN_RUNNING__')) || (defined('__PHPSTAN_RUNNING__') && constant('__PHPSTAN_RUNNING__'))
) )
return; return;