diff --git a/src/Expectation.php b/src/Expectation.php index 3bdce69..c93d96b 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -12,7 +12,7 @@ public function toReturnLowercase(int $depth = -1): void { $this->applyOnDirectory( $depth, - fn (array $content): array => $this->lowercasesIn($content), + fn (array $content): array => $this->notLowercasesIn($content), 'Not lowercase detected' ); } @@ -30,7 +30,7 @@ public function toReturnSingleWords(int $depth = -1): void { $this->applyOnDirectory( $depth, - fn (array $content): array => $this->singleWordsIn($content), + fn (array $content): array => $this->multipleWordsIn($content), 'Not single words detected' ); } diff --git a/src/Investigator.php b/src/Investigator.php index 483dd61..c0e115b 100644 --- a/src/Investigator.php +++ b/src/Investigator.php @@ -4,13 +4,16 @@ namespace Faissaloux\PestInside; +/** + * @internal + */ trait Investigator { /** * @param array> $array * @return array */ - private function lowercasesIn(array $array): array + private function notLowercasesIn(array $array): array { $unwanted = []; @@ -20,7 +23,7 @@ private function lowercasesIn(array $array): array } if (is_array($word)) { - array_push($unwanted, ...$this->lowercasesIn($word)); + array_push($unwanted, ...$this->notLowercasesIn($word)); continue; } @@ -63,13 +66,13 @@ private function duplicatesIn(array $array): array * @param array> $array * @return array */ - private function singleWordsIn(array $array): array + private function multipleWordsIn(array $array): array { $unwanted = []; foreach ($array as $word) { if (is_array($word)) { - array_push($unwanted, ...$this->singleWordsIn($word)); + array_push($unwanted, ...$this->multipleWordsIn($word)); continue; }