Skip to content

Commit

Permalink
composer-dependency-analyser: prepend PHPStan's PharAutoloader to avo…
Browse files Browse the repository at this point in the history
…id false reports, drop nikic/php-parser (#222)
  • Loading branch information
janedbal committed Mar 5, 2024
1 parent 71f40d3 commit 9123cee
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 69 deletions.
9 changes: 5 additions & 4 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php declare(strict_types = 1);

use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;

$config = new Configuration();
$pharFile = __DIR__ . '/vendor/phpstan/phpstan/phpstan.phar';
Phar::loadPhar($pharFile, 'phpstan.phar');

return $config
->ignoreErrorsOnPackage('phpstan/phpdoc-parser', [ErrorType::SHADOW_DEPENDENCY]); // it gets autoloaded from within the PHPStan.phar when running PHPStan
require_once('phar://phpstan.phar/preload.php'); // prepends PHPStan's PharAutolaoder to composer's autoloader

return new Configuration();
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
],
"require": {
"php": "^7.4 || ^8.0",
"nikic/php-parser": "^4.14.0",
"phpstan/phpstan": "^1.10.51"
},
"require-dev": {
Expand All @@ -21,7 +20,7 @@
"phpstan/phpstan-phpunit": "^1.1.1",
"phpstan/phpstan-strict-rules": "^1.2.3",
"phpunit/phpunit": "^9.5.20",
"shipmonk/composer-dependency-analyser": "^1.2.0",
"shipmonk/composer-dependency-analyser": "^1.3.0",
"shipmonk/name-collision-detector": "^2.0.0",
"slevomat/coding-standard": "^8.0.1"
},
Expand Down
128 changes: 65 additions & 63 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9123cee

Please sign in to comment.