Skip to content

Commit

Permalink
Fix BC topic.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 27, 2024
1 parent a926e63 commit 8f8a5f2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Command/BakeSimpleMigrationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ abstract class BakeSimpleMigrationCommand extends SimpleBakeCommand
*/
protected ?ConsoleIo $io = null;

/**
* Arguments
*
* @var \Cake\Console\Arguments|null
*/
protected ?Arguments $args = null;

/**
* @inheritDoc
*/
Expand All @@ -55,17 +62,16 @@ public function name(): string
/**
* @inheritDoc
*/
public function fileName($name, ?string $path = null): string
public function fileName($name): string
{
$name = $this->getMigrationName($name);
$timestamp = Util::getCurrentTimestamp();
$suffix = '_' . Inflector::camelize($name) . '.php';

if ($path) {
$offset = 0;
while (glob($path . $timestamp . '_*\\.php')) {
$timestamp = Util::getCurrentTimestamp(++$offset);
}
$path = $this->getPath($this->args);

Check failure on line 71 in src/Command/BakeSimpleMigrationCommand.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

PossiblyNullArgument

src/Command/BakeSimpleMigrationCommand.php:71:32: PossiblyNullArgument: Argument 1 of Migrations\Command\BakeSimpleMigrationCommand::getPath cannot be null, possibly null value provided (see https://psalm.dev/078)
$offset = 0;
while (glob($path . $timestamp . '_*\\.php')) {
$timestamp = Util::getCurrentTimestamp(++$offset);
}

return $timestamp . $suffix;
Expand Down Expand Up @@ -109,6 +115,7 @@ public function execute(Arguments $args, ConsoleIo $io): ?int
public function bake(string $name, Arguments $args, ConsoleIo $io): void
{
$this->io = $io;
$this->args = $args;
$migrationWithSameName = glob($this->getPath($args) . '*_' . $name . '.php');
if (!empty($migrationWithSameName)) {
$force = $args->getOption('force');
Expand Down

0 comments on commit 8f8a5f2

Please sign in to comment.