Skip to content

Commit

Permalink
fix: ignore specified words while making it singularized (#1222)
Browse files Browse the repository at this point in the history
  • Loading branch information
ishanvyas22 committed Nov 13, 2021
1 parent 305c524 commit a26ed1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ private function singularizeCamelParts(string $currentName): string

$resolvedName = '';
foreach ($camelCases as $camelCase) {
$resolvedName .= $this->inflector->singularize($camelCase['camelcase']);
$value = $this->inflector->singularize($camelCase['camelcase']);

if (in_array($camelCase['camelcase'], ['is', 'has'])) {
$value = $camelCase['camelcase'];
}

$resolvedName .= $value;
}

return $resolvedName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ public function provideData(): Iterator
// news and plural
yield ['staticCallsToNews', 'staticCallToNew'];
yield ['newsToMethodCalls', 'newToMethodCall'];
yield ['hasFilters', 'hasFilter'];
}
}

0 comments on commit a26ed1a

Please sign in to comment.