Skip to content

Commit

Permalink
Update travis config, test php 8 versions, fix php 8/8.1 errors (#13)
Browse files Browse the repository at this point in the history
* Update travis config, test php 8 versions

* Update the way php is defined, put in place structure to allow testing laravel 9

* Forgot to remove matrix

* Fix up travis config, esp envs global vs jobs

* Just add a comment for future reference

* Fix sorting for php 8

* Use bionic for php 8.1

* After looking at the test, we want the highest limit

* Try 8.1.0 based on suggestions on travisci forums

* Try and cast nulls to string for php 8.1 compact

* Drop 8.1 for now (too many fixes)
  • Loading branch information
specialtactics authored Jan 30, 2022
1 parent 0aed272 commit ac4de98
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
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

0 comments on commit ac4de98

Please sign in to comment.