Skip to content

Commit eef8332

Browse files
committed
Require PHP 8.4, allow Symfony 8 + streamline docker scripts
1 parent 212b56a commit eef8332

File tree

14 files changed

+130
-31
lines changed

14 files changed

+130
-31
lines changed

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@
2121
}
2222
],
2323
"require": {
24-
"php": ">=8.2",
24+
"php": ">=8.4",
2525
"doctrine/sql-formatter": "^1.0.1",
2626
"squirrelphp/connection": "^0.3.4",
2727
"squirrelphp/queries": "^2.1",
28-
"symfony/config": "^5.0|^6.0|^7.0",
29-
"symfony/dependency-injection": "^5.0|^6.0|^7.0",
30-
"symfony/http-kernel": "^5.0|^6.0|^7.0",
31-
"symfony/var-dumper": "^5.0|^6.0|^7.0"
28+
"symfony/config": "^5.0|^6.0|^7.0|^8.0",
29+
"symfony/dependency-injection": "^5.0|^6.0|^7.0|^8.0",
30+
"symfony/http-kernel": "^5.0|^6.0|^7.0|^8.0",
31+
"symfony/var-dumper": "^5.0|^6.0|^7.0|^8.0"
3232
},
3333
"require-dev": {
3434
"captainhook/captainhook-phar": "^5.0",
3535
"captainhook/hook-installer": "^1.0",
36-
"matthiasnoback/symfony-config-test": "^5.2",
37-
"phpunit/phpunit": "^11.2",
38-
"symfony/finder": "^7.0",
39-
"symfony/process": "^7.0",
36+
"matthiasnoback/symfony-config-test": "^6.1",
37+
"phpunit/phpunit": "^12.0",
38+
"symfony/finder": "^7.0|^8.0",
39+
"symfony/process": "^7.0|^8.0",
4040
"twig/twig": "^3.0"
4141
},
4242
"suggest": {

docker/compose/captainhook.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
services:
2+
captainhook:
3+
image: thecodingmachine/php:8.4-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"

docker/compose/composer.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
services:
22
composer:
3-
image: thecodingmachine/php:8.2-v4-cli
3+
image: thecodingmachine/php:8.4-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,6 +18,6 @@ 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-
XDEBUG_MODE: coverage
21+
# Composer config to use global cache
22+
COMPOSER_CACHE_DIR: "/tmp/composer_cache"
23+
COMPOSER_ROOT_VERSION: 'dev-master'

docker/compose/coverage.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
services:
2+
coverage:
3+
image: thecodingmachine/php:8.4-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+
# Install all composer dependencies before running tests + delete previous coverage report
29+
STARTUP_COMMAND_1: composer --no-interaction --no-progress --no-scripts --no-plugins --quiet install
30+
STARTUP_COMMAND_2: rm -rf /usr/src/app/tests/_reports/*

docker/compose/test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
services:
2+
test:
3+
image: thecodingmachine/php:8.4-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+
# Install all composer dependencies before running tests
25+
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/DependencyInjection/Configuration.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Squirrel\QueriesBundle\DependencyInjection;
44

5-
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
65
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
76
use Symfony\Component\Config\Definition\ConfigurationInterface;
87

@@ -19,10 +18,6 @@ public function getConfigTreeBuilder(): TreeBuilder
1918

2019
$rootNode = $treeBuilder->getRootNode();
2120

22-
if (!$rootNode instanceof ArrayNodeDefinition) {
23-
throw new \LogicException('Configuration for ' . $this->alias . ' was unexpectedly not an array');
24-
}
25-
2621
// phpcs:disable
2722
$rootNode
2823
->fixXmlConfig('connection', 'connections')

tests/ExtensionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ public function testBuild(): void
1717
$extension->load([], $containerBuilder);
1818

1919
$containerBuilder->compile();
20+
21+
$this->assertTrue(true);
2022
}
2123
}

0 commit comments

Comments
 (0)