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

prevent re-declare class/interface errors, because of a already loaded php-parser package #5742

Closed
wants to merge 2 commits into from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Mar 19, 2024

require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php';
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php';
// prevent re-declare class/interface errors, because of a already loaded php-parser package
if (!interface_exists('\PhpParser\Node')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preload.php is generated by composer preload, which should not be manually touched, the command is at:

final class PreloadBuilder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh my .. another problem is, that because of rector custome patches to nikic/php-parser rector cannot work with a external php-parser version, because the external php-parser will likely not contain the patches rector needs/wants.

IMO rector would need to declare a conflict with any nikic/php-parser as it effectively will not work with another versions loaded at the same time

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think conflict config can be solution 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or if the issue only in phpunit, then, probably the patch should be in phpunit part itself?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@staabm staabm closed this Mar 19, 2024
@staabm staabm deleted the patch-1 branch March 19, 2024 17:16
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

Successfully merging this pull request may close these issues.

php-parser v5 compat
2 participants