Skip to content

Commit

Permalink
perf: get rid of iterator_to_array
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck committed Feb 8, 2023
1 parent 8962c0c commit 6124baf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private function createComponentFromPackage(PackageInterface $package, ?string $
)
);
$component->getExternalReferences()->addItems(
...iterator_to_array($this->createExternalReferencesFromPackage($package))
...$this->createExternalReferencesFromPackage($package)
);
}

Expand Down Expand Up @@ -253,7 +253,7 @@ private function createPurlFromComponent(Models\Component $component): ?PackageU
}

/**
* @psalm-return Generator<Models\ExternalReference>
* @psalm-return Generator<int,Models\ExternalReference>
*
* @psalm-suppress MissingThrowsDocblock
*/
Expand Down Expand Up @@ -283,9 +283,9 @@ private function createExternalReferencesFromPackage(CompletePackageInterface $p
}

/**
* @psalm-suppress MissingThrowsDocblock
* @psalm-return Generator<int,Models\Tool>
*
* @psalm-return Generator<int, Models\Tool>
* @psalm-suppress MissingThrowsDocblock
*/
public function createToolsFromComposer(
Composer $composer,
Expand Down Expand Up @@ -331,7 +331,7 @@ private function createToolFromPackage(PackageInterface $package, ?string $versi
$tool->setVersion($versionOverride ?? $package->getFullPrettyVersion());
if ($package instanceof CompletePackageInterface) {
$tool->getExternalReferences()->addItems(
...iterator_to_array($this->createExternalReferencesFromPackage($package))
...$this->createExternalReferencesFromPackage($package)
);
}
if ($distUrl) {
Expand Down

0 comments on commit 6124baf

Please sign in to comment.