Skip to content

Update travis config, test php 8 versions, fix php 8 errors #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 30, 2022
Merged
27 changes: 15 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
# Test any changes here to see the impact - https://config.travis-ci.com/explore
dist: bionic
language: php

sudo: false
dist: trusty
php:
- 7.4
- 8.0

env:
global:
- setup=basic
- xdebug=true
- xdebug=false
jobs:
- LARAVEL_VERSION=8.*

cache:
directories:
- $HOME/.composer/cache

matrix:
include:
- php: 7.4
env: xdebug=false
# - php: 8.0
# env: xdebug=false
# - php: 8.1
# env: xdebug=false

before_install:
- if [[ $xdebug = 'true' ]] ; then phpenv config-rm xdebug.ini; fi
- composer self-update --2

install:
- if [[ $setup = 'basic' ]]; then travis_retry composer install --prefer-dist --no-interaction --no-suggest; fi
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable --prefer-lowest; fi

before_script:
- travis_retry composer install --prefer-source --no-interaction
- if [ "$LARAVEL_VERSION" != "" ]; then composer require --dev "illuminate/routing:${LARAVEL_VERSION}" --no-update; fi;
- if [ "$LARAVEL_VERSION" != "" ]; then composer require --dev "illuminate/support:${LARAVEL_VERSION}" --no-update; fi;
- composer update

script:
- vendor/bin/phpunit
2 changes: 1 addition & 1 deletion src/Auth/Provider/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract class Authorization implements \Dingo\Api\Contract\Auth\Provider
*/
public function validateAuthorizationHeader(Request $request)
{
if (Str::startsWith(strtolower($request->headers->get('authorization')), $this->getAuthorizationMethod())) {
if (Str::startsWith(strtolower((string) $request->headers->get('authorization')), $this->getAuthorizationMethod())) {
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Http/RateLimit/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public function rateLimitRequest(Request $request, $limit = 0, $expires = 0)
// limiting will not be imposed for the request.
} else {
$this->throttle = $this->getMatchingThrottles()->sort(function ($a, $b) {
return $a->getLimit() < $b->getLimit();
})->first();
return $a->getLimit() <=> $b->getLimit();
})->last();
}

if (is_null($this->throttle)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ protected function formatNamespace(array $new, array $old)
protected function formatPrefix($new, $old)
{
if (isset($new['prefix'])) {
return trim(Arr::get($old, 'prefix'), '/').'/'.trim($new['prefix'], '/');
return trim((string) Arr::get($old, 'prefix'), '/').'/'.trim((string) $new['prefix'], '/');
}

return Arr::get($old, 'prefix', '');
Expand Down