Skip to content

Commit a655c49

Browse files
committed
refactor: sawAnyEnumValueAttribute -> hasEnumValueAttribute
Matches PHP's isser/haser naming convention and reads as a present-state question instead of imperative history. Also aligns the private helper name with the boolean semantics (plural -> singular since the check is 'has at least one attribute anywhere on the enum').
1 parent bb2a396 commit a655c49

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/Mappers/Root/EnumTypeMapper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ private function mapByClassName(string $enumClass): EnumType|null
147147
$enumCaseDescriptions = [];
148148
/** @var array<string, string> $enumCaseDeprecationReasons */
149149
$enumCaseDeprecationReasons = [];
150-
$sawAnyEnumValueAttribute = false;
150+
$hasEnumValueAttribute = false;
151151

152152
foreach ($reflectionEnum->getCases() as $reflectionEnumCase) {
153153
$docBlock = $this->docBlockFactory->create($reflectionEnumCase);
154154
$enumValueAttribute = $this->annotationReader->getEnumValueAnnotation($reflectionEnumCase);
155155

156156
if ($enumValueAttribute !== null) {
157-
$sawAnyEnumValueAttribute = true;
157+
$hasEnumValueAttribute = true;
158158
}
159159

160160
$enumCaseDescriptions[$reflectionEnumCase->getName()] = $this->descriptionResolver->resolve(
@@ -181,8 +181,8 @@ private function mapByClassName(string $enumClass): EnumType|null
181181
}
182182
}
183183

184-
if (! $sawAnyEnumValueAttribute) {
185-
$this->warnEnumHasNoEnumValueAttributes($enumClass);
184+
if (! $hasEnumValueAttribute) {
185+
$this->warnEnumHasNoEnumValueAttribute($enumClass);
186186
}
187187

188188
$type = new EnumType($enumClass, $typeName, $enumDescription, $enumCaseDescriptions, $enumCaseDeprecationReasons, $useValues);
@@ -206,7 +206,7 @@ private function mapByClassName(string $enumClass): EnumType|null
206206
*
207207
* @param class-string<UnitEnum> $enumClass
208208
*/
209-
private function warnEnumHasNoEnumValueAttributes(string $enumClass): void
209+
private function warnEnumHasNoEnumValueAttribute(string $enumClass): void
210210
{
211211
trigger_error(
212212
sprintf(

0 commit comments

Comments
 (0)