Skip to content

Some code refresh

Some code refresh #137

Triggered via pull request September 5, 2023 13:39
@bizleybizley
synchronize #183
code-refresh
Status Success
Total duration 1h 55m 44s
Artifacts

mutation.yml

on: pull_request
Matrix: Tests
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
PHP 8.1 + Infection: src/Updater.php#L93
Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ * Generates migration based on the blueprint. * @throws NotSupportedException */ - public function generateFromBlueprint(BlueprintInterface $blueprint, string $migrationName, bool $usePrefix = true, string $dbPrefix = '', string $namespace = null) : string + public function generateFromBlueprint(BlueprintInterface $blueprint, string $migrationName, bool $usePrefix = false, string $dbPrefix = '', string $namespace = null) : string { return $this->view->renderFile($this->getUpdateTableMigrationTemplate(), ['className' => $migrationName, 'namespace' => $this->getNormalizedNamespace($namespace), 'bodyUp' => $this->blueprintRenderer->renderUp($blueprint, 8, $this->tableMapper->getSchemaType(), $this->tableMapper->getEngineVersion(), $usePrefix, $dbPrefix), 'bodyDown' => $this->blueprintRenderer->renderDown($blueprint, 8, $this->tableMapper->getSchemaType(), $this->tableMapper->getEngineVersion(), $usePrefix, $dbPrefix)]); } }
PHP 8.1 + Infection: src/controllers/BaseMigrationController.php#L279
Escaped Mutant for Mutator "CloneRemoval": --- Original +++ New @@ @@ if ($this->extractor === null) { $db = Instance::ensure($this->db, Connection::class); // cloning connection here to not force reconnecting on each extraction - $configuredObject = Yii::createObject($this->extractorClass, [clone $db, $this->experimental]); + $configuredObject = Yii::createObject($this->extractorClass, [$db, $this->experimental]); if (!$configuredObject instanceof ExtractorInterface) { throw new InvalidConfigException('Extractor must implement bizley\\migration\\ExtractorInterface.'); }
PHP 8.1 + Infection: src/controllers/MigrationController.php#L960
Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ $foundCollision = false; foreach ($folders as $folder) { if ($handle = \opendir($folder)) { - while (($file = \readdir($handle)) !== false) { + while (($file = \readdir($handle)) !== true) { if ($file === '.' || $file === '..') { continue; }
PHP 8.1 + Infection: src/renderers/BlueprintRenderer.php#L75
Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ * Renders the blueprint for down(). * @see https://www.yiiframework.com/doc/api/2.0/yii-db-migration#down()-detail */ - public function renderDown(BlueprintInterface $blueprint, int $indent = 0, string $schema = null, string $engineVersion = null, bool $usePrefix = true, string $dbPrefix = null) : string + public function renderDown(BlueprintInterface $blueprint, int $indent = 0, string $schema = null, string $engineVersion = null, bool $usePrefix = false, string $dbPrefix = null) : string { $tableName = $this->renderName($blueprint->getTableName(), $usePrefix, $dbPrefix); $renderedBlueprint = \array_filter([$this->renderIndexesToDrop($blueprint, $tableName, $indent, true), $this->renderPrimaryKeyToDrop($blueprint, $tableName, $indent, $schema, true), $this->renderForeignKeysToDrop($blueprint, $tableName, $indent, $schema, true), $this->renderColumnsToDrop($blueprint, $tableName, $indent, true), $this->renderPrimaryKeyToAdd($blueprint, $tableName, $indent, $schema, true), $this->renderColumnsToAdd($blueprint, $tableName, $indent, $schema, $engineVersion, true), $this->renderColumnsToAlter($blueprint, $tableName, $indent, $schema, $engineVersion, true), $this->renderIndexesToAdd($blueprint, $tableName, $indent, true), $this->renderForeignKeysToAdd($blueprint, $tableName, $indent, $schema, $usePrefix, $dbPrefix, true)]);
PHP 8.1 + Infection: src/renderers/BlueprintRenderer.php#L180
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ /** * Renders alter columns statements. */ - private function renderColumnsToAlter(BlueprintInterface $blueprint, string $tableName, int $indent = 0, string $schema = null, string $engineVersion = null, bool $inverse = false) : ?string + private function renderColumnsToAlter(BlueprintInterface $blueprint, string $tableName, int $indent = -1, string $schema = null, string $engineVersion = null, bool $inverse = false) : ?string { $renderedColumns = []; if ($inverse) {
PHP 8.1 + Infection: src/renderers/BlueprintRenderer.php#L340
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ /** * Renders add primary key statement. */ - private function renderPrimaryKeyToAdd(BlueprintInterface $blueprint, string $tableName, int $indent = 0, string $schema = null, bool $inverse = false) : ?string + private function renderPrimaryKeyToAdd(BlueprintInterface $blueprint, string $tableName, int $indent = -1, string $schema = null, bool $inverse = false) : ?string { if ($inverse) { $primaryKey = $blueprint->getDroppedPrimaryKey();
PHP 8.1 + Infection: src/renderers/ColumnRenderer.php#L183
Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ $definition = $column->getDefinition(); if ($this->generalSchema) { if ($column instanceof PrimaryKeyColumnInterface) { - $this->isPrimaryKeyPossible = false; + $this->isPrimaryKeyPossible = true; $this->isNotNullPossible = false; } elseif ($column instanceof PrimaryKeyVariantColumnInterface && $primaryKey && !$primaryKey->isComposite() && $column->isColumnInPrimaryKey($primaryKey)) { $this->isPrimaryKeyPossible = false;
PHP 8.1 + Infection: src/renderers/ColumnRenderer.php#L202
Escaped Mutant for Mutator "UnwrapStrReplace": --- Original +++ New @@ @@ if ($this->generalSchema) { $alias = Schema::getAlias($schema, $type, (string) $length); if ($alias !== null) { - $this->definition[] = \str_replace('{renderLength}', '', $alias); + $this->definition[] = $alias; return; } }
PHP 8.1 + Infection: src/renderers/ColumnRenderer.php#L276
Escaped Mutant for Mutator "UnwrapTrim": --- Original +++ New @@ @@ $schemaAppend = $column->prepareSchemaAppend(true, $column->isAutoIncrement(), $schema); if ($schemaAppend !== null) { if (!empty($columnAppend)) { - $schemaAppend .= ' ' . \trim(\str_replace($schemaAppend, '', $columnAppend)); + $schemaAppend .= ' ' . \str_replace($schemaAppend, '', $columnAppend); } $schemaAppend = \trim($schemaAppend); }
PHP 8.1 + Infection: src/renderers/ColumnRenderer.php#L282
Escaped Mutant for Mutator "UnwrapTrim": --- Original +++ New @@ @@ } $this->definition[] = "append('" . $this->escapeQuotes($schemaAppend) . "')"; } elseif (!empty($columnAppend)) { - $this->definition[] = "append('" . $this->escapeQuotes(\trim($columnAppend)) . "')"; + $this->definition[] = "append('" . $this->escapeQuotes($columnAppend) . "')"; } $comment = $column->getComment(); if ($comment) {