Skip to content
Snippets Groups Projects
Commit d0ec078d authored by Daniel Kurowski's avatar Daniel Kurowski
Browse files

Merge branch 'allow-definitions-to-be-iterable' into 'master'

Allow definitions to be iterable

See merge request grifart/class-scaffolder!37
parents 0e782457 abd80f28
No related branches found
Tags v0.5.3
1 merge request!37Allow definitions to be iterable
Pipeline #35289 passed
......@@ -122,7 +122,7 @@ final class GenerateClassCommand extends Command
/**
* @return ClassDefinition[]
*/
private function loadDefinitions(string $definitionFile): array
private function loadDefinitions(string $definitionFile): iterable
{
$definitionFile = Path::canonicalize($definitionFile);
if ( ! \file_exists($definitionFile)) {
......@@ -133,7 +133,7 @@ final class GenerateClassCommand extends Command
}
$definitions = require $definitionFile;
if (!\is_array($definitions)) {
if ( ! \is_iterable($definitions)) {
$definitions = [$definitions];
}
foreach($definitions as $definition) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment