Skip to content

Commit 0c1b1f2

Browse files
committed
Test against PHP 8.4
1 parent 0288676 commit 0c1b1f2

12 files changed

+91
-36
lines changed

.github/workflows/code-style.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-20.04
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1414
- name: Install PHP
1515
uses: shivammathur/setup-php@v2
1616
with:

.github/workflows/static-analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
runs-on: ubuntu-20.04
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1414
- name: Install PHP
1515
uses: shivammathur/setup-php@v2
1616
with:
1717
php-version: "7.1"
1818
ini-values: memory_limit=-1
1919
tools: composer:v2
2020
- name: Cache dependencies
21-
uses: actions/cache@v2
21+
uses: actions/cache@v4
2222
with:
2323
path: |
2424
~/.composer/cache

.github/workflows/test.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ jobs:
1515
- "7.2"
1616
- "7.3"
1717
- "7.4"
18+
- "8.4"
1819
steps:
1920
- name: Checkout
20-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2122
- name: Install PHP
2223
uses: shivammathur/setup-php@v2
2324
with:
@@ -26,7 +27,7 @@ jobs:
2627
ini-values: memory_limit=-1
2728
tools: composer:v2
2829
- name: Cache dependencies
29-
uses: actions/cache@v2
30+
uses: actions/cache@v4
3031
with:
3132
path: |
3233
~/.composer/cache
@@ -39,6 +40,8 @@ jobs:
3940

4041
- name: Run PHPUnit
4142
run: make test-coveralls
43+
env:
44+
PHPUNIT_VERSION: "${{ matrix.php-version == '8.4' && '10' || '07' }}"
4245

4346
- name: Upload code coverage
4447
if: ${{ matrix.php-version == '7.1' }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.phpunit.result.cache
12
build
23
composer.lock
34
vendor

Dockerfile

+21-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
1-
FROM php:7.1-cli-buster
1+
ARG PHP_TAG=7.1-cli-buster
2+
FROM php:${PHP_TAG}
23

3-
RUN docker-php-ext-enable opcache && \
4-
docker-php-source delete
4+
RUN <<-EOF
5+
docker-php-ext-enable opcache
6+
EOF
57

6-
RUN echo '\
7-
display_errors=On\n\
8-
error_reporting=E_ALL\n\
9-
date.timezone=UTC\n\
10-
' >> /usr/local/etc/php/conf.d/php.ini
8+
RUN <<-EOF
9+
cat <<-SHELL >> /usr/local/etc/php/conf.d/php.ini
10+
display_errors=On
11+
error_reporting=E_ALL
12+
date.timezone=UTC
13+
SHELL
14+
EOF
1115

1216
ENV COMPOSER_ALLOW_SUPERUSER 1
1317

14-
RUN apt-get update && \
15-
apt-get install unzip && \
16-
curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet && \
17-
mv composer.phar /usr/local/bin/composer && \
18-
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"\n' >> /root/.bashrc
18+
RUN <<-EOF
19+
apt-get update
20+
apt-get install unzip
21+
curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet
22+
mv composer.phar /usr/local/bin/composer
23+
cat <<-SHELL >> /root/.bashrc
24+
export PATH="$HOME/.composer/vendor/bin:$PATH"
25+
SHELL
26+
EOF
1927

2028
RUN composer global require squizlabs/php_codesniffer

Makefile

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# customization
22

3-
PACKAGE_NAME = icanboogie/inflector
43
PHPUNIT = vendor/bin/phpunit
54

65
# do not edit the following lines
@@ -13,24 +12,32 @@ test-dependencies: vendor
1312

1413
.PHONY: test
1514
test: test-dependencies
16-
@$(PHPUNIT)
15+
@XDEBUG_MODE=none $(PHPUNIT) --configuration=phpunit10.xml
1716

1817
.PHONY: test-coverage
1918
test-coverage: test-dependencies
2019
@mkdir -p build/coverage
21-
@$(PHPUNIT) --coverage-html build/coverage
20+
@XDEBUG_MODE=coverage $(PHPUNIT) --coverage-html build/coverage
2221

2322
.PHONY: test-coveralls
2423
test-coveralls: test-dependencies
2524
@mkdir -p build/logs
26-
@$(PHPUNIT) --coverage-clover build/logs/clover.xml
25+
@XDEBUG_MODE=coverage $(PHPUNIT) --coverage-clover build/logs/clover.xml
2726

2827
.PHONY: test-container
29-
test-container:
30-
@docker-compose run --rm app bash
28+
test-container: test-container-71
29+
30+
.PHONY: test-container-71
31+
test-container-71:
32+
@-docker-compose run --rm app71 bash
33+
@docker-compose down -v
34+
35+
.PHONY: test-container-84
36+
test-container-84:
37+
@-docker-compose run --rm app84 bash
3138
@docker-compose down -v
3239

3340
.PHONY: lint
3441
lint:
35-
@phpcs
36-
@vendor/bin/phpstan
42+
@XDEBUG_MODE=off phpcs -s
43+
@XDEBUG_MODE=off vendor/bin/phpstan

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
"ext-mbstring": "*"
2626
},
2727
"require-dev": {
28-
"icanboogie/common": "^2.0",
29-
"phpstan/phpstan": "^0.12.92",
30-
"phpunit/phpunit": "^7.5"
28+
"icanboogie/common": "^2.1",
29+
"phpstan/phpstan": "^0.12.100|^2.0",
30+
"phpunit/phpunit": "^7.5.20|^10.0"
3131
},
3232
"conflict": {
3333
"icanboogie/common": "<2.0"

docker-compose.yaml

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
---
2-
version: "3.2"
32
services:
4-
app:
5-
build: .
3+
app71:
4+
build:
5+
context: .
6+
args:
7+
PHP_TAG: "7.1-cli-buster"
68
environment:
79
PHP_IDE_CONFIG: 'serverName=icanboogie-inflector'
8-
volumes:
10+
PHPUNIT_VERSION: "07"
11+
volumes: &vol
912
- .:/app:delegated
1013
- ~/.composer:/root/.composer:delegated
1114
working_dir: /app
15+
app84:
16+
build:
17+
context: .
18+
args:
19+
PHP_TAG: "8.4.0RC4-cli-bookworm"
20+
environment:
21+
PHP_IDE_CONFIG: 'serverName=icanboogie-inflector'
22+
PHPUNIT_VERSION: "10"
23+
volumes: *vol
24+
working_dir: /app

lib/InflectionsNotFound.php

-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515

1616
class InflectionsNotFound extends LogicException
1717
{
18-
1918
}

lib/Inflector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function get(string $locale = self::DEFAULT_LOCALE): self
6767
*/
6868
private $inflections;
6969

70-
public function __construct(Inflections $inflections = null)
70+
public function __construct(?Inflections $inflections = null)
7171
{
7272
$this->inflections = $inflections ?? new Inflections();
7373
}

phpunit.xml renamed to phpunit07.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
executionOrder="depends,defects"
66
beStrictAboutOutputDuringTests="true"
77
verbose="true"
8-
colors="true">
8+
colors="true"
9+
>
910
<testsuites>
1011
<testsuite name="icanboogie/inflector">
1112
<directory>./tests</directory>

phpunit10.xml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
4+
beStrictAboutCoverageMetadata="true"
5+
beStrictAboutOutputDuringTests="true"
6+
bootstrap="tests/bootstrap.php"
7+
colors="true"
8+
displayDetailsOnTestsThatTriggerDeprecations="true"
9+
displayDetailsOnTestsThatTriggerNotices="true"
10+
displayDetailsOnTestsThatTriggerWarnings="true"
11+
executionOrder="depends,defects"
12+
>
13+
<testsuites>
14+
<testsuite name="icanboogie/inflector">
15+
<directory>tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
<source>
19+
<include>
20+
<directory>lib</directory>
21+
</include>
22+
</source>
23+
</phpunit>

0 commit comments

Comments
 (0)