Skip to content

Commit 9cd072d

Browse files
authored
Merge pull request #1454 from greg0ire/consistency
Be consistent with how we deal with preg_match's return type
2 parents fb79c93 + b137e61 commit 9cd072d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/Generator/Generator.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Doctrine\Migrations\Tools\Console\Helper\MigrationDirectoryHelper;
1010
use InvalidArgumentException;
1111

12-
use function assert;
1312
use function explode;
1413
use function file_get_contents;
1514
use function file_put_contents;
@@ -75,14 +74,11 @@ public function generateMigration(
7574
string|null $up = null,
7675
string|null $down = null,
7776
): string {
78-
$mch = [];
79-
$matchResult = preg_match('~(.*)\\\\([^\\\\]+)~', $fqcn, $mch);
80-
if ($matchResult === 0) {
77+
$mch = [];
78+
if (preg_match('~(.*)\\\\([^\\\\]+)~', $fqcn, $mch) !== 1) {
8179
throw new InvalidArgumentException(sprintf('Invalid FQCN'));
8280
}
8381

84-
assert($matchResult !== false);
85-
8682
[$fqcn, $namespace, $className] = $mch;
8783

8884
$dirs = $this->configuration->getMigrationDirectories();

0 commit comments

Comments
 (0)