diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 7f42906a5..20aa4d7ac 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -186,9 +186,6 @@ container)]]> - - - diff --git a/src/AbstractMigration.php b/src/AbstractMigration.php index 701673f11..34311bf16 100644 --- a/src/AbstractMigration.php +++ b/src/AbstractMigration.php @@ -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 diff --git a/src/BaseMigration.php b/src/BaseMigration.php index b561af9a2..d9e4ac77a 100644 --- a/src/BaseMigration.php +++ b/src/BaseMigration.php @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/CakeAdapter.php b/src/CakeAdapter.php index 2e776f41e..a837a62a4 100644 --- a/src/CakeAdapter.php +++ b/src/CakeAdapter.php @@ -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 diff --git a/src/Command/BakeMigrationDiffCommand.php b/src/Command/BakeMigrationDiffCommand.php index 13c930b30..40295687c 100644 --- a/src/Command/BakeMigrationDiffCommand.php +++ b/src/Command/BakeMigrationDiffCommand.php @@ -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 diff --git a/src/Command/Phinx/MarkMigrated.php b/src/Command/Phinx/MarkMigrated.php index 8c7b3de75..a952f819e 100644 --- a/src/Command/Phinx/MarkMigrated.php +++ b/src/Command/Phinx/MarkMigrated.php @@ -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 diff --git a/src/Command/SnapshotTrait.php b/src/Command/SnapshotTrait.php index 67332617a..8f95749c5 100644 --- a/src/Command/SnapshotTrait.php +++ b/src/Command/SnapshotTrait.php @@ -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 { diff --git a/src/ConfigurationTrait.php b/src/ConfigurationTrait.php index c30a367e6..caba2343f 100644 --- a/src/ConfigurationTrait.php +++ b/src/ConfigurationTrait.php @@ -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_*` diff --git a/src/Db/Adapter/AbstractAdapter.php b/src/Db/Adapter/AbstractAdapter.php index 066ae3438..a5ca28442 100644 --- a/src/Db/Adapter/AbstractAdapter.php +++ b/src/Db/Adapter/AbstractAdapter.php @@ -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 */ diff --git a/src/Db/Plan/Plan.php b/src/Db/Plan/Plan.php index 03bafa92a..db9647348 100644 --- a/src/Db/Plan/Plan.php +++ b/src/Db/Plan/Plan.php @@ -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 diff --git a/src/Db/Table.php b/src/Db/Table.php index d3e7a301c..eb2e29b93 100644 --- a/src/Db/Table.php +++ b/src/Db/Table.php @@ -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 diff --git a/src/Db/Table/Column.php b/src/Db/Table/Column.php index 821414778..13019aaa7 100644 --- a/src/Db/Table/Column.php +++ b/src/Db/Table/Column.php @@ -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 @@ -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 */ @@ -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 $options Options * @throws \RuntimeException diff --git a/src/Db/Table/ForeignKey.php b/src/Db/Table/ForeignKey.php index 0c3042c39..90da53e29 100644 --- a/src/Db/Table/ForeignKey.php +++ b/src/Db/Table/ForeignKey.php @@ -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 $options Options * @throws \RuntimeException diff --git a/src/Db/Table/Index.php b/src/Db/Table/Index.php index 89cac034c..264bdba54 100644 --- a/src/Db/Table/Index.php +++ b/src/Db/Table/Index.php @@ -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 $options Options * @throws \RuntimeException diff --git a/src/Migration/BackendInterface.php b/src/Migration/BackendInterface.php index 7719494d3..c6dbbd33d 100644 --- a/src/Migration/BackendInterface.php +++ b/src/Migration/BackendInterface.php @@ -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 $options Options to pass to the command * Available options are : @@ -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 The migrations list and their statuses */ public function status(array $options = []): array; diff --git a/src/Migration/BuiltinBackend.php b/src/Migration/BuiltinBackend.php index ee70978cc..d1b904edf 100644 --- a/src/Migration/BuiltinBackend.php +++ b/src/Migration/BuiltinBackend.php @@ -23,7 +23,7 @@ /** * The Migrations class is responsible for handling migrations command - * within an none-shell application. + * within a non-shell application. * * @internal */ diff --git a/src/Migration/Manager.php b/src/Migration/Manager.php index d17672225..1ed7adf8a 100644 --- a/src/Migration/Manager.php +++ b/src/Migration/Manager.php @@ -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( - ' up %14.0f %19s %19s %s ** MISSING MIGRATION FILE **', - $version['version'], - $version['start_time'], - $version['end_time'], - str_pad($version['migration_name'], $maxNameLength, ' '), - )); - - if ($version && $version['breakpoint']) { - $io->out(' BREAKPOINT SET'); - } + return array_values($migrations); } /** @@ -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 @@ -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 @@ -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 @@ -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 */ @@ -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('Breakpoint reached. Further rollbacks inhibited.'); break; } diff --git a/src/Migration/ManagerFactory.php b/src/Migration/ManagerFactory.php index b5a42920a..921190d7b 100644 --- a/src/Migration/ManagerFactory.php +++ b/src/Migration/ManagerFactory.php @@ -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. */ diff --git a/src/Migration/PhinxBackend.php b/src/Migration/PhinxBackend.php index 4b33b90c4..4c79bcfe8 100644 --- a/src/Migration/PhinxBackend.php +++ b/src/Migration/PhinxBackend.php @@ -32,7 +32,7 @@ /** * The Migrations class is responsible for handling migrations command - * within an none-shell application. + * within a non-shell application. * * @internal */ diff --git a/src/MigrationInterface.php b/src/MigrationInterface.php index 8ec7c81f3..821c1e927 100644 --- a/src/MigrationInterface.php +++ b/src/MigrationInterface.php @@ -123,7 +123,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 @@ -165,7 +165,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 @@ -178,7 +178,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 @@ -189,7 +189,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 @@ -200,7 +200,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 @@ -211,7 +211,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 @@ -254,7 +254,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 @@ -265,7 +265,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 diff --git a/src/Migrations.php b/src/Migrations.php index 4a024f75a..6937d1455 100644 --- a/src/Migrations.php +++ b/src/Migrations.php @@ -29,7 +29,7 @@ /** * The Migrations class is responsible for handling migrations command - * within an non-shell application. + * within a non-shell application. */ class Migrations { diff --git a/src/Table.php b/src/Table.php index 41834e57c..f43f3b41a 100644 --- a/src/Table.php +++ b/src/Table.php @@ -165,7 +165,7 @@ public function update(): void * {@inheritDoc} * * We disable foreign key deletion for the SQLite adapter as SQLite does not support the feature natively and the - * process implemented by Phinx has serious side-effects (for instance it rename FK references in existing tables + * process implemented by Phinx has serious side-effects (for instance it renames FK references in existing tables * which breaks the database schema cohesion). * * @param string|array $columns Column(s)