Skip to content

0.22.2

tagged this 05 Aug 21:28
Document the behaviour changes since 0.22.1 in the changelog and add the
tests that prove nothing else changed.

The behaviour delta was measured by diffing the full parsed model of a
433-file corpus (synthetic syntax fixtures, nikic/php-parser and
phpdocumentor) between 0.22.1 and HEAD. Exactly three changes showed up,
all of them intended:

- reflected property/parameter types are now consistently fully
  qualified (`\Psr\Container\ContainerInterface` instead of
  `Psr\Container\ContainerInterface`)
- enum cases no longer leak into `PHPEnum::$constants`
- `PHPEnum::$is_final` / `$is_abstract` / `$is_anonymous` are no longer
  `null` for enums that cannot be autoloaded

New tests:

- ReflectionTypeFormattingRegressionTest: pins the rendered type strings
  for the AST path and the reflection path and asserts they agree, plus
  the no-autoload guarantee
- PublicApiSurfaceTest: snapshot of every public property and method, so
  a removal or an incompatible signature change fails the build
- ModelInvariantsRegressionTest: parses the whole library and every
  fixture and checks the model invariants, including that class-like
  types are always fully qualified
- ParserEntryPointsTest: end-to-end coverage of getAstFromFile(),
  getFileInfoFromFile(), the container setters and getFunctionsInfo(),
  which had no test before
- PHPEnumRegressionTest / AutoloadSafetyRegressionTest: extended to all
  three enum read paths and to the shared autoload guard

All new tests fail against 0.22.1 and pass on both nikic/php-parser v4
and v5.

Also widen the extractHooksFromReflection() array key type, which
phpstan rejected on PHP 8.4 because getHooks() is keyed by name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Assets 2
Loading