|
| 1 | +# UPGRADE |
| 2 | + |
| 3 | +## Upgrade from 1.x to 2.0.0 |
| 4 | + |
| 5 | +### Removed support for old PHP versions |
| 6 | +New version not supported PHP versions 5.6 and 7.0 and also hhvm. Please use it with newer versions of PHP (>7.1) |
| 7 | + |
| 8 | +### Updated dependencies |
| 9 | +Version 2.0.0 requires nette packages in version 3.0, so probably you will have to upgrade whole your nette application |
| 10 | + |
| 11 | +### Typehints |
| 12 | +There are some breaking changes because of typehints: |
| 13 | + |
| 14 | +#### ApiAuthorizationInterface |
| 15 | +Add typehints to methods: |
| 16 | +- `authorized(): bool` |
| 17 | +- `getErrorMessage(): ?string` |
| 18 | + |
| 19 | +#### ApiHandlerInterface |
| 20 | +Add typehints to methods: |
| 21 | +- `params(): array` |
| 22 | +- `handle(array $params): Tomaj\NetteApi\Response\ResponseInterface` |
| 23 | + |
| 24 | +#### ApiLoggerInterface |
| 25 | +Add typehints to method: |
| 26 | +- `log(int $responseCode, string $requestMethod, string $requestHeader, string $requestUri, string $requestIp, string $requestAgent, int $responseTime): bool` |
| 27 | + |
| 28 | +#### BearerTokenRepositoryInterface |
| 29 | +Add typehints to methods: |
| 30 | +- `validToken(string $token): bool` |
| 31 | +- `ipRestrictions(string $token): ?string` |
| 32 | + |
| 33 | +#### IpDetectorInterface |
| 34 | +Add typehints to method: |
| 35 | +- `getRequestIp(): string` |
| 36 | + |
| 37 | +#### ParamInterface |
| 38 | +Add typehints to methods: |
| 39 | +- `isValid(): bool` |
| 40 | +- `getKey(): string` |
| 41 | + |
| 42 | +#### EndpointInterface |
| 43 | +Add typehints to methods: |
| 44 | +- `getMethod(): string` |
| 45 | +- `getVersion(): int` |
| 46 | +- `getPackage(): string` |
| 47 | +- `getApiAction(): ?string` |
| 48 | +- `getUrl(): string` |
| 49 | + |
| 50 | +### Renamed methods |
| 51 | +Few methods have been renamed, please use their new versions: |
| 52 | +- `ApiDecider::addApiHandler()` -> `ApiDecider::addApi()` |
| 53 | +- `ApiDecider::getApiHandler()` -> `ApiDecider::getApi()` |
| 54 | +- `ApiDecider::getHandlers()` -> `ApiDecider::getApis()` |
| 55 | + |
| 56 | +### Final methods |
| 57 | +BaseHandler now have few final methods: |
| 58 | +- `setEndpointIdentifier` |
| 59 | +- `getEndpoint` |
| 60 | +- `setupLinkGenerator` |
| 61 | +- `createLink` |
| 62 | + |
| 63 | +### Removed params |
| 64 | +Parameters $parent and $name have been removed from ApiListingControl. New usage is: |
| 65 | +``` |
| 66 | +new ApiListingControl($apiDecider) |
| 67 | +``` |
| 68 | + |
| 69 | +### Changed params |
| 70 | +Some parameters were strictly typed: |
| 71 | +- second parameter in `JsonApiResponse::__construct` (`$payload` formerly known as `$data`) is now `array` |
| 72 | +- fifth parameter in `JsonApiResponse::__construct` (`$expiration`) is now `DateTimeInteface` or `null` |
| 73 | +- fourth parameter in `InputParam::__construc` (`$availableValues`) is now `array` or `null` |
0 commit comments