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

installing with phar crashes because phpstan/phpstan not found #164

Closed
joachim-n opened this issue May 7, 2020 · 2 comments
Closed

installing with phar crashes because phpstan/phpstan not found #164

joachim-n opened this issue May 7, 2020 · 2 comments
Labels
bug Something isn't working phpstan Issue relates to PHPStan

Comments

@joachim-n
Copy link

How is drupal-check installed?

  • drupal-check is installed using the phar

Environment:

  • OS: macOS
  • PHP Version: 7.2
  • Drupal core: 8.8

Describe the bug

I did drupal-check docroot/modules/custom/mymodule/

and got this:

sh: /Users/joachim/Sites/myproject/docroot/modules/custom/vendor/phpstan/phpstan/phpstan: No such file or directory
sh: line 0: exec: /Users/joachim/Sites/myproject/docroot/modules/custom/vendor/phpstan/phpstan/phpstan: cannot execute: No such file or directory

Console output
Paste the output of the console when running the command with -vvv

Current working directory: /Users/joachim/Sites/myproject
Using Drupal root: /Users/joachim/Sites/myproject/docroot
Using vendor root: /Users/joachim/Sites/myproject/vendor
PHPStan configuration:
parameters:
	tipsOfTheDay: false
	reportUnmatchedIgnoredErrors: false
	excludes_analyse:
		- */tests/Drupal/Tests/Listeners/Legacy/*
		- */tests/fixtures/*.php
		- */settings*.php

	drupal:
		drupal_root: /Users/joachim/Sites/myproject/docroot

	customRulesetUsed: true
	ignoreErrors:
		- "#\\Drupal calls should be avoided in classes, use dependency injection instead#"
		- "#Plugin definitions cannot be altered.#"
		- "#Missing cache backend declaration for performance.#"
		- "#Plugin manager has cache backend specified but does not declare cache tags.#"

	bootstrap: phar:https:///Users/joachim/bin/drupal-check/error-bootstrap.php

includes:
	- phar:https:///Users/joachim/bin/drupal-check/vendor/phpstan/phpstan-deprecation-rules/rules.neon
	- phar:https:///Users/joachim/bin/drupal-check/vendor/mglaman/phpstan-drupal/extension.neon


sh: /Users/joachim/Sites/myproject/vendor/phpstan/phpstan/phpstan: No such file or directory
sh: line 0: exec: /Users/joachim/Sites/myproject/vendor/phpstan/phpstan/phpstan: cannot execute: No such file or directory
@mglaman
Copy link
Owner

mglaman commented May 10, 2020

🤔

Okay, so I looked at the code again

        $pharPath = \Phar::running();
        if ($pharPath !== '') {
            // Running in packaged Phar archive.
            $phpstanBin = 'vendor/phpstan/phpstan/phpstan';

What I noticed is that the bin path doesn't use the $pharPath, like the following

            $configuration_data['parameters']['bootstrap'] = $pharPath . '/error-bootstrap.php';
            $configuration_data['includes'] = [
                $pharPath . '/vendor/phpstan/phpstan-deprecation-rules/rules.neon',
                $pharPath . '/vendor/mglaman/phpstan-drupal/extension.neon',
            ];

So that's why it used your current directory and appended vendor/phpstan/phpstan/phpstan.

/Users/joachim/Sites/myproject/vendor/phpstan/phpstan/phpstan

@mglaman
Copy link
Owner

mglaman commented May 11, 2020

Phar is just flat out broken. I'm closing this to track the complete problem in #167

@mglaman mglaman closed this as completed May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working phpstan Issue relates to PHPStan
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants