fix: ignore specified words while making it singularized (#1222)

This commit is contained in:
Ishan Vyas 2021-11-13 13:42:27 +05:30 committed by GitHub
parent 305c524662
commit a26ed1a989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -105,7 +105,13 @@ final class InflectorSingularResolver
$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;

View File

@ -39,5 +39,6 @@ final class InflectorSingularResolverTest extends AbstractTestCase
// news and plural
yield ['staticCallsToNews', 'staticCallToNew'];
yield ['newsToMethodCalls', 'newToMethodCall'];
yield ['hasFilters', 'hasFilter'];
}
}