Skip to content

Commit 45163c4

Browse files
committed
Require PHP 8.4 and avoid PHP 8.5 deprecations
1 parent 7ee19e7 commit 45163c4

File tree

11 files changed

+130
-21
lines changed

11 files changed

+130
-21
lines changed

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=8.2",
21+
"php": ">=8.4",
2222
"ext-mbstring": "*",
2323
"squirrelphp/debug": "^2.0"
2424
},
2525
"require-dev": {
2626
"ext-intl": "*",
2727
"captainhook/captainhook-phar": "^5.0",
2828
"captainhook/hook-installer": "^1.0",
29-
"phpunit/phpunit": "^11.2",
29+
"phpunit/phpunit": "^12",
3030
"twig/twig": "^3.0",
31-
"symfony/finder": "^7.0",
32-
"symfony/form": "^7.0",
33-
"symfony/http-foundation": "^7.0",
34-
"symfony/process": "^7.0"
31+
"symfony/finder": "^7.0|^8.0",
32+
"symfony/form": "^7.0|^8.0",
33+
"symfony/http-foundation": "^7.0|^8.0",
34+
"symfony/process": "^7.0|^8.0"
3535
},
3636
"suggest": {
3737
"squirrelphp/strings-bundle": "Symfony integration of squirrelphp/strings"

docker/compose/captainhook.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
services:
2+
captainhook:
3+
image: thecodingmachine/php:8.5-v5-cli
4+
container_name: squirrel_captainhook
5+
tty: true
6+
working_dir: /usr/src/app
7+
volumes:
8+
- ../..:/usr/src/app
9+
environment:
10+
# Basic config for CLI commands
11+
PHP_INI_ERROR_REPORTING: "E_ALL"
12+
PHP_INI_MEMORY_LIMIT: "1g"
13+
PHP_INI_MAX_EXECUTION_TIME: 3600
14+
# Enable Opcache + JIT
15+
PHP_INI_OPCACHE__ENABLE_CLI: 1
16+
PHP_INI_OPCACHE__MEMORY_CONSUMPTION: 256
17+
PHP_INI_OPCACHE__VALIDATE_TIMESTAMPS: 0
18+
PHP_INI_JIT_BUFFER_SIZE: "256m"
19+
# Enable necessary extensions
20+
PHP_EXTENSION_INTL: 1

docker/compose/composer.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
services:
22
composer:
3-
image: thecodingmachine/php:8.2-v5-cli
3+
image: thecodingmachine/php:8.5-v5-cli
44
container_name: squirrel_composer
5+
tty: true
56
working_dir: /usr/src/app
67
command: [ "composer", "${COMPOSER_COMMAND}", "--ansi" ]
7-
logging:
8-
driver: "none"
98
volumes:
109
- .:/usr/src/app
1110
- "$HOME/.cache/composer:/tmp/composer_cache"
1211
environment:
13-
COMPOSER_CACHE_DIR: "/tmp/composer_cache"
14-
COMPOSER_ROOT_VERSION: 'dev-master'
1512
# Basic config for CLI commands
1613
PHP_INI_ERROR_REPORTING: "E_ALL"
1714
PHP_INI_MEMORY_LIMIT: "1g"
@@ -21,7 +18,8 @@ services:
2118
PHP_INI_OPCACHE__MEMORY_CONSUMPTION: 256
2219
PHP_INI_OPCACHE__VALIDATE_TIMESTAMPS: 0
2320
PHP_INI_JIT_BUFFER_SIZE: "256m"
24-
# For code coverage
25-
PHP_EXTENSION_XDEBUG: 1
26-
PHP_EXTENSION_INTL: 1
27-
XDEBUG_MODE: coverage
21+
# Composer config to use global cache
22+
COMPOSER_CACHE_DIR: "/tmp/composer_cache"
23+
COMPOSER_ROOT_VERSION: 'dev-master'
24+
# Enable necessary extensions
25+
PHP_EXTENSION_INTL: 1

docker/compose/coverage.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
services:
2+
coverage:
3+
image: thecodingmachine/php:8.5-v5-cli
4+
container_name: squirrel_coverage
5+
tty: true
6+
working_dir: /usr/src/app
7+
command: [ "vendor/bin/phpunit", "--configuration=tools/phpunit.xml.dist", "--colors=always", "--coverage-html", "tests/_reports"]
8+
volumes:
9+
- .:/usr/src/app
10+
- "$HOME/.cache/composer:/tmp/composer_cache"
11+
environment:
12+
# Basic config for CLI commands
13+
PHP_INI_ERROR_REPORTING: "E_ALL"
14+
PHP_INI_MEMORY_LIMIT: "1g"
15+
PHP_INI_MAX_EXECUTION_TIME: 3600
16+
# Enable Opcache, disable JIT
17+
PHP_INI_OPCACHE__ENABLE_CLI: 1
18+
PHP_INI_OPCACHE__MEMORY_CONSUMPTION: 256
19+
PHP_INI_OPCACHE__VALIDATE_TIMESTAMPS: 0
20+
PHP_INI_OPCACHE__JIT: "disable"
21+
# Composer config to use global cache
22+
COMPOSER_CACHE_DIR: "/tmp/composer_cache"
23+
COMPOSER_ROOT_VERSION: 'dev-master'
24+
# Enable XDEBUG for coverage
25+
PHP_EXTENSION_XDEBUG: 1
26+
XDEBUG_MODE: coverage
27+
#PHP_EXTENSION_PCOV: 1
28+
# Enable necessary extensions
29+
PHP_EXTENSION_INTL: 1
30+
# Install all composer dependencies before running tests + delete previous coverage report
31+
STARTUP_COMMAND_1: composer --no-interaction --no-progress --no-scripts --no-plugins --quiet install
32+
STARTUP_COMMAND_2: rm -rf /usr/src/app/tests/_reports/*

docker/compose/test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
services:
2+
test:
3+
image: thecodingmachine/php:8.5-v5-cli
4+
container_name: squirrel_test
5+
tty: true
6+
working_dir: /usr/src/app
7+
command: ["vendor/bin/phpunit", "--configuration=tools/phpunit.xml.dist", "--colors=always"]
8+
volumes:
9+
- .:/usr/src/app
10+
- "$HOME/.cache/composer:/tmp/composer_cache"
11+
environment:
12+
# Basic config for CLI commands
13+
PHP_INI_ERROR_REPORTING: "E_ALL"
14+
PHP_INI_MEMORY_LIMIT: "1g"
15+
PHP_INI_MAX_EXECUTION_TIME: 3600
16+
# Enable Opcache, disable JIT
17+
PHP_INI_OPCACHE__ENABLE_CLI: 1
18+
PHP_INI_OPCACHE__MEMORY_CONSUMPTION: 256
19+
PHP_INI_OPCACHE__VALIDATE_TIMESTAMPS: 0
20+
PHP_INI_OPCACHE__JIT: "disable"
21+
# Composer config to use global cache
22+
COMPOSER_CACHE_DIR: "/tmp/composer_cache"
23+
COMPOSER_ROOT_VERSION: 'dev-master'
24+
# Enable necessary extensions
25+
PHP_EXTENSION_INTL: 1
26+
# Install all composer dependencies before running tests
27+
STARTUP_COMMAND_1: composer --no-interaction --no-progress --no-scripts --no-plugins --quiet install

docker/composer

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
# Get directory of this script
33
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
44

5+
# Remove all running docker containers
6+
COMPOSER_COMMAND="$@" docker compose -f "$DIR/compose/composer.yml" --project-directory "$DIR/.." --project-name=squirrel_composer down --volumes --remove-orphans
7+
8+
# Run composer with given arguments
59
COMPOSER_COMMAND="$@" docker compose -f "$DIR/compose/composer.yml" --project-directory "$DIR/.." --project-name=squirrel_composer up --abort-on-container-exit --exit-code-from=composer --no-log-prefix composer 2>&1

docker/coverage

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
# Get directory of this script
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4+
5+
# Remove all running docker containers
6+
docker compose -f "$DIR/compose/coverage.yml" --project-directory "$DIR/.." --project-name=squirrel_coverage down --volumes --remove-orphans
7+
8+
# Run tests with coverage report
9+
docker compose -f "$DIR/compose/coverage.yml" --project-directory "$DIR/.." --project-name=squirrel_coverage up --abort-on-container-exit --exit-code-from=coverage coverage
10+
11+
# Remove all running docker containers
12+
docker compose -f "$DIR/compose/coverage.yml" --project-directory "$DIR/.." --project-name=squirrel_coverage down --volumes --remove-orphans

docker/test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
# Get directory of this script
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4+
5+
# Remove all running docker containers
6+
docker compose -f "$DIR/compose/test.yml" --project-directory "$DIR/.." --project-name=squirrel_test down --volumes --remove-orphans
7+
8+
# Run tests
9+
docker compose -f "$DIR/compose/test.yml" --project-directory "$DIR/.." --project-name=squirrel_test up --abort-on-container-exit --exit-code-from=test test
10+
11+
# Remove all running docker containers
12+
docker compose -f "$DIR/compose/test.yml" --project-directory "$DIR/.." --project-name=squirrel_test down --volumes --remove-orphans

src/Attribute/StringFilterExtension.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
4646
foreach ($data as $key => $value) {
4747
if (\property_exists($model, $key)) {
4848
$reflectionProperty = new \ReflectionProperty($model, $key);
49-
$reflectionProperty->setAccessible(true);
5049

5150
$reflectionPropertyType = $reflectionProperty->getType();
5251

@@ -93,7 +92,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
9392
foreach ($data as $key => $value) {
9493
if (\property_exists($model, $key)) {
9594
$reflectionProperty = new \ReflectionProperty($model, $key);
96-
$reflectionProperty->setAccessible(true);
9795

9896
// @codeCoverageIgnoreStart
9997
if (!$reflectionProperty->isInitialized($model)) {

src/Attribute/StringFilterProcessor.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ public function process(object $class): void
3232
continue;
3333
}
3434

35-
// Make it possible to access and change private properties
36-
$property->setAccessible(true);
37-
3835
// If the property is not initialized, we skip it
3936
if (!$property->isInitialized($class)) {
4037
continue;

0 commit comments

Comments
 (0)