Skip to content

Commit

Permalink
Disabled Collection stub for newer doctrine/collections versions
Browse files Browse the repository at this point in the history
Refs #21
  • Loading branch information
weirdan committed Apr 16, 2020
1 parent eb0a0c6 commit 7fb88b1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ public function __invoke(RegistrationInterface $psalm, ?SimpleXMLElement $config
/** @return string[] */
private function getStubFiles(): array
{
return array_merge(
glob(__DIR__ . '/stubs/*.php') ?: [],
glob(__DIR__ . '/stubs/DBAL/*.php') ?: []
);
$files = glob(__DIR__ . '/' . 'stubs/*.php');
if ($this->hasPackage('doctrine/collections')) {
[$ver,] = explode('@', $this->getPackageVersion('doctrine/collections'));
if (version_compare($ver, 'v1.6.0', '>=')) {
$files = preg_grep('/Collections\.php$/', $files, PREG_GREP_INVERT);
}
}
return array_merge($files, glob(__DIR__ . '/stubs/DBAL/*.php') ?: []);
}

/** @return string[] */
Expand Down

0 comments on commit 7fb88b1

Please sign in to comment.