RedundantParenthesesSniff gives error on valid code
grizzm0 opened this issue · comments
Kristofer Karlsson commented
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
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------