- Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the bug
phpcs shoots:
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.
Code sample
<?php declare(strict_types=1); return [ 'this is fine' => static fn (?DateTimeImmutable $value) : ?array => $value === null ? null : [], 'this shoots false positives' => static fn (DateTimeImmutable|null $value) : array|null => $value === null ? null : [], ];
Custom ruleset
doctrine/coding-standard v9
To reproduce
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]