Skip to content

Upgrade the codebase up to PHP 8.1 syntax using Rector #898

Upgrade the codebase up to PHP 8.1 syntax using Rector

Upgrade the codebase up to PHP 8.1 syntax using Rector #898

Triggered via pull request May 14, 2023 11:59
Status Success
Total duration 3m 2s
Artifacts

mt-annotations.yaml

on: pull_request
Matrix: tests
Annotations Status
1s
Annotations Status
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
Mutation Testing Code Review Annotations 8.1: src/Config/ValueProvider/ExcludeDirsProvider.php#L129
Escaped Mutant for Mutator "LogicalNot": --- Original +++ New @@ @@ private function getValidator(Locator $locator) : Closure { return static function ($answer) use($locator) { - if (!$answer || str_contains($answer, '*')) { + if ($answer || str_contains($answer, '*')) { return $answer; } $locator->locate($answer);
Mutation Testing Code Review Annotations 8.1: src/Config/ValueProvider/ExcludeDirsProvider.php#L129
Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ private function getValidator(Locator $locator) : Closure { return static function ($answer) use($locator) { - if (!$answer || str_contains($answer, '*')) { + if (!$answer && str_contains($answer, '*')) { return $answer; } $locator->locate($answer);
Mutation Testing Code Review Annotations 8.1: src/Config/ValueProvider/ExcludeDirsProvider.php#L129
Escaped Mutant for Mutator "LogicalOrAllSubExprNegation": --- Original +++ New @@ @@ private function getValidator(Locator $locator) : Closure { return static function ($answer) use($locator) { - if (!$answer || str_contains($answer, '*')) { + if ($answer || !str_contains($answer, '*')) { return $answer; } $locator->locate($answer);
Mutation Testing Code Review Annotations 8.1: src/Config/ValueProvider/ExcludeDirsProvider.php#L129
Escaped Mutant for Mutator "LogicalOrNegation": --- Original +++ New @@ @@ private function getValidator(Locator $locator) : Closure { return static function ($answer) use($locator) { - if (!$answer || str_contains($answer, '*')) { + if (!(!$answer || str_contains($answer, '*'))) { return $answer; } $locator->locate($answer);
Mutation Testing Code Review Annotations 8.1: src/Config/ValueProvider/ExcludeDirsProvider.php#L129
Escaped Mutant for Mutator "LogicalOrSingleSubExprNegation": --- Original +++ New @@ @@ private function getValidator(Locator $locator) : Closure { return static function ($answer) use($locator) { - if (!$answer || str_contains($answer, '*')) { + if (!$answer || !str_contains($answer, '*')) { return $answer; } $locator->locate($answer);
Mutation Testing Code Review Annotations 8.1: src/Config/ValueProvider/PhpUnitCustomExecutablePathProvider.php#L79
Escaped Mutant for Mutator "UnwrapStrReplace": --- Original +++ New @@ @@ $questionText = $this->consoleHelper->getQuestion('We did not find phpunit executable. Please provide custom absolute path'); $question = new Question($questionText); $question->setValidator($this->getValidator()); - return str_replace(DIRECTORY_SEPARATOR, '/', (string) $this->questionHelper->ask($io->getInput(), $io->getOutput(), $question)); + return (string) $this->questionHelper->ask($io->getInput(), $io->getOutput(), $question); } return null; }
Mutation Testing Code Review Annotations 8.1: src/Config/ValueProvider/PhpUnitCustomExecutablePathProvider.php#L82
Escaped Mutant for Mutator "CastString": --- Original +++ New @@ @@ $questionText = $this->consoleHelper->getQuestion('We did not find phpunit executable. Please provide custom absolute path'); $question = new Question($questionText); $question->setValidator($this->getValidator()); - return str_replace(DIRECTORY_SEPARATOR, '/', (string) $this->questionHelper->ask($io->getInput(), $io->getOutput(), $question)); + return str_replace(DIRECTORY_SEPARATOR, '/', $this->questionHelper->ask($io->getInput(), $io->getOutput(), $question)); } return null; }
Mutation Testing Code Review Annotations 8.1: src/Differ/DiffChangedLinesParser.php#L76
Escaped Mutant for Mutator "CastString": --- Original +++ New @@ @@ $filePath = null; $resultMap = []; foreach ($lines as $line) { - if (str_starts_with((string) $line, 'diff ')) { + if (str_starts_with($line, 'diff ')) { preg_match('/diff.*a\\/.*\\sb\\/(.*)/', $line, $matches); Assert::keyExists($matches, self::MATCH_INDEX, sprintf('Source file can not be found in the following diff line: "%s"', $line)); $filePath = realpath($matches[self::MATCH_INDEX]);
Mutation Testing Code Review Annotations 8.1: src/Differ/DiffChangedLinesParser.php#L86
Escaped Mutant for Mutator "CastString": --- Original +++ New @@ @@ preg_match('/diff.*a\\/.*\\sb\\/(.*)/', $line, $matches); Assert::keyExists($matches, self::MATCH_INDEX, sprintf('Source file can not be found in the following diff line: "%s"', $line)); $filePath = realpath($matches[self::MATCH_INDEX]); - } elseif (str_starts_with((string) $line, '@@ ')) { + } elseif (str_starts_with($line, '@@ ')) { Assert::string($filePath, sprintf('Real path for file from diff can not be calculated. Diff: %s', $unifiedGreppedDiff)); preg_match('/\\s\\+(.*)\\s@/', $line, $matches); Assert::keyExists($matches, self::MATCH_INDEX, sprintf('Added/modified lines can not be found in the following diff line: "%s"', $line));
Mutation Testing Code Review Annotations 8.1: src/Differ/DiffChangedLinesParser.php#L100
Escaped Mutant for Mutator "CastString": --- Original +++ New @@ @@ Assert::keyExists($matches, self::MATCH_INDEX, sprintf('Added/modified lines can not be found in the following diff line: "%s"', $line)); // can be "523,12", meaning from 523 lines new 12 are added; or just "532" $linesText = $matches[self::MATCH_INDEX]; - $lineParts = array_map('\\intval', explode(',', (string) $linesText)); + $lineParts = array_map('\\intval', explode(',', $linesText)); Assert::minCount($lineParts, 1); $startLine = $lineParts[0]; $endLine = count($lineParts) > 1 ? $lineParts[0] + $lineParts[1] - 1 : $startLine;