Skip to content

Commit 9123cee

Browse files
authored
composer-dependency-analyser: prepend PHPStan's PharAutoloader to avoid false reports, drop nikic/php-parser (#222)
1 parent 71f40d3 commit 9123cee

File tree

3 files changed

+71
-69
lines changed

3 files changed

+71
-69
lines changed

composer-dependency-analyser.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php declare(strict_types = 1);
22

33
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
4-
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;
54

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

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

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
],
1212
"require": {
1313
"php": "^7.4 || ^8.0",
14-
"nikic/php-parser": "^4.14.0",
1514
"phpstan/phpstan": "^1.10.51"
1615
},
1716
"require-dev": {
@@ -21,7 +20,7 @@
2120
"phpstan/phpstan-phpunit": "^1.1.1",
2221
"phpstan/phpstan-strict-rules": "^1.2.3",
2322
"phpunit/phpunit": "^9.5.20",
24-
"shipmonk/composer-dependency-analyser": "^1.2.0",
23+
"shipmonk/composer-dependency-analyser": "^1.3.0",
2524
"shipmonk/name-collision-detector": "^2.0.0",
2625
"slevomat/coding-standard": "^8.0.1"
2726
},

composer.lock

Lines changed: 65 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)