From 73a281eaabe276327f8231ed3110869d1144ab7c Mon Sep 17 00:00:00 2001 From: mscherer Date: Mon, 11 Mar 2024 05:07:48 +0100 Subject: [PATCH] Prevent runtime error. --- src/Command/FixtureCommand.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Command/FixtureCommand.php b/src/Command/FixtureCommand.php index bfcd64db..bf9a1d15 100644 --- a/src/Command/FixtureCommand.php +++ b/src/Command/FixtureCommand.php @@ -438,10 +438,12 @@ protected function _generateRecords(TableSchemaInterface $table, int $recordCoun } } else { $cases = $reflectionEnum->getCases(); - $firstCase = array_shift($cases); - /** @var \BackedEnum $firstValue */ - $firstValue = $firstCase->getValue(); - $insert = $firstValue->value; + if ($cases) { + $firstCase = array_shift($cases); + /** @var \BackedEnum $firstValue */ + $firstValue = $firstCase->getValue(); + $insert = $firstValue->value; + } } } }