Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: TokensAnalyzer - handle unary operator in arrow functions #7862

Merged
merged 5 commits into from Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion phpstan.dist.neon
Expand Up @@ -21,6 +21,6 @@ parameters:
-
message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#'
path: tests
count: 1021
count: 1020
tipsOfTheDay: false
tmpDir: dev-tools/phpstan/cache
1 change: 1 addition & 0 deletions src/Tokenizer/TokensAnalyzer.php
Expand Up @@ -554,6 +554,7 @@ public function isUnaryPredecessorOperator(int $index): bool
';',
'{',
'}',
[T_DOUBLE_ARROW],
[T_FN],
[T_FUNCTION],
[T_OPEN_TAG],
Expand Down
4 changes: 4 additions & 0 deletions tests/Fixer/Operator/UnaryOperatorSpacesFixerTest.php
Expand Up @@ -152,5 +152,9 @@ public static function provideFixCases(): iterable
'<?php function foo($a, ... $b) { return (-- $a) * ($b ++);}',
['only_dec_inc' => true],
];

yield [
'<?php static fn(Token $t): bool => 8 === ($t->flags & 8);',
];
}
}