Skip to content

Commit 82b76ae

Browse files
authored
feature #4 Move to PHP 8.2 (sstok)
This PR was merged into the 1.0-dev branch. labels: bc-break Discussion ---------- | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | BC breaks? | yes | Deprecations? | no | Fixed tickets | | License | MIT Dropped support for PHP 8.1 (8.2 is minimum now), modernized the code base and hardened against cases of misuse. Secondly, it's now easier to set an expiration for a token. Commits ------- b3d85d3 Clean-up old files 92ba66a Modernize readme 42824fc Drop support for PHP 7/8.1 2f9e1af Correct CS 830a1f9 Allow easier expiration handling 79f0ea9 Add upgrade instructions - replaces changelog 8015b98 Fix PHPStan errors a8a131a Update GitHub workflows 4281795 Update README.md
2 parents 0d25397 + 4281795 commit 82b76ae

27 files changed

+729
-613
lines changed

.gitattributes

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
# Always use LF
22
core.autocrlf=lf
33

4-
/doc export-ignore
5-
/tests export-ignore
64
.editorconfig export-ignore
75
.gitattributes export-ignore
86
.gitignore export-ignore
9-
.travis.yml export-ignore
10-
CODE_OF_CONDUCT.md export-ignore
117
.github export-ignore
8+
.php-cs-fixer.dist.php export-ignore
9+
CODE_OF_CONDUCT.md export-ignore
10+
Makefile export-ignore
1211
phpunit.xml.dist export-ignore
13-
phpcs.xml.dist export-ignore
1412
phpstan.neon export-ignore
15-
psalm.xml export-ignore
16-
Makefile export-ignore
13+
phpstan-baseline.neon export-ignore
14+
tests/ export-ignore

.github/workflows/ci.yaml

+134-55
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Full CI process
1+
name: 'CI'
2+
23
on:
34
push:
45
branches:
@@ -8,71 +9,149 @@ on:
89
- main
910

1011
jobs:
11-
test:
12-
name: PHP ${{ matrix.php-versions }}
13-
runs-on: ubuntu-18.04
12+
cs-fixer:
13+
name: 'PHP CS Fixer'
14+
15+
runs-on: 'ubuntu-latest'
16+
1417
strategy:
15-
fail-fast: false
1618
matrix:
17-
php-versions: [ '7.2', '7.3', '7.4', '8.0' ]
19+
php-version:
20+
- '8.2'
1821

1922
steps:
20-
# —— Setup Github actions 🐙 —————————————————————————————————————————————
21-
# https://github.com/actions/checkout (official)
2223
-
23-
name: Checkout
24-
uses: actions/checkout@v2
24+
name: 'Check out'
25+
uses: 'actions/checkout@v4'
2526

26-
# https://github.com/shivammathur/setup-php (community)
2727
-
28-
name: Setup PHP, extensions and composer with shivammathur/setup-php
29-
uses: shivammathur/setup-php@v2
28+
name: 'Set up PHP'
29+
uses: 'shivammathur/setup-php@v2'
3030
with:
31-
php-version: ${{ matrix.php-versions }}
32-
extensions: mbstring, ctype, iconv, bcmath, filter, json
33-
coverage: none
34-
env:
35-
update: true
31+
php-version: '${{ matrix.php-version }}'
32+
coverage: 'none'
33+
34+
-
35+
name: 'Get Composer cache directory'
36+
id: 'composer-cache'
37+
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
38+
39+
-
40+
name: 'Cache dependencies'
41+
uses: 'actions/cache@v3'
42+
with:
43+
path: '${{ steps.composer-cache.outputs.cache_dir }}'
44+
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
45+
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'
46+
47+
-
48+
name: 'Install dependencies'
49+
run: 'composer install --no-progress'
50+
51+
-
52+
name: 'Check the code style'
53+
run: 'make cs'
54+
55+
phpstan:
56+
name: 'PhpStan'
57+
58+
runs-on: 'ubuntu-latest'
59+
60+
strategy:
61+
matrix:
62+
php-version:
63+
- '8.2'
64+
65+
steps:
66+
-
67+
name: 'Check out'
68+
uses: 'actions/checkout@v4'
69+
70+
-
71+
name: 'Set up PHP'
72+
uses: 'shivammathur/setup-php@v2'
73+
with:
74+
php-version: '${{ matrix.php-version }}'
75+
coverage: 'none'
76+
77+
-
78+
name: 'Get Composer cache directory'
79+
id: 'composer-cache'
80+
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
3681

37-
# —— Composer 🧙‍️ —————————————————————————————————————————————————————————
3882
-
39-
name: Install Composer dependencies
83+
name: 'Cache dependencies'
84+
uses: 'actions/cache@v3'
85+
with:
86+
path: '${{ steps.composer-cache.outputs.cache_dir }}'
87+
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
88+
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'
89+
90+
-
91+
name: 'Install dependencies'
92+
run: 'composer install --no-progress'
93+
94+
-
95+
name: 'Run PhpStan'
96+
run: 'vendor/bin/phpstan analyze --no-progress'
97+
98+
tests:
99+
name: 'PHPUnit'
100+
101+
runs-on: 'ubuntu-latest'
102+
103+
strategy:
104+
matrix:
105+
include:
106+
-
107+
php-version: '8.2'
108+
composer-options: '--prefer-stable'
109+
symfony-version: '6.3'
110+
-
111+
php-version: '8.2'
112+
composer-options: '--prefer-stable'
113+
symfony-version: '^6.4'
114+
115+
-
116+
php-version: '8.2'
117+
composer-options: '--prefer-stable'
118+
symfony-version: '^7.0'
119+
120+
steps:
121+
-
122+
name: 'Check out'
123+
uses: 'actions/checkout@v4'
124+
125+
-
126+
name: 'Set up PHP'
127+
uses: 'shivammathur/setup-php@v2'
128+
with:
129+
php-version: '${{ matrix.php-version }}'
130+
coverage: 'none'
131+
132+
-
133+
name: 'Get Composer cache directory'
134+
id: 'composer-cache'
135+
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
136+
137+
-
138+
name: 'Cache dependencies'
139+
uses: 'actions/cache@v3'
140+
with:
141+
path: '${{ steps.composer-cache.outputs.cache_dir }}'
142+
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
143+
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'
144+
145+
-
146+
name: 'Install dependencies'
40147
env:
41-
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: 1
148+
COMPOSER_OPTIONS: '${{ matrix.composer-options }}'
149+
SYMFONY_REQUIRE: '${{ matrix.symfony-version }}'
42150
run: |
43-
make install
151+
composer global config --no-plugins allow-plugins.symfony/flex true
152+
composer global require --no-progress --no-scripts --no-plugins symfony/flex
153+
composer update --no-progress $COMPOSER_OPTIONS
44154
45-
## —— Tests ✅ ———————————————————————————————————————————————————————————
46155
-
47-
name: Run Tests
48-
run: |
49-
make test
50-
# lint:
51-
# name: PHP-QA
52-
# runs-on: ubuntu-latest
53-
# strategy:
54-
# fail-fast: false
55-
# steps:
56-
# -
57-
# name: Checkout
58-
# uses: actions/checkout@v2
59-
#
60-
# # https://github.com/shivammathur/setup-php (community)
61-
# -
62-
# name: Setup PHP, extensions and composer with shivammathur/setup-php
63-
# uses: shivammathur/setup-php@v2
64-
# with:
65-
# php-version: '7.4'
66-
# extensions: mbstring, ctype, iconv, bcmath, filter, json
67-
# coverage: none
68-
#
69-
# # —— Composer 🧙‍️ —————————————————————————————————————————————————————————
70-
# -
71-
# name: Install Composer dependencies
72-
# run: |
73-
# make install
74-
#
75-
# -
76-
# name: Run PHP-QA
77-
# run: |
78-
# make check
156+
name: 'Run tests'
157+
run: make phpunit

.gitignore

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
composer.lock
12
/vendor/
2-
/composer.lock
3-
/phpcs.xml
4-
/var/
3+
4+
phpunit.xml
55
.phpunit.result.cache
6+
.phpunit.cache/
7+
.phpunit
8+
9+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
$header = <<<EOF
4+
This Source Code Form is subject to the terms of the Mozilla Public
5+
License, v. 2.0. If a copy of the MPL was not distributed with this
6+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
EOF;
8+
9+
/** @var \Symfony\Component\Finder\Finder $finder */
10+
$finder = PhpCsFixer\Finder::create();
11+
$finder
12+
->in([
13+
__DIR__ . '/src',
14+
__DIR__ . '/tests',
15+
]);
16+
17+
$config = new PhpCsFixer\Config();
18+
$config
19+
->setRiskyAllowed(true)
20+
->setRules(
21+
array_merge(
22+
require __DIR__ . '/vendor/rollerscapes/standards/php-cs-fixer-rules.php',
23+
['header_comment' => ['header' => $header]])
24+
)
25+
->setFinder($finder);
26+
27+
return $config;

CHANGELOG.md

-8
This file was deleted.

Makefile

+2-53
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,4 @@
1-
ifndef BUILD_ENV
2-
BUILD_ENV=php7.2
3-
endif
4-
5-
QA_DOCKER_IMAGE=jakzal/phpqa:1.34.1-php7.4-alpine
6-
QA_DOCKER_COMMAND=docker run --init -t --rm --user "$(shell id -u):$(shell id -g)" --env "COMPOSER_HOME=/composer" --volume /tmp/tmp-phpqa-$(shell id -u):/tmp:delegated --volume "$(shell pwd):/project:delegated" --volume "${HOME}/.composer:/composer:delegated" --workdir /project ${QA_DOCKER_IMAGE}
7-
8-
install: composer-install
9-
dist: composer-validate cs phpstan psalm test
10-
ci: check test
11-
check: composer-validate cs-check phpstan psalm
12-
test: phpunit-coverage
13-
14-
clean:
15-
rm -rf var/
16-
17-
composer-validate: ensure
18-
sh -c "${QA_DOCKER_COMMAND} composer validate"
19-
20-
composer-install: fetch ensure clean
21-
sh -c "${QA_DOCKER_COMMAND} composer upgrade"
22-
23-
composer-install-lowest: fetch ensure clean
24-
sh -c "${QA_DOCKER_COMMAND} composer upgrade --prefer-lowest"
25-
26-
composer-install-dev: fetch ensure clean
27-
rm -f composer.lock
28-
cp composer.json _composer.json
29-
sh -c "${QA_DOCKER_COMMAND} composer config minimum-stability dev"
30-
sh -c "${QA_DOCKER_COMMAND} composer upgrade --no-progress --no-interaction --no-suggest --optimize-autoloader --ansi"
31-
mv _composer.json composer.json
32-
33-
cs:
34-
sh -c "${QA_DOCKER_COMMAND} php vendor/bin/phpcbf"
35-
36-
cs-check:
37-
sh -c "${QA_DOCKER_COMMAND} php vendor/bin/phpcs"
38-
39-
phpstan: ensure
40-
sh -c "${QA_DOCKER_COMMAND} phpstan analyse"
41-
42-
psalm: ensure
43-
sh -c "${QA_DOCKER_COMMAND} psalm --show-info=false"
44-
45-
phpunit-coverage: ensure
46-
sh -c "${QA_DOCKER_COMMAND} phpdbg -qrr vendor/bin/phpunit --verbose --coverage-text --log-junit=var/phpunit.junit.xml --coverage-xml var/coverage-xml/"
1+
include vendor/rollerscapes/standards/Makefile
472

483
phpunit:
49-
sh -c "${QA_DOCKER_COMMAND} phpunit --verbose"
50-
51-
ensure:
52-
mkdir -p ${HOME}/.composer /tmp/tmp-phpqa-$(shell id -u)
53-
54-
fetch:
55-
docker pull "${QA_DOCKER_IMAGE}"
4+
./vendor/bin/phpunit

0 commit comments

Comments
 (0)