Closed akash-grexit closed 1 year ago
We unfortunatelly can't help without reproducible code, it possibly due to typo or some case sensitive in part of name class. I am closing it, feel free to re-open with reproducible code when you can, thank you,
Noticed the same issue, not applied rules. I'm observing different behaviors when running Rector v0.18.5 on PHP 7 and PHP 8, despite the composer.json
indicating support for both versions ("php": "^7.2|^8.0"
).
The output should be consistent regardless of the PHP version used.
The output is not the same when using PHP 7.
I noticed the same issue as above.
Again, we can't help without reproducible code.
I have created minimal repo to reproduce, code taken from the report above.
Steps to reproduce:
git clone git@github.com:dimov-cz/rector-issue8100.git .
composer install
vendor/bin/rector process --dry-run --debug
PHP 8.1 environment output:
/mnt/devCode/y/src/foo.php
1 file with changes
===================
1) src/foo.php:0
---------- begin diff ----------
@@ @@
<?php
class Foo {
- function Foo() {
+ function __construct() {
echo 'Constructed!';
}
}
----------- end diff -----------
[OK] 1 file would have changed (dry-run) by Rector
PHP 7.4 environment output:
/mnt/devCode/x/src/foo.php
[OK] Rector is done!
I see, the :
if (!$classReflection->hasConstructor()) {
seems only detected on php8+, while on php 7.x, it not detected.
Bug Report
Minimal PHP Code Causing Issue
foo.php
rector.php
Expected Behaviour
Demo: https://getrector.com/demo/8e684b99-3c59-48a1-8730-d9cddc88aaac
I tested the rule in this demo environment, and it's working there. However, it's not working on my machine.