From b137e61c9699ac519d4933cbab160691a5e5114c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 28 Aug 2024 11:06:20 +0200 Subject: [PATCH] Be consistent with how we deal with preg_match's return type I'm a bit undecided on what's the best way of doing this. Let's at least use the same strategy everywhere we can. --- src/Generator/Generator.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Generator/Generator.php b/src/Generator/Generator.php index 1945879b2..7eb5edcd8 100644 --- a/src/Generator/Generator.php +++ b/src/Generator/Generator.php @@ -9,7 +9,6 @@ use Doctrine\Migrations\Tools\Console\Helper\MigrationDirectoryHelper; use InvalidArgumentException; -use function assert; use function explode; use function file_get_contents; use function file_put_contents; @@ -75,14 +74,11 @@ public function generateMigration( string|null $up = null, string|null $down = null, ): string { - $mch = []; - $matchResult = preg_match('~(.*)\\\\([^\\\\]+)~', $fqcn, $mch); - if ($matchResult === 0) { + $mch = []; + if (preg_match('~(.*)\\\\([^\\\\]+)~', $fqcn, $mch) !== 1) { throw new InvalidArgumentException(sprintf('Invalid FQCN')); } - assert($matchResult !== false); - [$fqcn, $namespace, $className] = $mch; $dirs = $this->configuration->getMigrationDirectories();