Skip to content

Add more specific psalm type for result of StringHelper::base64UrlEncode() method #566

Add more specific psalm type for result of StringHelper::base64UrlEncode() method

Add more specific psalm type for result of StringHelper::base64UrlEncode() method #566

Triggered via pull request March 17, 2024 10:36
Status Success
Total duration 1m 7s
Artifacts

mutation.yml

on: pull_request
Matrix: mutation / roave-infection
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
mutation / PHP 8.2-ubuntu-latest: src/CombinedRegexp.php#L104
Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ * https://regex101.com/r/lE1Q1S/1, https://regex101.com/r/rWg7Fj/1 */ foreach ($patterns as $i => $pattern) { - $quotedPatterns[] = $pattern . str_repeat('()', $i); + $quotedPatterns[] = str_repeat('()', $i) . $pattern; } $combinedRegexps = '(?|' . strtr(implode('|', $quotedPatterns), [self::REGEXP_DELIMITER => self::QUOTE_REPLACER]) . ')'; return self::REGEXP_DELIMITER . $combinedRegexps . self::REGEXP_DELIMITER;
mutation / PHP 8.2-ubuntu-latest: src/Inflector.php#L523
Escaped Mutant for Mutator "NotIdentical": --- Original +++ New @@ @@ { $regex = $strict ? '/(?<=\\p{L})(\\p{Lu})/u' : '/(?<=\\p{L})(?<!\\p{Lu})(\\p{Lu})/u'; $result = preg_replace($regex, addslashes($separator) . '\\1', $input); - if ($separator !== '_') { + if ($separator === '_') { $result = str_replace('_', $separator, $result); } return mb_strtolower(trim($result, $separator));
mutation / PHP 8.2-ubuntu-latest: src/Inflector.php#L524
Escaped Mutant for Mutator "UnwrapStrReplace": --- Original +++ New @@ @@ $regex = $strict ? '/(?<=\\p{L})(\\p{Lu})/u' : '/(?<=\\p{L})(?<!\\p{Lu})(\\p{Lu})/u'; $result = preg_replace($regex, addslashes($separator) . '\\1', $input); if ($separator !== '_') { - $result = str_replace('_', $separator, $result); + $result = $result; } return mb_strtolower(trim($result, $separator)); }
mutation / PHP 8.2-ubuntu-latest: src/Inflector.php#L584
Escaped Mutant for Mutator "MBString": --- Original +++ New @@ @@ public function toCamelCase(string $input) : string { $input = $this->toPascalCase($input); - return mb_strtolower(mb_substr($input, 0, 1)) . mb_substr($input, 1); + return strtolower(mb_substr($input, 0, 1)) . mb_substr($input, 1); } /** * Returns given word as "snake_cased".
mutation / PHP 8.2-ubuntu-latest: src/Inflector.php#L646
Escaped Mutant for Mutator "PregQuote": --- Original +++ New @@ @@ */ public function toSlug(string $input, string $replacement = '-', bool $lowercase = true) : string { - $quotedReplacement = preg_quote($replacement, '/'); + $quotedReplacement = $replacement; // replace all non words character $input = preg_replace('/[^a-zA-Z0-9]+/u', $replacement, $this->toTransliterated($input)); // remove first and last replacements
mutation / PHP 8.2-ubuntu-latest: src/Inflector.php#L651
Escaped Mutant for Mutator "Ternary": --- Original +++ New @@ @@ // replace all non words character $input = preg_replace('/[^a-zA-Z0-9]+/u', $replacement, $this->toTransliterated($input)); // remove first and last replacements - $input = preg_replace("/^(?:{$quotedReplacement})+|(?:{$quotedReplacement})+\$/u" . ($lowercase ? 'i' : ''), '', $input); + $input = preg_replace("/^(?:{$quotedReplacement})+|(?:{$quotedReplacement})+\$/u" . ($lowercase ? '' : 'i'), '', $input); return $lowercase ? strtolower($input) : $input; } /**
mutation / PHP 8.2-ubuntu-latest: src/Inflector.php#L651
Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ // replace all non words character $input = preg_replace('/[^a-zA-Z0-9]+/u', $replacement, $this->toTransliterated($input)); // remove first and last replacements - $input = preg_replace("/^(?:{$quotedReplacement})+|(?:{$quotedReplacement})+\$/u" . ($lowercase ? 'i' : ''), '', $input); + $input = preg_replace("/^(?:{$quotedReplacement})+|(?:{$quotedReplacement})+\$/u", '', $input); return $lowercase ? strtolower($input) : $input; } /**
mutation / PHP 8.2-ubuntu-latest: src/MemoizedCombinedRegexp.php#L39
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ } public function getMatchingPattern(string $string) : string { - $this->evaluate($string); + return $this->getPatterns()[$this->getMatchingPatternPosition($string)]; } public function getMatchingPatternPosition(string $string) : int
mutation / PHP 8.2-ubuntu-latest: src/StringHelper.php#L52
Escaped Mutant for Mutator "PublicVisibility": --- Original +++ New @@ @@ * * @return int The number of bytes in the given string. */ - public static function byteLength(string|null $input) : int + protected static function byteLength(string|null $input) : int { return mb_strlen((string) $input, '8bit'); }
mutation / PHP 8.2-ubuntu-latest: src/StringHelper.php#L54
Escaped Mutant for Mutator "MBString": --- Original +++ New @@ @@ */ public static function byteLength(string|null $input) : int { - return mb_strlen((string) $input, '8bit'); + return strlen((string) $input); } /** * Returns the portion of string specified by the start and length parameters.