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
Warning message on PHP files consisting of only comments #1157
Comments
It looks like it's another file. Running it on the vendor/bin/rector process app/Test.php --level laravel58 |
It seems the issue is only on PHP 7.2. Just tried on 7.3 and the warning is not there. Thanks! |
It should work on any PHP. There will be some bug with one of the rules. If you can provide failing file, we could spare re-creating the issue in the future by someone else on PHP 7.2 |
@TomasVotruba Ok, see below: $ php -v
// PHP 7.2.4 Steps to reproducemkdir rector-issue
cd rector-issue
composer require rector/rector -q
echo "<?php echo 'hello world';"> FileIsOk.php
vendor/bin/rector process FileIsOk.php --level laravel58
// ^^ All good, works as expected
echo "<?php // comment here"> FileIsNotOk.php
vendor/bin/rector process FileIsNotOk.php --level laravel58
// ^^ Issue |
Thank you 👍 What rule from (I'm affraid this is not related to any rule. This might be caused by printer.) |
Seems to be all of them -- not related to any specific rule. |
Thank you. |
$itemEndPos = $origArrItem->getEndTokenPos(); This is
Yes, same version. |
On which PHP version this is $itemEndPos = $origArrItem->getEndTokenPos(); Is is possible your |
Ok, that's not it. It's actually var_dump($itemEndPos); // int(-1)
var_dump($itemStartPos >= 0 && $itemEndPos >= 0); // bool(false) I just looked at the assert options. Here's the difference: PHP 7.2 - I guess that explains it? |
Yes 👍 I think you have assertions silenced on 7.3. I'll enable assertions and try it locally, thanks for debugging ❤️ |
Closing as failing test is required and unable to replicate |
rectorphp/rector-src@49aa15d [CodingStyle] Deprecate RemoveUnusedAliasRector, job rather for coding standard tool and opinonated (#1157)
When I run the following command, I get a warning message when it found a PHP file where the contents were only comments.
Contents of
app/Test.php
:Output:
Ref nikic/PHP-Parser#589
The text was updated successfully, but these errors were encountered: