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
3 changes: 0 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@
<RedundantPropertyInitializationCheck>
<code><![CDATA[isset($this->container)]]></code>
</RedundantPropertyInitializationCheck>
<ReferenceReusedFromConfusingScope>
<code><![CDATA[$executedVersion]]></code>
</ReferenceReusedFromConfusingScope>
</file>
<file src="src/Migration/ManagerFactory.php">
<UndefinedConstant>
Expand Down
2 changes: 1 addition & 1 deletion src/AbstractMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AbstractMigration extends BaseAbstractMigration
/**
* Hook method to decide if this migration should use transactions
*
* By default if your driver supports transactions, a transaction will be opened
* By default, if your driver supports transactions, a transaction will be opened
* before the migration begins, and commit when the migration completes.
*
* @return bool
Expand Down
16 changes: 8 additions & 8 deletions src/BaseMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function setMigratingUp(bool $isMigratingUp)
/**
* Hook method to decide if this migration should use transactions
*
* By default if your driver supports transactions, a transaction will be opened
* By default, if your driver supports transactions, a transaction will be opened
* before the migration begins, and commit when the migration completes.
*
* @return bool
Expand Down Expand Up @@ -253,7 +253,7 @@ public function query(string $sql, array $params = []): mixed
* Returns a new Query object that can be used to build complex SELECT, UPDATE, INSERT or DELETE
* queries and execute them against the current database.
*
* Queries executed through the query builder are always sent to the database, regardless of the
* Queries executed through the query builder are always sent to the database, regardless of
* the dry-run settings.
*
* @see https://api.cakephp.org/3.6/class-Cake.Database.Query.html
Expand All @@ -269,7 +269,7 @@ public function getQueryBuilder(string $type): Query
* Returns a new SelectQuery object that can be used to build complex
* SELECT queries and execute them against the current database.
*
* Queries executed through the query builder are always sent to the database, regardless of the
* Queries executed through the query builder are always sent to the database, regardless of
* the dry-run settings.
*
* @return \Cake\Database\Query\SelectQuery
Expand All @@ -283,7 +283,7 @@ public function getSelectBuilder(): SelectQuery
* Returns a new InsertQuery object that can be used to build complex
* INSERT queries and execute them against the current database.
*
* Queries executed through the query builder are always sent to the database, regardless of the
* Queries executed through the query builder are always sent to the database, regardless of
* the dry-run settings.
*
* @return \Cake\Database\Query\InsertQuery
Expand All @@ -297,7 +297,7 @@ public function getInsertBuilder(): InsertQuery
* Returns a new UpdateQuery object that can be used to build complex
* UPDATE queries and execute them against the current database.
*
* Queries executed through the query builder are always sent to the database, regardless of the
* Queries executed through the query builder are always sent to the database, regardless of
* the dry-run settings.
*
* @return \Cake\Database\Query\UpdateQuery
Expand All @@ -311,7 +311,7 @@ public function getUpdateBuilder(): UpdateQuery
* Returns a new DeleteQuery object that can be used to build complex
* DELETE queries and execute them against the current database.
*
* Queries executed through the query builder are always sent to the database, regardless of the
* Queries executed through the query builder are always sent to the database, regardless of
* the dry-run settings.
*
* @return \Cake\Database\Query\DeleteQuery
Expand Down Expand Up @@ -369,7 +369,7 @@ public function dropDatabase(string $name): void
/**
* Creates schema.
*
* This will thrown an error for adapters that do not support schemas.
* This will throw an error for adapters that do not support schemas.
*
* @param string $name Schema name
* @return void
Expand All @@ -383,7 +383,7 @@ public function createSchema(string $name): void
/**
* Drops schema.
*
* This will thrown an error for adapters that do not support schemas.
* This will throw an error for adapters that do not support schemas.
*
* @param string $name Schema name
* @return void
Expand Down
4 changes: 2 additions & 2 deletions src/CakeAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public function getCakeConnection(): Connection
/**
* Returns a new Query object
*
* @param string $type The type of query to generate (one of the
* `\Cake\Database\Query::TYPE_*` constants).
* @param string $type The type of query to generate
* (one of the `\Cake\Database\Query::TYPE_*` constants).
* @return \Cake\Database\Query
*/
public function getQueryBuilder(string $type): Query
Expand Down
2 changes: 1 addition & 1 deletion src/Command/BakeMigrationDiffCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function templateData(Arguments $arguments): array
}

/**
* This methods runs the various methods needed to calculate a diff between the current
* This method runs the various methods needed to calculate a diff between the current
* state of the database and the schema dump file.
*
* @return void
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Phinx/MarkMigrated.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function configure(): void
/**
* Mark migrations as migrated
*
* `bin/cake migrations mark_migrated` mark every migrations as migrated
* `bin/cake migrations mark_migrated` mark every migration as migrated
* `bin/cake migrations mark_migrated all` DEPRECATED: the same effect as above
* `bin/cake migrations mark_migrated --target=VERSION` mark migrations as migrated up to the VERSION param
* `bin/cake migrations mark_migrated --target=20150417223600 --exclude` mark migrations as migrated up to
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SnapshotTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function createFile(string $path, string $contents, Arguments $args, C

/**
* @internal
* @return bool Whether or not the builtin backend is active.
* @return bool Whether the builtin backend is active.
*/
protected function useBuiltinBackend(): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigurationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ protected function getConnectionName(InputInterface $input): string
* Translates driver specific connection flags (PDO attributes) to
* Phinx compatible adapter options.
*
* Currently Phinx supports of the following flags:
* Currently, Phinx supports of the following flags:
*
* - *Most* of `PDO::ATTR_*`
* - `PDO::MYSQL_ATTR_*`
Expand Down
2 changes: 1 addition & 1 deletion src/Db/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ public function dropIndex(string $tableName, string|array $columns): void
/**
* Returns the instructions to drop the specified index from a database table.
*
* @param string $tableName The name of of the table where the index is
* @param string $tableName The name of the table where the index is
* @param string|string[] $columns Column(s)
* @return \Migrations\Db\AlterInstructions
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Db/Plan/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function (RenameColumn $a, ChangeColumn $b) {
$this->tableUpdates = $tableUpdates;

// Dropping indexes used by foreign keys is a conflict, but one we can resolve
// if the foreign key is also scheduled to be dropped. If we can find such a a case,
// if the foreign key is also scheduled to be dropped. If we can find such a case,
// we force the execution of the index drop after the foreign key is dropped.
// Changing constraint properties sometimes require dropping it and then
// creating it again with the new stuff. Unfortunately, we have already bundled
Expand Down
2 changes: 1 addition & 1 deletion src/Db/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ public function save(): void
/**
* Executes all the pending actions for this table
*
* @param bool $exists Whether or not the table existed prior to executing this method
* @param bool $exists Whether the table existed prior to executing this method
* @return void
*/
protected function executeActions(bool $exists): void
Expand Down
6 changes: 3 additions & 3 deletions src/Db/Table/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function getGenerated(): ?string
}

/**
* Sets whether or not the column is an identity column.
* Sets whether the column is an identity column.
*
* @param bool $identity Identity
* @return $this
Expand All @@ -332,7 +332,7 @@ public function setIdentity(bool $identity)
}

/**
* Gets whether or not the column is an identity column.
* Gets whether the column is an identity column.
*
* @return bool
*/
Expand Down Expand Up @@ -771,7 +771,7 @@ protected function getAliasedOptions(): array
}

/**
* Utility method that maps an array of column options to this objects methods.
* Utility method that maps an array of column options to this object's methods.
*
* @param array<string, mixed> $options Options
* @throws \RuntimeException
Expand Down
2 changes: 1 addition & 1 deletion src/Db/Table/ForeignKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function getDeferrableMode(): ?string
}

/**
* Utility method that maps an array of index options to this objects methods.
* Utility method that maps an array of index options to this object's methods.
*
* @param array<string, mixed> $options Options
* @throws \RuntimeException
Expand Down
2 changes: 1 addition & 1 deletion src/Db/Table/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function getWhere(): ?string
}

/**
* Utility method that maps an array of index options to this objects methods.
* Utility method that maps an array of index options to this object's methods.
*
* @param array<string, mixed> $options Options
* @throws \RuntimeException
Expand Down
4 changes: 2 additions & 2 deletions src/Migration/BackendInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
interface BackendInterface
{
/**
* Returns the status of each migrations based on the options passed
* Returns the status of each migration based on the options passed
*
* @param array<string, mixed> $options Options to pass to the command
* Available options are :
Expand All @@ -15,7 +15,7 @@ interface BackendInterface
* - `connection` The datasource connection to use
* - `source` The folder where migrations are in
* - `plugin` The plugin containing the migrations
* @return array The migrations list and their statuses
* @return array<string, string> The migrations list and their statuses
*/
public function status(array $options = []): array;

