Skip to content
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

Internal fatal error on process #2178

Closed
dereuromark opened this issue Oct 17, 2019 · 8 comments
Closed

Internal fatal error on process #2178

dereuromark opened this issue Oct 17, 2019 · 8 comments

Comments

@dereuromark
Copy link
Contributor

Subject Details
Rector version latest master
PHP version PHP 7.3

Current Behavior

vendor/bin/rector process /.../src/ --set=cakephp36 --dry-run -a /.../vendor/autoload.php

Fatal error: Declaration of PhpParser\Node\Name::getSubNodeNames() must be compatible with PhpParser\Node::getSubNodeNames(): array in /...vendor/nikic/php-parser/lib/PhpParser/Node/Name.php on line 196

Expected Behavior

No exceptions.

@TomasVotruba
Copy link
Member

TomasVotruba commented Oct 18, 2019

Your minimal php source code, that you process, is needed

@dereuromark
Copy link
Contributor Author

dereuromark commented Oct 18, 2019

This happens with any code basically, no matter what class/file and project.
It is also quite obvious once you look into the PhpParser source code. The IDE already blows up red once you open those files, as the inheritance here of classes just cannot work by design in that version that got downloaded.
Even if I manually fix the missing return typehint on the child class, then other follow up errors appear:

Fatal error: Class PhpParser\Node\Name contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PhpParser\Node::getType) in /.../vendor/nikic/php-parser/lib/PhpParser/Node/Name.php on line 196

According to composer lock "v4.2.4", is the version downloaded for "nikic/php-parser".
Seems quite buggy that one.

@TomasVotruba
Copy link
Member

You have different version of php-parser in your project and in Rector. They have to be compatible.

The best way to achieve is to install Rector to protect

@TomasVotruba
Copy link
Member

Duplicate source of fail in:
#177

@dereuromark
Copy link
Contributor Author

I dont get this, if I install rector, shoudnt it require the correct versions of its dependencies on its own?
Also master seems broken here:

"rector/rector": "dev-master as 0.5"

has the same issue.

@TomasVotruba
Copy link
Member

It does, but you analyze another vendor:

/.../src/

@dereuromark
Copy link
Contributor Author

with autoloader file though, shouldnt that work?
Ah, I see now, that conflicts with the autoloaded files, if prefixing is not used. Thank you.
Maybe this can be caught with a more meaningful error instead?
Looking into the autoloader and comparing with current version of root rector?

@TomasVotruba
Copy link
Member

TomasVotruba commented Oct 18, 2019

Exactly!

I personally never came across these errors.
If you find a way how to add such error, I'd be open to PR 👍

TomasVotruba added a commit that referenced this issue Apr 30, 2022
rectorphp/rector-src@1ff8eea [DowngradePhp80] Support match as array item in DowngradeMatchToSwitchRector (#2178)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants