You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
composer/bin/rector process rector/abc.php -vvv
Rector v0.6.2
Config file: rector.yaml
[parsing] rector/abc.php
[refactoring] rector/abc.php
[applying] Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector
PHP Notice: Undefined index: ksort in /path/to/my/files/vendor/rector/rector/packages/Php73/src/Rector/FuncCall/ArrayKeyFirstLastRector.php on line 114
In Name.php line 219:
[InvalidArgumentException]
Expected string, array of parts or Name instance
Exception trace:
at phar:///path/to/my/files/vendor/phpstan/phpstan/phpstan.phar/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php:219
PhpParser\Node\Name::prepareName() at phar:///path/to/my/files/vendor/phpstan/phpstan/phpstan.phar/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php:21
PhpParser\Node\Name->__construct() at /path/to/my/files/vendor/rector/rector/packages/Php73/src/Rector/FuncCall/ArrayKeyFirstLastRector.php:115
Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector->refactor() at /path/to/my/files/vendor/rector/rector/src/Rector/AbstractRector.php:116
Rector\Rector\AbstractRector->enterNode() at /path/to/my/files/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:123
PhpParser\NodeTraverser->traverseNode() at /path/to/my/files/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PhpParser\NodeTraverser->traverseArray() at /path/to/my/files/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
PhpParser\NodeTraverser->traverseNode() at /path/to/my/files/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PhpParser\NodeTraverser->traverseArray() at /path/to/my/files/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
PhpParser\NodeTraverser->traverseNode() at /path/to/my/files/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PhpParser\NodeTraverser->traverseArray() at /path/to/my/files/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:91
PhpParser\NodeTraverser->traverse() at /path/to/my/files/vendor/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.php:62
Rector\PhpParser\NodeTraverser\RectorNodeTraverser->traverse() at /path/to/my/files/vendor/rector/rector/src/Application/FileProcessor.php:134
Rector\Application\FileProcessor->refactor() at /path/to/my/files/vendor/rector/rector/src/Application/RectorApplication.php:155
Rector\Application\RectorApplication->Rector\Application\{closure}() at /path/to/my/files/vendor/rector/rector/src/Application/RectorApplication.php:221
Rector\Application\RectorApplication->tryCatchWrapper() at /path/to/my/files/vendor/rector/rector/src/Application/RectorApplication.php:156
Rector\Application\RectorApplication->runOnFileInfos() at /path/to/my/files/vendor/rector/rector/src/Console/Command/ProcessCommand.php:188
Rector\Console\Command\ProcessCommand->execute() at /path/to/my/files/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /path/to/my/files/vendor/rector/rector/src/Console/Command/AbstractCommand.php:34
Rector\Console\Command\AbstractCommand->run() at /path/to/my/files/vendor/symfony/console/Application.php:1011
Symfony\Component\Console\Application->doRunCommand() at /path/to/my/files/vendor/symfony/console/Application.php:272
Symfony\Component\Console\Application->doRun() at /path/to/my/files/vendor/rector/rector/src/Console/Application.php:93
Rector\Console\Application->doRun() at /path/to/my/files/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /path/to/my/files/vendor/rector/rector/bin/rector:48
process [-n|--dry-run] [-a|--autoload-file AUTOLOAD-FILE] [-e|--hide-autoload-errors] [--match-git-diff] [-r|--rule RULE] [-o|--output-format [OUTPUT-FORMAT]] [--] [<source>...]
Minimal PHP Code Causing Issue
<?php$a = [];
ksort($a);
key($a);
Expected Behaviour
Rector should run without any changes.
To be frank, I am not sure what should be the expected behaviour. Should rector leave the code as-is, or should it still replace the key with array_key_first since ksort internally resets the array pointer?
The text was updated successfully, but these errors were encountered:
./vendor/bin/rector process rector/abc.php -vvv
Current Behaviour
Minimal PHP Code Causing Issue
Expected Behaviour
Rector should run without any changes.
To be frank, I am not sure what should be the expected behaviour. Should rector leave the code as-is, or should it still replace the key with
array_key_first
sinceksort
internally resets the array pointer?The text was updated successfully, but these errors were encountered: