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

Document working around conflicts of nikic/php-parser:~3 #37

Closed
mglaman opened this issue Apr 12, 2019 · 10 comments
Closed

Document working around conflicts of nikic/php-parser:~3 #37

mglaman opened this issue Apr 12, 2019 · 10 comments
Labels
help wanted Extra attention is needed

Comments

@mglaman
Copy link
Owner

mglaman commented Apr 12, 2019

Drush requires psy which allows v2, v3, v4 of php parser. The problem is a Drupal site may have v3 installed because there is no hard requirement.

After research, this seems to be a legacy problem for sites that were set up before the v4 branch was opened. We need to find a decent workaround beyond "well, remove composer.lock and the vendor directory for your project"

PHP-Parser 4.0.0 on Feb 28, 2018

This means any Drupal 8 project created before Drupal 8.5.0 (7 Mar 2018) probably has the v3 branch of the PHP-Parser.

Drupal Check can probably do some detection against that Drupal project and provide helpful information for a solution.

@mglaman
Copy link
Owner Author

mglaman commented Apr 12, 2019

This relates to phpstan/phpstan#1386

@mglaman mglaman changed the title Conflicts with Drush on Drupal projects to to nikic/php-parser and Drush shell Prevent autoloading of invalid versions of nikic/php-parser Apr 12, 2019
@andypost
Copy link

Makes sense to suggest using php-ast extension

@mglaman
Copy link
Owner Author

mglaman commented Apr 12, 2019

But then we'd require people to install the extension, and I don't know if PHPStan supports php-ast :/

@andypost
Copy link

looks I mixed it with phan, sorry

@mglaman
Copy link
Owner Author

mglaman commented Apr 16, 2019

Here is the root problem: mglaman/phpstan-drupal#57

@mglaman
Copy link
Owner Author

mglaman commented Apr 27, 2019

What is weird is that this passed: https://circleci.com/gh/mglaman/drupal-check/78

A fresh project installed the right version.

Installing nikic/php-parser (v4.2.1): Loading from cache

@mglaman mglaman changed the title Prevent autoloading of invalid versions of nikic/php-parser Document working around conflicts of nikic/php-parser:~3 Apr 27, 2019
@mglaman mglaman added the help wanted Extra attention is needed label Apr 27, 2019
@mglaman mglaman added this to Needs triage in Issue triage May 3, 2019
@mglaman mglaman moved this from Needs triage to High priority in Issue triage May 3, 2019
@JDDoesDev
Copy link

In case anyone is searching for this exact error, but unable to get to it, the error that got me here is call to member function isSpecialClassName() on string

@JDDoesDev
Copy link

This issue is also part of Acquia BLT generated sites. BLT 9.2 requires sensiolabs-de/deprecation-detector which has a requirement for nikic/php-parser:~3.0

@JDDoesDev
Copy link

@mglaman
Copy link
Owner Author

mglaman commented May 11, 2020

The latest versions use PHPStan 0.12, which namespaces its dependencies. This prevents namespace clashes like this. I'll close for now.

@mglaman mglaman closed this as completed May 11, 2020
Issue triage automation moved this from High priority to Closed May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Issue triage
  
Closed
Development

No branches or pull requests

3 participants