Skip to content

Commit 37968d9

Browse files
authored
Add Symfony 6 support (#61)
* 🔧 Update php cs fixer configuration * ⬆️ Upgrade dependencies for Symfony 6 * ⬆️ Upgrade dependencies (docker/ci) * 🔧 Update phpunit configuration file * 👷 Update phpstan rules * 🩹 Fix static analysis * 💚 Remove udiff format argument * 💚 Revert to phpunit 8.5 for php7.2
1 parent d83de3f commit 37968d9

File tree

10 files changed

+53
-57
lines changed

10 files changed

+53
-57
lines changed

.github/workflows/static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- name: Run PHP-CS-Fixer
2020
uses: docker://jakzal/phpqa:php7.3-alpine
2121
with:
22-
args: php-cs-fixer fix --dry-run --diff-format udiff -vvv
22+
args: php-cs-fixer fix --dry-run -vvv

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
/phpspec.yml
44
/phpunit.xml
55
/vendor/
6+
/.php-cs-fixer.cache
7+
/.phpunit.result.cache

.php-cs-fixer.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->name('*.php')
5+
->in(__DIR__.'/src')
6+
->in(__DIR__.'/tests')
7+
;
8+
9+
$config = new PhpCsFixer\Config();
10+
11+
return $config->setRules([
12+
'@Symfony' => true,
13+
'@Symfony:risky' => true,
14+
])
15+
->setRiskyAllowed(true)
16+
->setFinder($finder)
17+
;

.php_cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
.PHONY: ${TARGETS}
22

33
DIR := ${CURDIR}
4-
QA_IMAGE := jakzal/phpqa:php7.3-alpine
4+
QA_IMAGE := jakzal/phpqa:php8.1-alpine
55

66
cs-fix:
7-
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --diff-format udiff -vvv
7+
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix -vvv
88

99
cs-diff:
10-
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --diff-format udiff --dry-run -vvv
10+
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --dry-run -vvv
1111

1212
phpstan:
1313
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) phpstan analyze

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
"require": {
1212
"php": "^7.2 || ^8.0",
1313
"php-translation/symfony-storage": "^2.1",
14-
"symfony/translation": "^4.4.20 || ^5.2.5",
15-
"symfony/yaml": "^4.4.20 || ^5.2.5",
14+
"symfony/translation": "^4.4.20 || ^5.2.5 || ^6.0",
15+
"symfony/yaml": "^4.4.20 || ^5.2.5 || ^6.0",
1616
"friendsofapi/localise.biz": "^1.0"
1717
},
1818
"require-dev": {
1919
"phpunit/phpunit": "^8.5",
20-
"symfony/framework-bundle": "^4.4.20 || ^5.2.5",
20+
"symfony/framework-bundle": "^4.4.20 || ^5.2.5 || ^6.0",
2121
"nyholm/psr7": "^1.2",
22-
"nyholm/symfony-bundle-test": "^1.6.1",
22+
"nyholm/symfony-bundle-test": "^1.6.1, <1.8",
2323
"php-http/curl-client": "^2.0",
2424
"php-http/httplug-bundle": "^1.16",
25-
"php-http/message": "^1.6"
25+
"php-http/message": "^1.11"
2626
},
2727
"autoload": {
2828
"psr-4": {

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: "#^Method Translation\\\\PlatformAdapter\\\\Loco\\\\Bridge\\\\Symfony\\\\DependencyInjection\\\\TranslationAdapterLocoExtension\\:\\:load\\(\\) has no return typehint specified\\.$#"
5-
count: 1
6-
path: src/Bridge/Symfony/DependencyInjection/TranslationAdapterLocoExtension.php
7-
83
-
94
message: "#^Call to an undefined method FAPI\\\\Localise\\\\Model\\\\Translation\\\\Translation\\|Psr\\\\Http\\\\Message\\\\ResponseInterface\\:\\:getTranslation\\(\\)\\.$#"
105
count: 1

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ parameters:
77
checkMissingIterableValueType: false
88
paths:
99
- src
10-
excludes_analyse:
10+
excludePaths:
1111
- vendor
1212
- tests

phpunit.xml.dist

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
32
<phpunit backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="false"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
bootstrap="./vendor/autoload.php"
12-
>
3+
backupStaticAttributes="false"
4+
colors="false"
5+
convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
bootstrap="./vendor/autoload.php"
11+
>
1312

14-
<testsuites>
15-
<testsuite name="Tests">
16-
<directory>./tests</directory>
17-
</testsuite>
18-
</testsuites>
13+
<testsuites>
14+
<testsuite name="Tests">
15+
<directory>./tests</directory>
16+
</testsuite>
17+
</testsuites>
1918

20-
<filter>
21-
<whitelist>
22-
<directory suffix=".php">./</directory>
23-
<exclude>
24-
<directory>vendor</directory>
25-
<directory>Tests</directory>
26-
</exclude>
27-
</whitelist>
28-
</filter>
19+
<filter>
20+
<whitelist>
21+
<directory suffix=".php">./</directory>
22+
<exclude>
23+
<directory>vendor</directory>
24+
<directory>Tests</directory>
25+
</exclude>
26+
</whitelist>
27+
</filter>
2928
</phpunit>

src/Bridge/Symfony/DependencyInjection/TranslationAdapterLocoExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TranslationAdapterLocoExtension extends Extension
2929
/**
3030
* {@inheritdoc}
3131
*/
32-
public function load(array $configs, ContainerBuilder $container)
32+
public function load(array $configs, ContainerBuilder $container): void
3333
{
3434
$configuration = new Configuration();
3535
$config = $this->processConfiguration($configuration, $configs);

0 commit comments

Comments
 (0)