Skip to content

Commit

Permalink
Merge pull request #269 from koriym/php82
Browse files Browse the repository at this point in the history
PHP 8.2 Support
  • Loading branch information
koriym committed Jun 25, 2022
2 parents c386d0d + 69ebcb4 commit 19b7a4b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4,905 deletions.
37 changes: 4 additions & 33 deletions .github/workflows/coding-standards.yml
Expand Up @@ -6,36 +6,7 @@ on:
workflow_dispatch:

jobs:
coding-standards:
name: Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: cs2pr
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Validate composer.json
run: composer validate --strict

- name: Run PHP_CodeSniffer
run: ./vendor/bin/phpcs -q --no-colors --report=checkstyle src tests | cs2pr
cs:
uses: ray-di/.github/.github/workflows/coding-standards.yml@v1
with:
php_version: 8.1
63 changes: 7 additions & 56 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -4,61 +4,12 @@ on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '42 15 * * *'

jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
strategy:
matrix:
operating-system:
- ubuntu-latest
php-version:
- '7.4'
- '8.0'
- '8.1'
dependencies:
- lowest
- highest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
ini-values: zend.assertions=1

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install lowest dependencies
if: ${{ matrix.dependencies == 'lowest' }}
run: composer update --prefer-lowest --no-interaction --no-progress --no-suggest

- name: Install highest dependencies
if: ${{ matrix.dependencies == 'highest' }}
run: composer update --no-interaction --no-progress --no-suggest

- name: Run test suite
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml

- name: Run Demo
run: php demo/run.php
ci:
uses: ray-di/.github/.github/workflows/continuous-integration.yml@next_stable
with:
old_stable: '["7.4", "8.0"]'
current_stable: 8.1
next_stable: 8.2
script: demo/run.php
135 changes: 4 additions & 131 deletions .github/workflows/static-analysis.yml
Expand Up @@ -6,134 +6,7 @@ on:
workflow_dispatch:

jobs:
static-analysis-phpstan:
name: Static Analysis with PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: cs2pr
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run PHPStan
run: ./vendor/bin/phpstan analyse -c phpstan.neon --no-progress --no-interaction --error-format=checkstyle | cs2pr

static-analysis-psalm:
name: Static Analysis with Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: cs2pr
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run Psalm
run: ./vendor/bin/psalm --show-info=false --output-format=checkstyle --shepherd | cs2pr

static-analysis-phpmd:
name: Static Analysis with PHPMD
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run PHP Mess Detector
run: ./vendor/bin/phpmd src text --exclude src/Annotation ./phpmd.xml

static-analysis-php-metrics:
name: Static Analysis with PhpMetrics
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run PhpMetrics
run: ./vendor/bin/phpmetrics --exclude=Exception src

static-analysis-composer-require-checker:
name: Static Analysis with ComposerRequireChecker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install dependencies
run: |
composer install --no-interaction --no-progress --prefer-dist
composer require --dev maglnet/composer-require-checker ^2.0
- name: Run composer-require-checker
run: ./vendor/bin/composer-require-checker check --config-file=./php-require-checker.config.json ./composer.json
sa:
uses: ray-di/.github/.github/workflows/static-analysis.yml@v1
with:
php_version: 8.1
18 changes: 11 additions & 7 deletions composer.json
Expand Up @@ -21,7 +21,7 @@
"nocarrier/hal": "^0.9.12",
"phpdocumentor/reflection-docblock": "^5.2",
"psr/log": "^1.1 || ^2.0 || ^3.0",
"ray/aop": "^2.10.1",
"ray/aop": "^2.12.3",
"ray/di": "^2.13",
"ray/web-param-module": "^2.1.1",
"rize/uri-template": "^0.3",
Expand All @@ -32,7 +32,13 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5.10",
"bamarni/composer-bin-plugin": "^1.4"
"doctrine/coding-standard": "^9.0",
"phpmd/phpmd": "^2.9",
"phpmetrics/phpmetrics": "^2.7",
"phpstan/phpstan": "^1.3",
"psalm/plugin-phpunit": "^0.13",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.17"
},
"autoload": {
"psr-4": {
Expand All @@ -56,23 +62,21 @@
"files": ["tests/Fake/AppInjector.php"]
},
"scripts" :{
"post-install-cmd": ["@composer bin all install --ansi"],
"post-update-cmd": ["@composer bin all update --ansi"],
"test": ["./vendor/bin/phpunit"],
"tests": ["@cs", "@test", "@sa"],
"coverage": ["php -dzend_extension=xdebug.so -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage"],
"pcov": ["php -dextension=pcov.so -d pcov.enabled=1 ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage --coverage-clover=coverage.xml"],
"cs": ["phpcs --standard=./phpcs.xml src tests"],
"cs": ["./vendor/bin/phpcs --standard=./phpcs.xml src tests"],
"cs-fix": ["./vendor/bin/phpcbf src tests"],
"clean": ["./vendor/bin/phpstan clear-result-cache", "./vendor/bin/psalm --clear-cache", "rm -rf tests/tmp/*.php"],
"sa": ["psalm --show-info=true", "./vendor/bin/phpstan analyse -c phpstan.neon"],
"sa": ["./vendor/bin/psalm --show-info=true", "./vendor/bin/phpstan analyse -c phpstan.neon"],
"metrics": ["./vendor/bin/phpmetrics --report-html=build/metrics --exclude=Exception --log-junit=build/junit.xml --junit=build/junit.xml src"],
"phpmd": ["./vendor/bin/phpmd --exclude src/Annotation src text ./phpmd.xml"],
"build": ["@cs", "@sa", "@pcov", "@metrics"]
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
6 changes: 5 additions & 1 deletion src/Annotation/ResourceParam.php
Expand Up @@ -28,7 +28,11 @@ final class ResourceParam implements RequestParamInterface
/** @var bool */
public $templated;

/** @param array{uri?: string, param?: string, templated?: bool} $values */
/**
* @param array{uri?: string, param?: string, templated?: bool} $values
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
*/
public function __construct(array $values = [], string $uri = '', string $param = '', bool $templated = false)
{
$this->uri = $values['uri'] ?? $uri;
Expand Down
17 changes: 0 additions & 17 deletions vendor-bin/tools/composer.json

This file was deleted.

0 comments on commit 19b7a4b

Please sign in to comment.