You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Since PHP8, static is allowed as return type. In #3189 a fix was added to prevent this from yielding whitespace errors. However, a nullable static return type still produces an error.
Code sample
<?phpnamespaceApp\Example;
class Example
{
# worksfinenowpublicfunctiontestA(): static
{
returnnewstatic();
}
# Scopekeyword"static"mustbefollowedbyasinglespace; foundnewlinepublicfunctiontestB(): ?static
{
returnnewstatic();
}
}
Create a file called test.php with the code sample above...
Run phpcs test.php
See error message displayed
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
14 | ERROR | [x] Scope keyword "static" must be followed by a single space;
| | found newline
--------------------------------------------------------------------------------
Expected behavior
No error
Versions (please complete the following information):
OS: Windows 10 & Alpine 3.13
PHP: 8.0
PHPCS: master
Standard: PSR12
The text was updated successfully, but these errors were encountered:
Describe the bug
Since PHP8, static is allowed as return type. In #3189 a fix was added to prevent this from yielding whitespace errors. However, a nullable static return type still produces an error.
Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php
Expected behavior
No error
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: