packagist zircote/swagger-php 7.3.0

5 hours ago

7.3 adds plugins: a library can ship its translators, resolvers and augmenters together with the wiring, and a project names the plugin rather than repeating that wiring. Plugins configure the spec pipeline and are not used in classic mode.

One change affects what a build reports. Changed output in 7.3 has the details.

Changed output

  • Result::isValid(), log(), warnings() and errors() include what the source scan, the resolvers and skipped classes log. An error logged there now makes isValid() false, as it already made the CLI exit with an error (#2360)

New

  • Plugins. A class implementing Contracts\PluginInterface configures the builder through Builder\Hooks: the resolver, augmenters, mergers, attribute factory and contributions. The component namer, type resolver, compiler and version stay with whoever runs the build. Builder::withPlugins() takes plugin classes, classes mapped to their settings, or instances, and runs them in the order given. An invalid entry is skipped and logged as an error. On the command line, --plugin adds a plugin built without settings (#2360, docs)
  • Logger in the constructor. new Builder($logger) takes the PSR-3 logger. A plugin implementing LoggerAwareInterface gets it (#2360)

Changed

  • Builder::$logger holds, and Builder::getLogger() returns, a CollectingLogger that forwards to the logger the builder is given. A subclass assigning its own logger to $logger wraps it first, new CollectingLogger($logger). A subclass overriding getLogger() declares CollectingLogger as its return type (#2360, docs)

Deprecated, removed in 8.0

  • Builder::setLogger(). Pass the logger to the constructor. What plugins log in withPlugins() before setLogger() is called does not reach the logger (#2360)

Docs

  • The guide's "Changed output in 7.2" lists the changes from #2335 (#2359)

What's Changed

Full Changelog: 7.2.0...7.3.0

Don't miss a new swagger-php release

NewReleases is sending notifications on new releases.