From d50411aa804de83b0741d52d493a2f717363348c Mon Sep 17 00:00:00 2001 From: Mathias STRASSER Date: Mon, 1 Mar 2021 00:07:40 +0100 Subject: [PATCH] Bump actions/checkout@v1 to actions/checkout@v2 --- .github/workflows/CI.yml | 105 +++++++++++++++++++++++++++++---------- composer.json | 8 +-- phpunit.xml.dist | 6 +-- src/SortedMap.php | 13 +---- 4 files changed, 88 insertions(+), 44 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2b0de9e..5d21ce9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -5,37 +5,90 @@ on: pull_request: jobs: - tests: - name: Test suite + phpunit: + name: PHPUnit (PHP ${{ matrix.php }}) runs-on: ubuntu-latest - container: - image: php:7.2-cli-alpine + timeout-minutes: 20 + strategy: + matrix: + php: + - '7.2' + - '7.3' + - '7.4' + fail-fast: false steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install project dependencies + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer + ini-values: memory_limit=-1 + - name: Update project dependencies + run: composer update --no-interaction --no-progress --ansi + - name: Run PHPUnit tests run: | - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" - php composer-setup.php --filename=composer - php -r "unlink('composer-setup.php');" - php composer global require friendsofphp/php-cs-fixer - php composer global require pedrotroller/php-cs-custom-fixer - php composer install - - name: Run PHP Coding Standards Fixer tool - run: | - php ~/.composer/vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs.dist - php ~/.composer/vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs.test.dist - - name: Run PHPUnit + vendor/bin/phpunit + - name: Run PHPUnit tests with lowest versions of dependencies + if: (!startsWith(matrix.php, '7.4')) run: | - php ./vendor/bin/phpunit - - name: Run phpspec + composer update --prefer-lowest --no-interaction --no-progress --ansi + vendor/bin/phpunit + + phpspec: + name: phpspec (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + php: + - '7.2' + - '7.3' + - '7.4' + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer + ini-values: memory_limit=-1 + - name: Update project dependencies + run: composer update --no-interaction --no-progress --ansi + - name: Run PHPUnit tests run: | - php ./vendor/bin/phpspec run - - name: Run PHPUnit with lowest versions of dependencies + vendor/bin/phpspec run + - name: Run PHPUnit tests with lowest versions of dependencies run: | - php composer update --prefer-lowest - php ./vendor/bin/phpunit - - name: Run phpspec with lowest versions of dependencies + composer update --prefer-lowest --no-interaction --no-progress --ansi + vendor/bin/phpspec run + + php_cs_fixer: + name: PHP-CS-Fixer (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + php: + - '7.2' + - '7.3' + - '7.4' + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer + ini-values: memory_limit=-1 + - name: Update project dependencies + run: composer update --no-interaction --no-progress --ansi + - name: Run PHP Coding Standards Fixer tool run: | - php ./vendor/bin/phpspec run + vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs.dist + vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs.test.dist diff --git a/composer.json b/composer.json index c38d183..15cfee5 100644 --- a/composer.json +++ b/composer.json @@ -4,11 +4,13 @@ "type": "library", "keywords": ["test", "tests", "testing", "DTO"], "require": { - "php": ">=7.2", - "phpunit/phpunit": "^8.4", - "roave/better-reflection": "^3.5" + "php": "^7.2", + "phpunit/phpunit": "^8.4||^9.1", + "roave/better-reflection": "^3.5||^4.8" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^2.18", + "pedrotroller/php-cs-custom-fixer": "^2.23", "phpspec/phpspec": "^6.0" }, "license": "MIT", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index fef15d7..a8d6fa0 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,12 +1,10 @@ @@ -27,4 +25,4 @@ - \ No newline at end of file + diff --git a/src/SortedMap.php b/src/SortedMap.php index f5d8f7b..faf8b23 100644 --- a/src/SortedMap.php +++ b/src/SortedMap.php @@ -61,17 +61,8 @@ private function checkArgument(string $typeOfValue, $value, int $argumentNb = 1) if (($value !== null) && (!\function_exists($func = 'is_' . $typeOfValue) || !$func($value)) && !($value instanceof $typeOfValue)) { - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)[1]; - throw new \TypeError( - sprintf( - 'Argument %d passed to %s::%s() must be of the type %s, int given', - $argumentNb, - $backtrace['class'], - $backtrace['function'], - $typeOfValue, - gettype($value) - ) - ); + $backtrace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS)[1]; + throw new \TypeError(sprintf('Argument %d passed to %s::%s() must be of the type %s, int given', $argumentNb, $backtrace['class'], $backtrace['function'], $typeOfValue, gettype($value))); } } }