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
PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket: Space before opening parenthesis of function call prohibited
Squiz.Arrays.ArrayDeclaration.IndexNoNewline: Each index in a multi-line array must be on a new line
when types are declared as union types. array|null triggers Squiz.Arrays.ArrayDeclaration.IndexNoNewline. ?array is fine.
9 | ERROR | [x] Space before opening parenthesis of function call prohibited
| | (PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket)
9 | ERROR | [x] Each index in a multi-line array must be on a new line (Squiz.Arrays.ArrayDeclaration.IndexNoNewline)
Expected behavior
No errors.
Versions (please complete the following information):
OS: [MacOS]
PHP: [8.0]
PHPCS: [master]
Standard: [Doctrine]
The text was updated successfully, but these errors were encountered:
simPod
changed the title
PHP 8_ False positives when using arrow function as an array value across multiple lines only when union types are used
PHP 8: False positives when using arrow function as an array value when union types are used
Apr 22, 2021
gsherwood
changed the title
PHP 8: False positives when using arrow function as an array value when union types are used
Arrow function not tokenized correctly when using null in union type
Apr 23, 2021
This issue was caused by the arrow function tokenizing code not allowing for the null type in a type union. It appears this was the only place that had this issue in the codebase.
Thanks a lot for the bug report. The fix will be in 3.6.1.
Describe the bug
phpcs shoots:
when types are declared as union types.
array|null
triggersSquiz.Arrays.ArrayDeclaration.IndexNoNewline
.?array
is fine.Code sample
Custom ruleset
doctrine/coding-standard v9
To reproduce
Expected behavior
No errors.
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: