Skip to content

Refactor OptionsArray #622

Refactor OptionsArray

Refactor OptionsArray #622

Triggered via pull request September 24, 2024 16:42
Status Success
Total duration 3m 0s
Artifacts

mutation-tests.yml

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

Annotations

12 warnings
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/Components/OptionsArray.php#L79
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ if (strcasecmp($key, $option['name']) === 0) { return $getExpr ? $option['expr'] : $option['value'] ?? ''; } - } elseif (strcasecmp($key, $option) === 0) { + } elseif (strcasecmp($key, $option) === -1) { return $option; } }
Mutation tests with PHP 8.2: src/Components/OptionsArray.php#L101
Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ if (is_array($option)) { if (strcasecmp($key, $option['name']) === 0) { unset($this->options[$idx]); - return true; + return false; } } elseif (strcasecmp($key, $option) === 0) { unset($this->options[$idx]);
Mutation tests with PHP 8.2: src/Parsers/OptionsArrays.php#L47
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ /** * The index of the option that was processed last time. */ - $lastOptionId = 0; + $lastOptionId = -1; /** * Counts brackets. */
Mutation tests with PHP 8.2: src/Parsers/OptionsArrays.php#L65
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ * * 2 ----------------------[ value ]----------------------> 0 */ - $state = 0; + $state = -1; for (; $list->idx < $list->count; ++$list->idx) { /** * Token parsed at this moment.
Mutation tests with PHP 8.2: src/Parsers/OptionsArrays.php#L67
Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ * 2 ----------------------[ value ]----------------------> 0 */ $state = 0; - for (; $list->idx < $list->count; ++$list->idx) { + for (; $list->idx <= $list->count; ++$list->idx) { /** * Token parsed at this moment. */
Mutation tests with PHP 8.2: src/Parsers/OptionsArrays.php#L132
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ // This is the beginning and the end of it. $ret->options[$lastOptionId] = $token->value; $lastOption = null; - $state = 0; + $state = -1; } elseif ($lastOption[1] === 'var' || $lastOption[1] === 'var=') { // This is a keyword that is followed by a value. // This is only the beginning. The value is parsed in state
Mutation tests with PHP 8.2: src/Parsers/OptionsArrays.php#L133
Escaped Mutant for Mutator "LogicalOrAllSubExprNegation": --- Original +++ New @@ @@ $ret->options[$lastOptionId] = $token->value; $lastOption = null; $state = 0; - } elseif ($lastOption[1] === 'var' || $lastOption[1] === 'var=') { + } elseif (!($lastOption[1] === 'var') || !($lastOption[1] === 'var=')) { // This is a keyword that is followed by a value. // This is only the beginning. The value is parsed in state // 1 and 2. State 1 is used to skip the first equals sign
Mutation tests with PHP 8.2: src/Parsers/OptionsArrays.php#L150
Escaped Mutant for Mutator "LogicalOrAllSubExprNegation": --- Original +++ New @@ @@ 'value' => '', ]; $state = 1; - } elseif ($lastOption[1] === 'expr' || $lastOption[1] === 'expr=') { + } elseif (!($lastOption[1] === 'expr') || !($lastOption[1] === 'expr=')) { // This is a keyword that is followed by an expression. // The expression is used by the specialized parser. // Skipping this option in order to parse the expression.
Mutation tests with PHP 8.2: src/Parsers/OptionsArrays.php#L196
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ $ret->options[$lastOptionId]['expr'] = $expression; } $lastOption = null; - $state = 0; + $state = -1; } else { if ($token->token === '(') { ++$brackets;
Mutation tests with PHP 8.2: src/Parsers/OptionsArrays.php#L226
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ * We reached the end of statement without getting a value * for an option for which a value was required */ - if ($state === 1 && $lastOption && ($lastOption[1] === 'expr' || $lastOption[1] === 'var' || $lastOption[1] === 'var=' || $lastOption[1] === 'expr=')) { + if (($state === 1 || $lastOption) && ($lastOption[1] === 'expr' || $lastOption[1] === 'var' || $lastOption[1] === 'var=' || $lastOption[1] === 'expr=')) { $parser->error(sprintf('Value/Expression for the option %1$s was expected.', $ret->options[$lastOptionId]['name']), $list->tokens[$list->idx - 1]); } if (empty($options['_UNSORTED'])) {