Skip to content

7.6.0

Latest

Choose a tag to compare

@DerManoMann DerManoMann released this 12 Nov 02:56
9e782a7

7.6 adds a parser for OpenAPI 3.1 documents. With it, Builder::withDocument() adds a hand-written document to what the attributes describe, for example webhooks with no PHP code behind them. Plugins can now also be found through the packages installed, and a spec build no longer parses PHP files.

Two changes affect the generated document or the log. Changed output in 7.6 has the details.

Changed output

  • Classic and hybrid: a trait imported through a grouped use now adds its properties. Before, they were missing, with a warning. Thanks @vencakrecl (#2392)
  • Spec and hybrid: validation messages from different checks come out mixed, since the checks now run in one pass (#2367)

New

  • OpenApi\Parser reads an OpenAPI 3.1 document into a Specification, and Builder::withDocument() adds one to a spec or hybrid build. Where both describe the same thing, the attributes win. Only 3.1 documents are supported (#2387, docs, cookbook)
  • Builder::withDiscoveredPlugins() adds the plugins installed packages declare in their Composer metadata. It is opt-in (#2385, docs)
  • Parameter, RequestBody, Response, Header, Link and Security\Scheme take a summary, written beside a $ref from 3.1 on (#2389)

Changed

  • AttributeFactory takes any SourceInspectorInterface. The default SourceInspector tells a class's own members by reflection, so a spec build parses no PHP. A subclass reading $tokenScanner gets the interface (#2373, #2374, docs)
  • A subclass declaring its own $summary on one of those six attributes needs it as public ?string $summary (#2389)

Deprecated

  • TokenScanner, removed in 8.0. Use SourceInspector (#2388)

Fixed

  • A docblock the type resolver fails on is reported as unsupported, and the build carries on. Before, some ended the build (#2393)
  • composer.json no longer conflicts with symfony/process, which swagger-php does not depend on (#2395)

Performance

  • The validation checks share one walk: validate() at 500 schemas went from 97 to 39 ms (#2367)

What's Changed

  • refactor(Utils): ask a source inspector which members and traits are a class's own by @DerManoMann in #2373
  • perf(Utils): tell a class's own members by reflection, without parsing by @DerManoMann in #2374
  • chore(Config): keep the tool caches in .cache/ by @DerManoMann in #2378
  • chore(deps-dev): update friendsofphp/php-cs-fixer requirement from 3.95.27 to 3.95.29 by @dependabot[bot] in #2381
  • chore(deps-dev): update phpstan/phpstan requirement from 2.3.4 to 2.3.5 by @dependabot[bot] in #2382
  • chore(deps-dev): bump @redocly/cli from 2.72.1 to 2.76.0 in the npm group across 1 directory by @dependabot[bot] in #2380
  • refactor(Compiler): share one walk between the validation checks by @DerManoMann in #2367
  • chore(Config): run the test suites with a 256M memory limit by @DerManoMann in #2390
  • chore(Utils): drop the @internal tag on SourceInspector::tokens() by @DerManoMann in #2379
  • feat(Spec): add a summary beside a $ref on every referenceable attribute by @DerManoMann in #2389
  • fix(TokenScanner): resolve grouped class imports by @vencakrecl in #2392
  • fix(Type): report any docblock the type resolver fails on by @DerManoMann in #2393
  • chore(Utils): deprecate TokenScanner by @DerManoMann in #2388
  • chore(Augmenter): drop the docblocks on the aware setters by @DerManoMann in #2384
  • feat(Builder): discover the plugins installed packages declare by @DerManoMann in #2385
  • fix(Composer): drop the symfony/process conflict by @DerManoMann in #2395
  • feat(Parser): read an OpenAPI 3.1 document into a Specification by @DerManoMann in #2387
  • docs(Guide): changed output in 7.6 by @DerManoMann in #2397

New Contributors

Full Changelog: 7.5.0...7.6.0