Skip to content

Commit

Permalink
extract creating a class iterator into its own method, and thereby al…
Browse files Browse the repository at this point in the history
…lowing to override it
  • Loading branch information
frederikbosch committed Sep 17, 2024
1 parent 5fbc2cd commit 823c25e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ClassScanner/ClassScannerConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function define(Container $di): void
}
}

foreach ($classMap->getClasses() as $className) {
foreach ($this->newClassIterator($classMap) as $className) {
foreach ($blueprintNamespaces as $namespace) {
if (\str_starts_with($className, $namespace)) {
$di->params[$className] = $di->params[$className] ?? [];
Expand Down Expand Up @@ -91,6 +91,14 @@ public function define(Container $di): void
}
}

/**
* @return \Iterator<int, class-string>
*/
protected function newClassIterator(ClassMap $classMap): \Iterator
{
return new \ArrayIterator($classMap->getClasses());
}

public function modify(Container $di): void
{
}
Expand Down

0 comments on commit 823c25e

Please sign in to comment.