Skip to content

Commit

Permalink
Merge pull request #562 from bolt/hotfix/nicer-extensions-getter
Browse files Browse the repository at this point in the history
Use 'Types::get' to avoid needing try/catch
  • Loading branch information
bobdenotter authored Aug 5, 2019
2 parents 67fde71 + 3e99fc5 commit e39a043
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/Extension/ExtensionRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@ public function addCompilerPass(string $extensionClass): void

private function addComposerPackages(): void
{
// We do a try/catch here, instead of using `method_exists`. This is
// because PHPStan is being a smart-ass, and takes the state of the
// generated `Types` class into account. And that's exactly the point.
try {
$packages = Types::boltExtension();
} catch (\Throwable $e) {
$packages = [];
}
$packages = Types::get('bolt-extension');

/** @var PackageInterface $package */
foreach ($packages as $package) {
Expand Down

0 comments on commit e39a043

Please sign in to comment.