Skip to content

Commit

Permalink
Merge pull request #1453 from greg0ire/fix-build
Browse files Browse the repository at this point in the history
Assert there is no failure
  • Loading branch information
greg0ire committed Aug 27, 2024
2 parents a0eb4e1 + edec5c5 commit fb79c93
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Generator/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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;
Expand Down Expand Up @@ -74,11 +75,14 @@ public function generateMigration(
string|null $up = null,
string|null $down = null,
): string {
$mch = [];
if (preg_match('~(.*)\\\\([^\\\\]+)~', $fqcn, $mch) === 0) {
$mch = [];
$matchResult = preg_match('~(.*)\\\\([^\\\\]+)~', $fqcn, $mch);
if ($matchResult === 0) {
throw new InvalidArgumentException(sprintf('Invalid FQCN'));
}

assert($matchResult !== false);

[$fqcn, $namespace, $className] = $mch;

$dirs = $this->configuration->getMigrationDirectories();
Expand Down

0 comments on commit fb79c93

Please sign in to comment.