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

Drupal Check could not find Drupal root but PHPstan could #97

Closed
1 of 4 tasks
mxr576 opened this issue Jul 25, 2019 · 1 comment · Fixed by #98
Closed
1 of 4 tasks

Drupal Check could not find Drupal root but PHPstan could #97

mxr576 opened this issue Jul 25, 2019 · 1 comment · Fixed by #98

Comments

@mxr576
Copy link
Contributor

mxr576 commented Jul 25, 2019

How is drupal-check installed?

  • drupal-check is installed using the phar
  • drupal-check is installed globally via Composer
  • drupal-check is installed globally using consolidation/cgr
  • drupal-check is installed as a dependency to my project

Environment:

  • OS: Docker
  • PHP Version: 7.2
  • Drupal core: 8.7.5

Describe the bug
I am working with a monorepo that structure is the following:
image
image
image

Drupal Check tries to do something smart to figure out the Drupal root and the location of the vendor dir but Drupal Finder unable to locate Drupal root in the given structure if I run ./vendor/bin/drupal-check web/modules/contrib/[SYMLINKED_MODULE].
Although, if I call PHPstan directly with the following parameters it works perfectly fine: ./vendor/bin/phpstan analyze -c vendor/mglaman/drupal-check/phpstan/rules_and_deprecations_testing.neon web/modules/contrib/[SYMLINKED_MODULE].

As I can see the reason behind this is that Drupal Check calls Drupal Finder first to figure out the Drupal root to mimic PHPStan's $GLOBALS['autoloaderInWorkingDirectory'] trick. Although, as I described above Drupal Finder is unable to find Drupal root in the given setup this is the reason why Drupal Check fails but PHPstan does not.

Console output
N/A

@mxr576
Copy link
Contributor Author

mxr576 commented Jul 25, 2019

I may have a fix for this problem, I just need to verify whether it works with the global installation as well.

@mxr576 mxr576 changed the title Drupal Check could not find Drupal root but PHPstan can Drupal Check could not find Drupal root but PHPstan could Jul 25, 2019
mxr576 added a commit to mxr576/drupal-check that referenced this issue Jul 25, 2019
As it can not find it in given circumstances.

mglaman#97
mxr576 added a commit to mxr576/drupal-check that referenced this issue Jul 25, 2019
As it can not find it in given circumstances.

mglaman#97
mxr576 added a commit to mxr576/drupal-check that referenced this issue Jul 25, 2019
Sometimes Drupal root cannot be located programmatically.

mglaman#97
mxr576 added a commit to mxr576/drupal-check that referenced this issue Jul 25, 2019
Sometimes Drupal root cannot be located programmatically.

mglaman#97
wiser-soft added a commit to wiser-soft/drupal-check that referenced this issue Apr 12, 2023
Sometimes Drupal root cannot be located programmatically.

mglaman/drupal-check#97
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 a pull request may close this issue.

1 participant