Skip to content

Make constants const #464

Make constants const

Make constants const #464

Triggered via pull request September 6, 2023 16:21
Status Failure
Total duration 10m 43s
Artifacts
This run and associated checks have been archived and are scheduled for deletion. Learn more about checks retention

mutation-tests.yml

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

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/Lexer.php#L155
Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ * enabled or not * @param string $delimiter the delimiter to be used */ - public static function getTokens($str, $strict = false, $delimiter = null) : TokensList + public static function getTokens($str, $strict = true, $delimiter = null) : TokensList { $lexer = new self($str, $strict, $delimiter); return $lexer->list;
Mutation tests with PHP 8.1: src/Lexer.php#L170
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ */ public function __construct($str, $strict = false, $delimiter = null) { - parent::__construct(); + // `strlen` is used instead of `mb_strlen` because the lexer needs to // parse each byte of the input. $len = $str instanceof UtfString ? $str->length() : strlen($str);
Mutation tests with PHP 8.1: src/Lexer.php#L174
Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ parent::__construct(); // `strlen` is used instead of `mb_strlen` because the lexer needs to // parse each byte of the input. - $len = $str instanceof UtfString ? $str->length() : strlen($str); + $len = false ? $str->length() : strlen($str); // For multi-byte strings, a new instance of `UtfString` is initialized. if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { $str = new UtfString($str);
Mutation tests with PHP 8.1: src/Lexer.php#L177
Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ // parse each byte of the input. $len = $str instanceof UtfString ? $str->length() : strlen($str); // For multi-byte strings, a new instance of `UtfString` is initialized. - if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { + if (!false && $len !== mb_strlen($str, 'UTF-8')) { $str = new UtfString($str); } $this->str = $str;
Mutation tests with PHP 8.1: src/Lexer.php#L177
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ // parse each byte of the input. $len = $str instanceof UtfString ? $str->length() : strlen($str); // For multi-byte strings, a new instance of `UtfString` is initialized. - if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { + if (!$str instanceof UtfString || $len !== mb_strlen($str, 'UTF-8')) { $str = new UtfString($str); } $this->str = $str;
Mutation tests with PHP 8.1: src/Lexer.php#L197
Escaped Mutant for Mutator "PublicVisibility": --- Original +++ New @@ @@ * * @param string $delimiter the new delimiter */ - public function setDelimiter($delimiter) : void + protected function setDelimiter($delimiter) : void { $this->delimiter = $delimiter; $this->delimiterLen = strlen($delimiter);
Mutation tests with PHP 8.1: src/Lexer.php#L206
Escaped Mutant for Mutator "PublicVisibility": --- Original +++ New @@ @@ /** * Parses the string and extracts lexemes. */ - public function lex() : void + protected function lex() : void { // TODO: Sometimes, static::parse* functions make unnecessary calls to // is* functions. For a better performance, some rules can be deduced
Mutation tests with PHP 8.1: src/Lexer.php#L249
Escaped Mutant for Mutator "BitwiseAnd": --- Original +++ New @@ @@ // @Assert($this->last === $lastIdx); $token = new Token($this->str[$this->last]); $this->error('Unexpected character.', $this->str[$this->last], $this->last); - } elseif ($lastToken !== null && $token->type === Token::TYPE_SYMBOL && $token->flags & Token::FLAG_SYMBOL_VARIABLE && ($lastToken->type === Token::TYPE_STRING || $lastToken->type === Token::TYPE_SYMBOL && $lastToken->flags & Token::FLAG_SYMBOL_BACKTICK)) { + } elseif ($lastToken !== null && $token->type === Token::TYPE_SYMBOL && $token->flags | Token::FLAG_SYMBOL_VARIABLE && ($lastToken->type === Token::TYPE_STRING || $lastToken->type === Token::TYPE_SYMBOL && $lastToken->flags & Token::FLAG_SYMBOL_BACKTICK)) { // Handles ```... FROM 'user'@'%' ...```. $lastToken->token .= $token->token; $lastToken->type = Token::TYPE_SYMBOL;
Mutation tests with PHP 8.1: src/Lexer.php#L254
Escaped Mutant for Mutator "BitwiseAnd": --- Original +++ New @@ @@ // @Assert($this->last === $lastIdx); $token = new Token($this->str[$this->last]); $this->error('Unexpected character.', $this->str[$this->last], $this->last); - } elseif ($lastToken !== null && $token->type === Token::TYPE_SYMBOL && $token->flags & Token::FLAG_SYMBOL_VARIABLE && ($lastToken->type === Token::TYPE_STRING || $lastToken->type === Token::TYPE_SYMBOL && $lastToken->flags & Token::FLAG_SYMBOL_BACKTICK)) { + } elseif ($lastToken !== null && $token->type === Token::TYPE_SYMBOL && $token->flags & Token::FLAG_SYMBOL_VARIABLE && ($lastToken->type === Token::TYPE_STRING || $lastToken->type === Token::TYPE_SYMBOL && $lastToken->flags | Token::FLAG_SYMBOL_BACKTICK)) { // Handles ```... FROM 'user'@'%' ...```. $lastToken->token .= $token->token; $lastToken->type = Token::TYPE_SYMBOL;
Mutation tests with PHP 8.1: src/Lexer.php#L283
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ $list->tokens[$list->count++] = $token; // Handling delimiters. if ($token->type === Token::TYPE_NONE && $token->value === 'DELIMITER') { - if ($this->last + 1 >= $this->len) { + if ($this->last + 2 >= $this->len) { $this->error('Expected whitespace(s) before delimiter.', '', $this->last + 1); continue; }
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/