Expand Down
2 changes: 1 addition & 1 deletion src/Migration/BuiltinBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* The Migrations class is responsible for handling migrations command
* within an none-shell application.
* within a non-shell application.
*
* @internal
*/
Expand Down
42 changes: 9 additions & 33 deletions src/Migration/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,32 +123,8 @@ public function printStatus(?string $format = null): array
}

ksort($migrations);
$migrations = array_values($migrations);

return $migrations;
}

/**
* Print Missing Version
*
* @param array $version The missing version to print (in the format returned by Environment.getVersionLog).
* @param int $maxNameLength The maximum migration name length.
* @return void
*/
protected function printMissingVersion(array $version, int $maxNameLength): void
{
$io = $this->getIo();
$io->out(sprintf(
' <error>up</error> %14.0f %19s %19s <comment>%s</comment> <error>** MISSING MIGRATION FILE **</error>',
$version['version'],
$version['start_time'],
$version['end_time'],
str_pad($version['migration_name'], $maxNameLength, ' '),
));

if ($version && $version['breakpoint']) {
$io->out(' <error>BREAKPOINT SET</error>');
}
return array_values($migrations);
}

/**
Expand Down Expand Up @@ -514,7 +490,7 @@ public function executeSeed(SeedInterface $seed): void
*
* @param \Migrations\MigrationInterface $migration Migration
* @param string $status Status of the migration
* @param string|null $duration Duration the migration took the be executed
* @param string|null $duration Duration the migration took to be executed
* @return void
*/
protected function printMigrationStatus(MigrationInterface $migration, string $status, ?string $duration = null): void
Expand All @@ -531,7 +507,7 @@ protected function printMigrationStatus(MigrationInterface $migration, string $s
*
* @param \Migrations\SeedInterface $seed Seed
* @param string $status Status of the seed
* @param string|null $duration Duration the seed took the be executed
* @param string|null $duration Duration the seed took to be executed
* @return void
*/
protected function printSeedStatus(SeedInterface $seed, string $status, ?string $duration = null): void
Expand All @@ -548,7 +524,7 @@ protected function printSeedStatus(SeedInterface $seed, string $status, ?string
*
* @param string $name Name of the migration or seed
* @param string $status Status of the migration or seed
* @param string|null $duration Duration the migration or seed took the be executed
* @param string|null $duration Duration the migration or seed took to be executed
* @return void
*/
protected function printStatusOutput(string $name, string $status, ?string $duration = null): void
Expand Down Expand Up @@ -582,7 +558,7 @@ public function rollback(int|string|null $target = null, bool $force = false, bo
$io = $this->getIo();

foreach ($executedVersions as $versionCreationTime => &$executedVersion) {
// if we have a date (ie. the target must not match a version) and we are sorting by execution time, we
// if we have a date (i.e. the target must not match a version) and we are sorting by execution time, we
// convert the version start time so we can compare directly with the target date
if (!$this->getConfig()->isVersionOrderCreationTime() && !$targetMustMatchVersion) {
/** @var \DateTime $dateTime */
Expand Down Expand Up @@ -649,18 +625,18 @@ public function rollback(int|string|null $target = null, bool $force = false, bo
}

if (in_array($migration->getVersion(), $executedVersionCreationTimes)) {
$executedVersion = $executedVersions[$migration->getVersion()];
$executedArray = $executedVersions[$migration->getVersion()];

if (!$targetMustMatchVersion) {
if (
($this->getConfig()->isVersionOrderCreationTime() && $executedVersion['version'] <= $target) ||
(!$this->getConfig()->isVersionOrderCreationTime() && $executedVersion['start_time'] <= $target)
($this->getConfig()->isVersionOrderCreationTime() && $executedArray['version'] <= $target) ||
(!$this->getConfig()->isVersionOrderCreationTime() && $executedArray['start_time'] <= $target)
) {
break;
}
}

if ($executedVersion['breakpoint'] != 0 && !$force) {
if ($executedArray['breakpoint'] != 0 && !$force) {
$io->out('<error>Breakpoint reached. Further rollbacks inhibited.</error>');
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Migration/ManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ManagerFactory
* - source - The directory in app/config that migrations and seeds should be read from.
* - plugin - The plugin name that migrations are being run on.
* - connection - The connection name.
* - dry-run - Whether or not dry-run mode should be enabled.
* - dry-run - Whether dry-run mode should be enabled.
*
* @param array $options The command line options for creating config/manager.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Migration/PhinxBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

/**
* The Migrations class is responsible for handling migrations command
* within an none-shell application.
* within a non-shell application.
*
* @internal
*/
Expand Down
Loading
Loading