Add native property types in Token #551
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/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() : mixed
+ protected function extract() : mixed
{
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:
src/Token.php#L179
Escaped Mutant for Mutator "MBString":
--- Original
+++ New
@@ @@
if (isset($str[0]) && $str[0] === '@') {
// `mb_strlen($str)` must be used instead of `null` because
// in PHP 5.3- the `null` parameter isn't handled correctly.
- $str = mb_substr($str, !empty($str[1]) && $str[1] === '@' ? 2 : 1, mb_strlen($str), 'UTF-8');
+ $str = substr($str, !empty($str[1]) && $str[1] === '@' ? 2 : 1, mb_strlen($str));
}
if (isset($str[0]) && $str[0] === ':') {
$str = mb_substr($str, 1, mb_strlen($str), 'UTF-8');
|
Mutation tests with PHP 8.1:
src/Token.php#L181
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
if (isset($str[0]) && $str[0] === '@') {
// `mb_strlen($str)` must be used instead of `null` because
// in PHP 5.3- the `null` parameter isn't handled correctly.
- $str = mb_substr($str, !empty($str[1]) && $str[1] === '@' ? 2 : 1, mb_strlen($str), 'UTF-8');
+ $str = mb_substr($str, !empty($str[2]) && $str[1] === '@' ? 2 : 1, mb_strlen($str), 'UTF-8');
}
if (isset($str[0]) && $str[0] === ':') {
$str = mb_substr($str, 1, mb_strlen($str), 'UTF-8');
|
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/
|