Skip to content

Commit

Permalink
Merge pull request #32 from bearsunday/php82
Browse files Browse the repository at this point in the history
PHP 8.2 Support
  • Loading branch information
koriym authored Jun 28, 2022
2 parents b2dcdaf + 6c3ecd9 commit 4d79986
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 13 deletions.
93 changes: 87 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,91 @@ on:
pull_request:
workflow_dispatch:

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

jobs:
ci:
uses: ray-di/.github/.github/workflows/continuous-integration.yml@next_stable
with:
old_stable: '["7.3", "7.4", "8.0"]'
current_stable: 8.1
next_stable: 8.2
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php-version:
- '7.3'
- '7.4'
- '8.0'
- '8.1'
dependencies: [highest, lowest]
os: [ubuntu-latest]
experimental: [false]
include:
- php-version: "8.1"
os: windows-latest
experimental: false
- php-version: "8.1"
os: macos-latest
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@v3

- 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: 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: 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@v2
with:
file: ./coverage.xml

- name: Run additional script
if: ${{ inputs.script }}
run: php ${{ inputs.script }}

17 changes: 17 additions & 0 deletions .github/workflows/update-copyright-years-in-license-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Update copyright year in license file

on:
workflow_dispatch:
schedule:
- cron: "0 3 1 1 *"

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: FantasticFiasco/action-update-license-year@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2018 Akihito Koriyama
Copyright (c) 2015-2022 Akihito Koriyama

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 1 addition & 4 deletions src/AbstractAppMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

use function array_slice;
use function array_walk;
use function assert;
use function class_exists;
use function explode;
use function implode;
use function ltrim;
Expand All @@ -37,7 +35,7 @@ abstract class AbstractAppMeta
public $logDir;

/**
* @return Generator<array{0: string, 1: string}>
* @return Generator<array{0: class-string, 1: string}>
*/
public function getResourceListGenerator(): Generator
{
Expand All @@ -58,7 +56,6 @@ public function getGenerator(string $scheme = '*'): Generator
/** @var array<string> $paths */
$path = array_slice($paths, 3);
array_walk($path, [$this, 'camel2kebab']);
assert(class_exists($class));
if ($scheme === '*') {
/** @var array<string> $slice */
$slice = array_slice($path, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(string $name, string $context = 'app', string $appDi

$this->logDir = $this->appDir . '/var/log/' . $context;
if (! file_exists($this->logDir) && ! @mkdir($this->logDir, 0777, true) && ! is_dir($this->logDir)) {
throw new NotWritableException($this->logDir);
throw new NotWritableException($this->logDir); // @codeCoverageIgnore
}
}

Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/tools/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4d79986

Please sign in to comment.