Restore unconditional x-enum-keys assignment

The defensive isset re-added in cb6e502 reproduces the PHPStan dead-code
error the previous commit fixed. PHPStan correctly infers that within
the outer if (isset(\$node['enum'])) branch, x-enum-keys is also always
set (the sole upstream path that sets enum unconditionally sets
x-enum-keys alongside it). The project's analyze gate forbids
suppressing the error via @phpstan-ignore, baseline entries, or casts,
so the inner isset must go.
This commit is contained in:
Damodar Lohani committed 2026-05-27 11:15:57 +00:00
1 parent cb6e502eca
commit 49502c489f
1 file changed
+1 -3
@@ -761,9 +761,7 @@ class Swagger2 extends Format
/// If the enum flag is Set, add the enum values to the body
$body['schema']['properties'][$name]['enum'] = $node['enum'];
$body['schema']['properties'][$name]['x-enum-name'] = $node['x-enum-name'] ?? null;
if (isset($node['x-enum-keys'])) {
$body['schema']['properties'][$name]['x-enum-keys'] = $node['x-enum-keys'];
}
$body['schema']['properties'][$name]['x-enum-keys'] = $node['x-enum-keys'];
}
if ($parameter['nullable']) {