diff --git a/src/Standards/PSR12/Sniffs/Functions/NullableTypeDeclarationSniff.php b/src/Standards/PSR12/Sniffs/Functions/NullableTypeDeclarationSniff.php index f4d63d4a36..8d90734311 100644 --- a/src/Standards/PSR12/Sniffs/Functions/NullableTypeDeclarationSniff.php +++ b/src/Standards/PSR12/Sniffs/Functions/NullableTypeDeclarationSniff.php @@ -26,6 +26,7 @@ class NullableTypeDeclarationSniff implements Sniff T_CALLABLE => true, T_SELF => true, T_PARENT => true, + T_STATIC => true, ]; diff --git a/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc b/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc index 1f4500c5ea..e3a5a775f2 100644 --- a/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc +++ b/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc @@ -82,3 +82,6 @@ class testInstanceOf() { $bal = $value instanceof static ? CONSTANT_NAME : $value; } } + +// PHP 8.0: static return type. +function testStatic() : ? static {} diff --git a/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc.fixed b/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc.fixed index 47c5174aa8..6225d1b337 100644 --- a/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc.fixed +++ b/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.inc.fixed @@ -80,3 +80,6 @@ class testInstanceOf() { $bal = $value instanceof static ? CONSTANT_NAME : $value; } } + +// PHP 8.0: static return type. +function testStatic() : ?static {} diff --git a/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.php b/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.php index 3f217b422a..2344b6d97d 100644 --- a/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.php +++ b/src/Standards/PSR12/Tests/Functions/NullableTypeDeclarationUnitTest.php @@ -40,6 +40,7 @@ protected function getErrorList() 57 => 2, 58 => 2, 59 => 2, + 87 => 1, ]; }//end getErrorList()