Skip to content

Commit

Permalink
Update CaseConverter.php
Browse files Browse the repository at this point in the history
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
  • Loading branch information
ghostwriter committed Feb 10, 2024
1 parent a5c7412 commit 69a981f
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/CaseConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,39 +105,48 @@ public function upperCase(string $string): string

private function glueDash(array $words, Closure $converter): string
{
/** @var list<string> $words */
return implode('-', array_map($converter, $words));
return implode('-', $this->map($converter, $words));
}

private function glueDot(array $words, Closure $converter): string
{
/** @var list<string> $words */
return implode('.', array_map($converter, $words));
return implode('.', $this->map($converter, $words));
}

private function glueSpace(array $words, Closure $converter): string
{
/** @var list<string> $words */
return implode(' ', array_map($converter, $words));
return implode(' ', $this->map($converter, $words));
}

private function glueUnderscore(array $words, Closure $converter): string
{
/** @var list<string> $words */
return implode('_', array_map($converter, $words));
return implode('_', $this->map($converter, $words));
}

private function glueUppercase(array $words, Closure $converter): string
{
/** @var list<string> $words */
return implode('', array_map($converter, $words));
return implode('', $this->map($converter, $words));
}

private function isUppercaseWord(string $string): bool
{
return preg_match('#^\p{Lu}+$#u', $string) === 1;

Check warning on line 133 in src/CaseConverter.php

View workflow job for this annotation

GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked

Escaped Mutant for Mutator "PregMatchRemoveCaret": --- Original +++ New @@ @@ } private function isUppercaseWord(string $string) : bool { - return preg_match('#^\\p{Lu}+$#u', $string) === 1; + return preg_match('#\\p{Lu}+$#u', $string) === 1; } /** * @return list<string>

Check warning on line 133 in src/CaseConverter.php

View workflow job for this annotation

GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked

Escaped Mutant for Mutator "PregMatchRemoveFlags": --- Original +++ New @@ @@ } private function isUppercaseWord(string $string) : bool { - return preg_match('#^\\p{Lu}+$#u', $string) === 1; + return preg_match('#^\\p{Lu}+$#', $string) === 1; } /** * @return list<string>

Check warning on line 133 in src/CaseConverter.php

View workflow job for this annotation

GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ } private function isUppercaseWord(string $string) : bool { - return preg_match('#^\\p{Lu}+$#u', $string) === 1; + return preg_match('#^\\p{Lu}+$#u', $string) === 2; } /** * @return list<string>

Check warning on line 133 in src/CaseConverter.php

View workflow job for this annotation

GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked

Escaped Mutant for Mutator "PregMatchRemoveCaret": --- Original +++ New @@ @@ } private function isUppercaseWord(string $string) : bool { - return preg_match('#^\\p{Lu}+$#u', $string) === 1; + return preg_match('#\\p{Lu}+$#u', $string) === 1; } /** * @return list<string>

Check warning on line 133 in src/CaseConverter.php

View workflow job for this annotation

GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked

Escaped Mutant for Mutator "PregMatchRemoveFlags": --- Original +++ New @@ @@ } private function isUppercaseWord(string $string) : bool { - return preg_match('#^\\p{Lu}+$#u', $string) === 1; + return preg_match('#^\\p{Lu}+$#', $string) === 1; } /** * @return list<string>

Check warning on line 133 in src/CaseConverter.php

View workflow job for this annotation

GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ } private function isUppercaseWord(string $string) : bool { - return preg_match('#^\\p{Lu}+$#u', $string) === 1; + return preg_match('#^\\p{Lu}+$#u', $string) === 2; } /** * @return list<string>

Check warning on line 133 in src/CaseConverter.php

View workflow job for this annotation

GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked

Escaped Mutant for Mutator "PregMatchRemoveCaret": --- Original +++ New @@ @@ } private function isUppercaseWord(string $string) : bool { - return preg_match('#^\\p{Lu}+$#u', $string) === 1; + return preg_match('#\\p{Lu}+$#u', $string) === 1; } /** * @return list<string>

Check warning on line 133 in src/CaseConverter.php

View workflow job for this annotation

GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked

Escaped Mutant for Mutator "PregMatchRemoveFlags": --- Original +++ New @@ @@ } private function isUppercaseWord(string $string) : bool { - return preg_match('#^\\p{Lu}+$#u', $string) === 1; + return preg_match('#^\\p{Lu}+$#', $string) === 1; } /** * @return list<string>

Check warning on line 133 in src/CaseConverter.php

View workflow job for this annotation

GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ } private function isUppercaseWord(string $string) : bool { - return preg_match('#^\\p{Lu}+$#u', $string) === 1; + return preg_match('#^\\p{Lu}+$#u', $string) === 2; } /** * @return list<string>
}

/**
* @return list<string>
*/
private function map(Closure $converter, array $words): array
{
/**
* @var list<string> $words
* @var Closure(string):string $converter
*
* @return list<string>
*/
return array_map($converter, $words);
}

private function split(string $string): array
{
if (str_contains($string, '_')) {
Expand Down

0 comments on commit 69a981f

Please sign in to comment.