Bug Report
| Subject |
Details |
| Rector version |
0.15.24 |
| Php version |
7.3.33 |
IntvalToTypeCastRector causes unrecoverable failure on bellow code that works fine.
% ../php_interface/vendor/bin/rector process --clear-cache --debug
../../bitrix/modules/main/filter_tools.php
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
[file] ../../bitrix/modules/main/filter_tools.php
[rule] Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector
PHP Fatal error: Uncaught Rector\Core\Exception\ShouldNotHappenException: Node "PhpParser\Node\Expr\Cast\Int_" with parent of "PhpParser\Node\Expr\BinaryOp\Mul" is missing scope required for scope refresh. in /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/src/Application/ChangedNodeScopeRefresher.php:85
Stack trace:
#0 /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/src/Rector/AbstractRector.php(342): Rector\Core\Application\ChangedNodeScopeRefresher->refresh(Object(PhpParser\Node\Expr\Cast\Int_), NULL, '/Users/holdmann...')
#1 /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/src/Rector/AbstractRector.php(253): Rector\Core\Rector\AbstractRector->refreshScopeNodes(Object(PhpParser\Node\Expr\Cast\Int_), '/Users/holdmann...', NULL)
#2 /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(113): Rector\Core\Rector\Ab in /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/src/Application/ChangedNodeScopeRefresher.php on line 85
Fatal error: Uncaught Rector\Core\Exception\ShouldNotHappenException: Node "PhpParser\Node\Expr\Cast\Int_" with parent of "PhpParser\Node\Expr\BinaryOp\Mul" is missing scope required for scope refresh. in /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/src/Application/ChangedNodeScopeRefresher.php:85
Stack trace:
#0 /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/src/Rector/AbstractRector.php(342): Rector\Core\Application\ChangedNodeScopeRefresher->refresh(Object(PhpParser\Node\Expr\Cast\Int_), NULL, '/Users/holdmann...')
#1 /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/src/Rector/AbstractRector.php(253): Rector\Core\Rector\AbstractRector->refreshScopeNodes(Object(PhpParser\Node\Expr\Cast\Int_), '/Users/holdmann...', NULL)
#2 /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(113): Rector\Core\Rector\Ab in /Users/holdmann/Documents/Projects/******/local/php_interface/vendor/rector/rector/src/Application/ChangedNodeScopeRefresher.php on line 85
Minimal PHP Code Causing Issue
$isParallel = true;
return static function (RectorConfig $rectorConfig) use ($isParallel): void {
$rectorConfig->parallel(600, 3, 3);
if (!$isParallel)
{
$rectorConfig->disableParallel();
}
$rectorConfig->paths([__DIR__ . '/../../bitrix/modules/main/filter_tools.php']);
$rectorConfig->skip([
// crashes rector w/o any obviously reason
//__DIR__ . '/../../bitrix/modules/main/filter_tools.php'
]);
$rectorConfig->rule(IntvalToTypeCastRector::class);
};
for source code see attached file
Expected Behaviour
should work as expected
Bug Report
IntvalToTypeCastRectorcauses unrecoverable failure on bellow code that works fine.Minimal PHP Code Causing Issue
for source code see attached file
Expected Behaviour
should work as expected