Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Adopt PHP 7.1 features #51

Merged

Conversation

weierophinney
Copy link
Member

@weierophinney weierophinney commented Dec 7, 2017

This patch updates the component to make use of PHP 7.1 features. In particular:

  • All signatures were updated to add return type hints, scalar type hints, and nullable types as necessary. The following signatures in particular are of interest due to backwards-incompatible changes:
    • Zend\Expressive\Helper\BodyParams\StrategyInterface:
      • The match() signature changes to match(string $contentType) : bool
      • The parse() signature changes to parse(ServerRequestInterface $request) : ServerRequestInterface
    • Zend\Expressive\Helper\ServerUrlHelper updates its public API to read as follows:
      • __invoke(string $path = null) : string
      • generate(string $path = null) : string
      • setUri(UriInterface $uri) : void
    • Zend\Expressive\Helper\UrlHelper updates its public API to read as follows:
      • __invoke(?string $routeName = null, array $routeParams = [], array $queryParams = [], ?string $fragmentIdentifier = null, array $options = []) : string
      • generate(?string $routeName = null, array $routeParams = [], array $queryParams = [], ?string $fragmentIdentifier = null, array $options = []) : string
      • setRouteResult(RouteResult $result) : void
      • setBasePath(string $path) : void
      • getRouteResult() : ?RouteResult
      • getBasePath() : string
  • All class files enable strict_types to ensure errors are thrown for invalid scalar values.

- PHP bumped to 7.1.
- Use http-interop/http-server-middleware instead of polyfill.
- Require zend-expressive-router 3.0.0@dev.
Updates code to use http-server-middleware and http-server-handler interfaces, and conform to their signatures.
Updates all signatures to add return type hints, scalar type hints, and
nullable types. The following signatures, in particular, are of interest
due to backwards-incompatible changes:

- `Zend\Expressive\Helper\BodyParams\StrategyInterface`:
  - The `match()` signature changes to `match(string $contentType) : bool`
  - The `parse()` signature changes to `parse(ServerRequestInterface $request) : ServerRequestInterface`
- `Zend\Expressive\Helper\ServerUrlHelper` updates its public API to read as follows:
  - `__invoke(string $path = null) : string`
  - `generate(string $path = null) : string`
  - `setUri(UriInterface $uri) : void`
- `Zend\Expressive\Helper\UrlHelper` updates its public API to read as follows:
  - `__invoke(?string $routeName = null, array $routeParams = [], array $queryParams = [], ?string $fragmentIdentifier = null, array $options = []) : string`
  - `generate(?string $routeName = null, array $routeParams = [], array $queryParams = [], ?string $fragmentIdentifier = null, array $options = []) : string`
  - `setRouteResult(RouteResult $result) : void`
  - `setBasePath(string $path) : void`
  - `getRouteResult() : ?RouteResult`
  - `getBasePath() : string`

All class files now enable strict_types, ensuring scalar types must be
honored.
@weierophinney weierophinney changed the title Update to PSR-15 and PHP 7.1 Adopt PHP 7.1 features Dec 7, 2017
@weierophinney weierophinney merged commit 9a610f9 into zendframework:release-5.0.0 Dec 7, 2017
weierophinney added a commit that referenced this pull request Dec 7, 2017
weierophinney added a commit that referenced this pull request Dec 7, 2017
@weierophinney weierophinney deleted the feature/psr-15 branch December 7, 2017 20:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant