Skip to content

Commit

Permalink
Dump PHPStan version constraint for each package
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 6, 2024
1 parent bfd401b commit aae3978
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,22 @@ public function process(Event $event): void
? $installPath
: getcwd() . DIRECTORY_SEPARATOR . $installPath;

$packageRequires = $package->getRequires();
$phpstanConstraint = null;
if (array_key_exists('phpstan/phpstan', $packageRequires)) {
$phpstanConstraint = $packageRequires['phpstan/phpstan']->getConstraint();
$phpstanVersionConstraints[] = $phpstanConstraint;
}

$data[$package->getName()] = [
'install_path' => $absoluteInstallPath,
'relative_install_path' => $fs->findShortestPath(dirname($generatedConfigFilePath), $absoluteInstallPath, true),
'extra' => $package->getExtra()['phpstan'] ?? null,
'version' => $package->getFullPrettyVersion(),
'phpstanVersionConstraint' => $phpstanConstraint !== null ? (string) $phpstanConstraint : null,
];

$installedPackages[$package->getName()] = true;

$packageRequires = $package->getRequires();
if (!array_key_exists('phpstan/phpstan', $packageRequires)) {
continue;
}

$phpstanVersionConstraints[] = $packageRequires['phpstan/phpstan']->getConstraint();
}

$phpstanVersionConstraint = null;
Expand Down

0 comments on commit aae3978

Please sign in to comment.