Skip to content

Commit

Permalink
Merge pull request #190 from ray-di/php_82
Browse files Browse the repository at this point in the history
PHP 8.2 Support
  • Loading branch information
koriym authored Jun 22, 2022
2 parents 2e2fdb2 + 388c059 commit bb0e70d
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 252 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
/demo export-ignore
/vendor-bin export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/php.ini export-ignore
/codecov.yml export-ignore
/phpcs.xml export-ignore
/phpmd.xml export-ignore
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

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

Expand Down
81 changes: 65 additions & 16 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,68 @@ on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '42 15 * * *'

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
COMPOSER_UPDATE_FLAGS: ""

jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
operating-system:
- ubuntu-latest
- windows-latest
php-version:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
dependencies:
- lowest
- highest
dependencies: [highest]
os: [ubuntu-latest]
experimental: [false]
include:
- php-version: "7.2"
dependencies: lowest
os: ubuntu-latest
experimental: false
- php-version: "7.3"
dependencies: lowest
os: ubuntu-latest
experimental: false
- php-version: "7.4"
dependencies: lowest
os: ubuntu-latest
experimental: false
- php-version: "8.0"
dependencies: lowest
os: ubuntu-latest
experimental: false
- php-version: "8.1"
dependencies: lowest
os: ubuntu-latest
experimental: false
- php-version: "8.1"
os: windows-latest
dependencies: highest
experimental: false
- php-version: "8.1"
os: macos-latest
dependencies: highest
experimental: false
- php-version: "8.2"
dependencies: lowest-ignore
os: ubuntu-latest
experimental: true
- php-version: "8.2"
dependencies: highest-ignore
os: ubuntu-latest
experimental: true

steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
Expand All @@ -47,19 +85,30 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install lowest dependencies
if: ${{ matrix.dependencies == 'lowest' && matrix.ignore-platform-reqs == false }}
run: composer update --prefer-lowest --no-interaction --no-progress --no-scripts
- name: Handle lowest dependencies update
if: contains(matrix.dependencies, 'lowest')
run: echo COMPOSER_UPDATE_FLAGS=$COMPOSER_UPDATE_FLAGS --prefer-lowest >> $GITHUB_ENV

- name: Handle ignore-platform-reqs dependencies update
if: contains(matrix.dependencies, 'ignore')
run: echo COMPOSER_FLAGS=$COMPOSER_FLAGS --ignore-platform-req=php >> $GITHUB_ENV

- name: Remove platform config to get latest dependencies for current PHP version
if: contains(matrix.dependencies, 'highest') || contains(matrix.dependencies, 'lowest')
run: composer config platform --unset

- name: Allow alpha releases for latest-deps builds to catch problems earlier
if: contains(matrix.dependencies, 'ignore')
run: composer config minimum-stability alpha

- name: Install highest dependencies
if: ${{ matrix.dependencies == 'highest'&& matrix.ignore-platform-reqs == false }}
run: composer update --no-interaction --no-progress --no-scripts
- name: Update dependencies
run: composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }}

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

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

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

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

Expand All @@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -66,12 +66,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

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

- name: Get composer cache directory
id: composer-cache
Expand All @@ -95,12 +95,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

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

- name: Get composer cache directory
Expand All @@ -118,12 +118,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

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

- name: Get composer cache directory
Expand All @@ -133,7 +133,7 @@ jobs:
- name: Install dependencies
run: |
composer install --no-interaction --no-progress --prefer-dist
composer require --dev maglnet/composer-require-checker ^2.0
composer require --dev maglnet/composer-require-checker ^3.0
- name: Run composer-require-checker
run: ./vendor/bin/composer-require-checker check ./composer.json
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
"metrics": ["./vendor/bin/phpmetrics --report-html=build/metrics --exclude=Exception src"],
"phpmd": ["./vendor/bin/phpmd src text ./phpmd.xml"],
"build": ["@cs", "@sa", "@pcov", "@metrics"]
}
},
"minimum-stability": "alpha"
}
14 changes: 6 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php">
<coverage processUncoveredFiles="true" cacheDirectory="./.phpunit-cache">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Ray.Aop Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="-1"/>
</php>
<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
4 changes: 2 additions & 2 deletions src/AopTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function templateMethod($a, $b)
{
if (! $this->isAspect) {
$this->isAspect = true;
call_user_func_array([$this, 'parent::' . __FUNCTION__], func_get_args());
call_user_func_array([parent::class, __FUNCTION__], func_get_args());
return;
}
Expand All @@ -50,7 +50,7 @@ public function templateMethod($a, $b)
if (! $this->isAspect) {
$this->isAspect = true;
return call_user_func_array([$this, 'parent::' . __FUNCTION__], func_get_args());
return call_user_func_array([parent::class, __FUNCTION__], func_get_args());
}
$this->isAspect = false;
$result = (new Invocation($this, __FUNCTION__, func_get_args(), $this->bindings[__FUNCTION__]))->proceed();
Expand Down
Loading

0 comments on commit bb0e70d

Please sign in to comment.