Make Token::$value and Token::$keyword types more strict #572
Annotations
1 error and 11 warnings
Mutation tests with PHP 8.1
Process completed with exit code 1.
|
Mutation tests with PHP 8.1:
src/Statements/PurgeStatement.php#L46
Escaped Mutant for Mutator "UnwrapTrim":
--- Original
+++ New
@@ @@
public function build() : string
{
$ret = 'PURGE ' . $this->logType . ' LOGS ' . ($this->endOption !== null ? $this->endOption . ' ' . $this->endExpr : '');
- return trim($ret);
+ return $ret;
}
/**
* @param Parser $parser the instance that requests parsing
|
Mutation tests with PHP 8.1:
src/Statements/PurgeStatement.php#L63
Escaped Mutant for Mutator "LessThan":
--- Original
+++ New
@@ @@
*/
$state = 0;
$prevToken = null;
- for (; $list->idx < $list->count; ++$list->idx) {
+ for (; $list->idx <= $list->count; ++$list->idx) {
/**
* Token parsed at this moment.
*/
|
Mutation tests with PHP 8.1:
src/Token.php#L116
Escaped Mutant for Mutator "PublicVisibility":
--- Original
+++ New
@@ @@
*
* If no processing can be done it will return the initial string.
*/
- public function extract() : bool|float|int|string
+ protected function extract() : bool|float|int|string
{
switch ($this->type) {
case TokenType::Keyword:
|
Mutation tests with PHP 8.1:
src/Token.php#L138
Escaped Mutant for Mutator "ArrayItemRemoval":
--- Original
+++ New
@@ @@
$ret = str_replace('--', '', $this->token);
// e.g. ---42 === -42
if ($this->flags & self::FLAG_NUMBER_HEX) {
- $ret = str_replace(['-', '+'], '', $this->token);
+ $ret = str_replace(['+'], '', $this->token);
if ($this->flags & self::FLAG_NUMBER_NEGATIVE) {
$ret = -hexdec($ret);
} else {
|
Mutation tests with PHP 8.1:
src/Token.php#L138
Escaped Mutant for Mutator "UnwrapStrReplace":
--- Original
+++ New
@@ @@
$ret = str_replace('--', '', $this->token);
// e.g. ---42 === -42
if ($this->flags & self::FLAG_NUMBER_HEX) {
- $ret = str_replace(['-', '+'], '', $this->token);
+ $ret = $this->token;
if ($this->flags & self::FLAG_NUMBER_NEGATIVE) {
$ret = -hexdec($ret);
} else {
|
Mutation tests with PHP 8.1:
src/Token.php#L145
Escaped Mutant for Mutator "CastFloat":
--- Original
+++ New
@@ @@
$ret = hexdec($ret);
}
} elseif ($this->flags & self::FLAG_NUMBER_APPROXIMATE || $this->flags & self::FLAG_NUMBER_FLOAT) {
- $ret = (float) $ret;
+ $ret = $ret;
} elseif (!($this->flags & self::FLAG_NUMBER_BINARY)) {
$ret = (int) $ret;
}
|
Mutation tests with PHP 8.1:
src/Token.php#L155
Escaped Mutant for Mutator "MBString":
--- Original
+++ New
@@ @@
case TokenType::String:
// Trims quotes.
$str = $this->token;
- $str = mb_substr($str, 1, -1, 'UTF-8');
+ $str = substr($str, 1, -1);
// Removes surrounding quotes.
$quote = $this->token[0];
$str = str_replace($quote . $quote, $quote, $str);
|
Mutation tests with PHP 8.1:
src/Token.php#L159
Escaped Mutant for Mutator "ConcatOperandRemoval":
--- Original
+++ New
@@ @@
$str = mb_substr($str, 1, -1, 'UTF-8');
// Removes surrounding quotes.
$quote = $this->token[0];
- $str = str_replace($quote . $quote, $quote, $str);
+ $str = str_replace($quote, $quote, $str);
// Finally unescapes the string.
//
// `stripcslashes` replaces escape sequences with their
|
Mutation tests with PHP 8.1:
src/Token.php#L159
Escaped Mutant for Mutator "ConcatOperandRemoval":
--- Original
+++ New
@@ @@
$str = mb_substr($str, 1, -1, 'UTF-8');
// Removes surrounding quotes.
$quote = $this->token[0];
- $str = str_replace($quote . $quote, $quote, $str);
+ $str = str_replace($quote, $quote, $str);
// Finally unescapes the string.
//
// `stripcslashes` replaces escape sequences with their
|
Mutation tests with PHP 8.1:
src/Token.php#L159
Escaped Mutant for Mutator "UnwrapStrReplace":
--- Original
+++ New
@@ @@
$str = mb_substr($str, 1, -1, 'UTF-8');
// Removes surrounding quotes.
$quote = $this->token[0];
- $str = str_replace($quote . $quote, $quote, $str);
+ $str = $str;
// Finally unescapes the string.
//
// `stripcslashes` replaces escape sequences with their
|
Mutation tests with PHP 8.1
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/
|