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

RedundantParenthesesSniff gives error on valid code #199

Closed
grizzm0 opened this issue Dec 13, 2023 · 0 comments · Fixed by #200
Closed

RedundantParenthesesSniff gives error on valid code #199

grizzm0 opened this issue Dec 13, 2023 · 0 comments · Fixed by #200
Labels
bug Something isn't working
Milestone

Comments

@grizzm0
Copy link

grizzm0 commented Dec 13, 2023

The following code works as expected with no errors.

(static function (): void {
    $container = require 'config/container.php';
})();

But if I add an assert() inside the function I get an error.

(static function (): void {
    $container = require 'config/container.php';
    assert($container instanceof ContainerInterface);
})();
FILE: public/index.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 18 | ERROR | [x] Parentheses around expression "static function (): void {
    |       |         $container = require 'config/container.php';
    |       |         assert($container instanceof ContainerInterface);
    |       |     }" are redundant
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants