Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"stan": "phpstan analyse",
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:~1.12.0 && mv composer.backup composer.json",
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:~2.1.0 && mv composer.backup composer.json",
"lowest": "validate-prefer-lowest",
"lowest-setup": "composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction && cp composer.json composer.backup && composer require --dev dereuromark/composer-prefer-lowest && mv composer.backup composer.json",
"test": "phpunit --colors=always"
Expand Down
2 changes: 1 addition & 1 deletion src/Phinx/Db/Adapter/MysqlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ protected function getColumnSqlDefinition(Column $column): string
}

$values = $column->getValues();
if ($values && is_array($values)) {
if ($values) {
$def .= '(' . implode(', ', array_map(function ($value) {
// we special case NULL as it's not actually allowed an enum value,
// and we want MySQL to issue an error on the create statement, but
Expand Down
2 changes: 1 addition & 1 deletion src/Phinx/Db/Table/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function setOptions(array $options)
}

// handle $options['unique']
if (strcasecmp($option, self::UNIQUE) === 0) {
if ($option === self::UNIQUE) {
if ((bool)$value) {
$this->setType(self::UNIQUE);
}
Expand Down
10 changes: 2 additions & 8 deletions src/Phinx/Migration/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -983,14 +983,8 @@ public function getSeeds(string $environment): array
$seed = new $class();
}
$seed->setEnvironment($environment);
$input = $this->getInput();
if ($input !== null) {
$seed->setInput($input);
}
$output = $this->getOutput();
if ($output !== null) {
$seed->setOutput($output);
}
$seed->setInput($this->getInput());
$seed->setOutput($this->getOutput());

if (!($seed instanceof AbstractSeed)) {
throw new InvalidArgumentException(sprintf(
Expand Down
12 changes: 9 additions & 3 deletions src/Phinx/Migration/Manager/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ public function executeMigration(MigrationInterface $migration, string $directio
$migration->{MigrationInterface::CHANGE}();
}
} else {
if (!method_exists($migration, $direction)) {
throw new RuntimeException(sprintf(
'Migration "%s" must define a %s() or %s() method.',
get_class($migration),
MigrationInterface::CHANGE,
$direction,
));
}
$migration->{$direction}();
}
}
Expand Down Expand Up @@ -143,9 +151,7 @@ public function executeSeed(SeedInterface $seed): void
}

// Run the seeder
if (method_exists($seed, SeedInterface::RUN)) {
$seed->{SeedInterface::RUN}();
}
$seed->run();

// commit the transaction if the adapter supports it
if ($this->getAdapter()->hasTransactions()) {
Expand Down
4 changes: 1 addition & 3 deletions src/Phinx/Seed/AbstractSeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ public function fetchAll(string $sql): array
public function insert(string $table, array $data): void
{
// convert to table object
if (is_string($table)) {
$table = new Table($table, [], $this->getAdapter());
}
$table = new Table($table, [], $this->getAdapter());
$table->insert($data)->save();
}

Expand Down