Micro optimizations and refactorings #623
Annotations
1 error and 12 warnings
Mutation tests with PHP 8.2
Process completed with exit code 1.
|
Mutation tests with PHP 8.2
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v3, actions/cache@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|
Mutation tests with PHP 8.2
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
Mutation tests with PHP 8.2:
src/Context.php#L389
Escaped Mutant for Mutator "MatchArmRemoval":
--- Original
+++ New
@@ @@
{
return match (true) {
str_starts_with($string, '#') => Token::FLAG_COMMENT_BASH,
- str_starts_with($string, '/*!') => Token::FLAG_COMMENT_MYSQL_CMD,
// If comment is opening C style (/*) or is closing C style (*/), warning, it could conflict
// with wildcard and a real opening C style.
// It would look like the following valid SQL statement: "SELECT */* comment */ FROM...".
|
Mutation tests with PHP 8.2:
src/Context.php#L466
Escaped Mutant for Mutator "LessThanOrEqualTo":
--- Original
+++ New
@@ @@
{
// NOTES: Only non-alphanumeric ASCII characters may be separators.
// `~` is the last printable ASCII character.
- return $string <= '~' && $string !== '_' && $string !== '$' && ($string < '0' || $string > '9') && ($string < 'a' || $string > 'z') && ($string < 'A' || $string > 'Z');
+ return $string < '~' && $string !== '_' && $string !== '$' && ($string < '0' || $string > '9') && ($string < 'a' || $string > 'z') && ($string < 'A' || $string > 'Z');
}
/**
* Loads the specified context.
|
Mutation tests with PHP 8.2:
src/Context.php#L493
Escaped Mutant for Mutator "Concat":
--- Original
+++ New
@@ @@
if (!class_exists($contextClass)) {
$contextClass = self::CONTEXT_PREFIX . $context;
if (!class_exists($contextClass)) {
- $contextClass = '\\' . $context;
+ $contextClass = $context . '\\';
if (!class_exists($contextClass)) {
return false;
}
|
Mutation tests with PHP 8.2:
src/Context.php#L493
Escaped Mutant for Mutator "ConcatOperandRemoval":
--- Original
+++ New
@@ @@
if (!class_exists($contextClass)) {
$contextClass = self::CONTEXT_PREFIX . $context;
if (!class_exists($contextClass)) {
- $contextClass = '\\' . $context;
+ $contextClass = $context;
if (!class_exists($contextClass)) {
return false;
}
|
Mutation tests with PHP 8.2:
src/Context.php#L521
Escaped Mutant for Mutator "GreaterThan":
--- Original
+++ New
@@ @@
public static function loadClosest(string $context = '') : string|null
{
$length = strlen($context);
- for ($i = $length; $i > 0;) {
+ for ($i = $length; $i >= 0;) {
/* Trying to load the new context */
if (static::load($context)) {
return $context;
|
Mutation tests with PHP 8.2:
src/Context.php#L528
Escaped Mutant for Mutator "DoWhile":
--- Original
+++ New
@@ @@
if (!is_numeric($part)) {
break 2;
}
- } while (intval($part) === 0 && $i > 0);
+ } while (false);
$context = substr($context, 0, $i) . '00' . substr($context, $i + 2);
}
/* Fallback to loading at least matching engine */
|
Mutation tests with PHP 8.2:
src/Context.php#L529
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
}
/* Replace last two non zero digits by zeroes */
do {
- $i -= 2;
+ $i -= 1;
$part = substr($context, $i, 2);
/* No more numeric parts to strip */
if (!is_numeric($part)) {
|
Mutation tests with PHP 8.2:
src/Context.php#L530
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
/* Replace last two non zero digits by zeroes */
do {
$i -= 2;
- $part = substr($context, $i, 2);
+ $part = substr($context, $i, 1);
/* No more numeric parts to strip */
if (!is_numeric($part)) {
break 2;
|
Mutation tests with PHP 8.2:
src/Context.php#L530
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
/* Replace last two non zero digits by zeroes */
do {
$i -= 2;
- $part = substr($context, $i, 2);
+ $part = substr($context, $i, 3);
/* No more numeric parts to strip */
if (!is_numeric($part)) {
break 2;
|
Mutation tests with PHP 8.2:
src/Context.php#L533
Escaped Mutant for Mutator "Break_":
--- Original
+++ New
@@ @@
$part = substr($context, $i, 2);
/* No more numeric parts to strip */
if (!is_numeric($part)) {
- break 2;
+ continue;
}
} while (intval($part) === 0 && $i > 0);
$context = substr($context, 0, $i) . '00' . substr($context, $i + 2);
|