Skip to content

Commit 58e556c

Browse files
authored
Bump PHP to 8.1 in composer.json (#506)
* Bump PHP to 8.1 in composer.json * Use PHP 8.1 on SA CI too * Rebuild CI * Fix PHPStan * Apply PHP CS Fixer changes
1 parent 2b80944 commit 58e556c

File tree

7 files changed

+57
-41
lines changed

7 files changed

+57
-41
lines changed

.github/workflows/static.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup PHP
2323
uses: shivammathur/setup-php@v2
2424
with:
25-
php-version: '8.0'
25+
php-version: '8.1'
2626
coverage: none
2727

2828
- name: Download dependencies
@@ -63,7 +63,7 @@ jobs:
6363
- name: Setup PHP
6464
uses: shivammathur/setup-php@v2
6565
with:
66-
php-version: '8.0'
66+
php-version: '8.1'
6767
coverage: none
6868

6969
- name: Download dependencies

Catalogue/CatalogueManager.php

+11-8
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,29 @@ public function getMessages(string $locale, string $domain): array
6767
/**
6868
* @param array $config {
6969
*
70-
* @var string $domain
71-
* @var string $locale
72-
* @var bool $isNew
73-
* @var bool $isObsolete
74-
* @var bool $isApproved
75-
* }
76-
*
77-
* @return CatalogueMessage[]
70+
* @return CatalogueMessage[] Contains:
71+
* - string $domain
72+
* - string $locale
73+
* - bool $isNew
74+
* - bool $isObsolete
75+
* - bool $isApproved
7876
*/
7977
public function findMessages(array $config = []): array
8078
{
79+
/** @var string $inputDomain */
8180
$inputDomain = $config['domain'] ?? null;
81+
/** @var bool $isNew */
8282
$isNew = $config['isNew'] ?? null;
83+
/** @var bool $isObsolete */
8384
$isObsolete = $config['isObsolete'] ?? null;
85+
/** @var bool $isApproved */
8486
$isApproved = $config['isApproved'] ?? null;
8587
$isEmpty = $config['isEmpty'] ?? null;
8688

8789
$messages = [];
8890
$catalogues = [];
8991
if (isset($config['locale'])) {
92+
/** @var string $locale */
9093
$locale = $config['locale'];
9194
if (isset($this->catalogues[$locale])) {
9295
$catalogues = [$locale => $this->catalogues[$locale]];

Command/DeleteEmptyCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Console\Attribute\AsCommand;
1515
use Symfony\Component\Console\Command\Command;
1616
use Symfony\Component\Console\Helper\ProgressBar;
17+
use Symfony\Component\Console\Helper\QuestionHelper;
1718
use Symfony\Component\Console\Input\InputArgument;
1819
use Symfony\Component\Console\Input\InputInterface;
1920
use Symfony\Component\Console\Input\InputOption;
@@ -96,6 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9697
}
9798

9899
if ($input->isInteractive()) {
100+
/** @var QuestionHelper $helper */
99101
$helper = $this->getHelper('question');
100102
$question = new ConfirmationQuestion(sprintf('You are about to remove %d translations. Do you wish to continue? (y/N) ', $messageCount), false);
101103
if (!$helper->ask($input, $output, $question)) {

Command/DeleteObsoleteCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Console\Attribute\AsCommand;
1515
use Symfony\Component\Console\Command\Command;
1616
use Symfony\Component\Console\Helper\ProgressBar;
17+
use Symfony\Component\Console\Helper\QuestionHelper;
1718
use Symfony\Component\Console\Input\InputArgument;
1819
use Symfony\Component\Console\Input\InputInterface;
1920
use Symfony\Component\Console\Input\InputOption;
@@ -97,6 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9798
}
9899

99100
if ($input->isInteractive()) {
101+
/** @var QuestionHelper $helper */
100102
$helper = $this->getHelper('question');
101103
$question = new ConfirmationQuestion(sprintf('You are about to remove %d translations. Do you wish to continue? (y/N) ', $messageCount), false);
102104
if (!$helper->ask($input, $output, $question)) {

Service/Importer.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ public function __construct(Extractor $extractor, Environment $twig, string $def
6060

6161
/**
6262
* @param MessageCatalogue[] $catalogues
63-
* @param array $config {
64-
*
65-
* @var array $blacklist_domains Blacklist the domains we should exclude. Cannot be used with whitelist.
66-
* @var array $whitelist_domains Whitelist the domains we should include. Cannot be used with blacklist.
67-
* @var string $project_root The project root will be removed from the source location.
68-
* }
63+
* @param array $config Configuration options:
64+
* - array $blacklist_domains Domains to be excluded. Cannot be used with whitelist.
65+
* - array $whitelist_domains Domains to be included. Cannot be used with blacklist.
66+
* - string $project_root The project root that will be removed from the source location.
6967
*/
7068
public function extractToCatalogues(Finder $finder, array $catalogues, array $config = []): ImportResult
7169
{

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^8.0",
13+
"php": "^8.1",
1414
"symfony/framework-bundle": "^5.3 || ^6.0",
1515
"symfony/validator": "^5.3 || ^6.0",
1616
"symfony/translation": "^5.3 || ^6.0",
@@ -38,7 +38,8 @@
3838
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
3939
"matthiasnoback/symfony-config-test": "^4.1",
4040
"nyholm/psr7": "^1.1",
41-
"nyholm/symfony-bundle-test": "^2.0"
41+
"nyholm/symfony-bundle-test": "^2.0",
42+
"phpstan/phpstan": "^1.11"
4243
},
4344
"suggest": {
4445
"php-http/httplug-bundle": "To easier configure your httplug clients."

phpstan-baseline.neon

+33-23
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ parameters:
2626
path: Command/StatusCommand.php
2727

2828
-
29-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\TreeBuilder\\:\\:root\\(\\)\\.$#"
29+
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:fixXmlConfig\\(\\)\\.$#"
3030
count: 1
3131
path: DependencyInjection/Configuration.php
3232

3333
-
34-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:fixXmlConfig\\(\\)\\.$#"
34+
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:booleanNode\\(\\)\\.$#"
3535
count: 1
3636
path: DependencyInjection/Configuration.php
3737

@@ -41,7 +41,7 @@ parameters:
4141
path: DependencyInjection/Configuration.php
4242

4343
-
44-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:booleanNode\\(\\)\\.$#"
44+
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\TreeBuilder\\:\\:root\\(\\)\\.$#"
4545
count: 1
4646
path: DependencyInjection/Configuration.php
4747

@@ -51,22 +51,22 @@ parameters:
5151
path: Service/CacheClearer.php
5252

5353
-
54-
message: "#^Property Translation\\\\Bundle\\\\Translator\\\\EditInPlaceTranslator\\:\\:\\$translator has unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface as its type\\.$#"
54+
message: "#^Call to method getCatalogue\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
5555
count: 1
5656
path: Translator/EditInPlaceTranslator.php
5757

5858
-
59-
message: "#^Parameter \\$translator of method Translation\\\\Bundle\\\\Translator\\\\EditInPlaceTranslator\\:\\:__construct\\(\\) has invalid typehint type Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
59+
message: "#^Call to method getCatalogues\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
6060
count: 1
6161
path: Translator/EditInPlaceTranslator.php
6262

6363
-
64-
message: "#^Class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface not found\\.$#"
65-
count: 1
64+
message: "#^Call to method getLocale\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
65+
count: 2
6666
path: Translator/EditInPlaceTranslator.php
6767

6868
-
69-
message: "#^Call to method getCatalogue\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
69+
message: "#^Call to method setLocale\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
7070
count: 1
7171
path: Translator/EditInPlaceTranslator.php
7272

@@ -76,32 +76,42 @@ parameters:
7676
path: Translator/EditInPlaceTranslator.php
7777

7878
-
79-
message: "#^Call to method getLocale\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
80-
count: 2
79+
message: "#^Call to method transChoice\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
80+
count: 1
8181
path: Translator/EditInPlaceTranslator.php
8282

8383
-
84-
message: "#^Call to method transChoice\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
84+
message: "#^Class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface not found\\.$#"
8585
count: 1
8686
path: Translator/EditInPlaceTranslator.php
8787

8888
-
89-
message: "#^Call to method setLocale\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
89+
message: "#^Parameter \\$translator of method Translation\\\\Bundle\\\\Translator\\\\EditInPlaceTranslator\\:\\:__construct\\(\\) has invalid type Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
9090
count: 1
9191
path: Translator/EditInPlaceTranslator.php
9292

9393
-
94-
message: "#^Property Translation\\\\Bundle\\\\Translator\\\\FallbackTranslator\\:\\:\\$symfonyTranslator has unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface as its type\\.$#"
94+
message: "#^Property Translation\\\\Bundle\\\\Translator\\\\EditInPlaceTranslator\\:\\:\\$translator has unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface as its type\\.$#"
95+
count: 1
96+
path: Translator/EditInPlaceTranslator.php
97+
98+
-
99+
message: "#^Call to method getCatalogue\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
95100
count: 1
96101
path: Translator/FallbackTranslator.php
97102

98103
-
99-
message: "#^Parameter \\$symfonyTranslator of method Translation\\\\Bundle\\\\Translator\\\\FallbackTranslator\\:\\:__construct\\(\\) has invalid typehint type Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
104+
message: "#^Call to method getCatalogues\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
100105
count: 1
101106
path: Translator/FallbackTranslator.php
102107

103108
-
104-
message: "#^Class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface not found\\.$#"
109+
message: "#^Call to method getLocale\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
110+
count: 1
111+
path: Translator/FallbackTranslator.php
112+
113+
-
114+
message: "#^Call to method setLocale\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
105115
count: 1
106116
path: Translator/FallbackTranslator.php
107117

@@ -116,29 +126,29 @@ parameters:
116126
path: Translator/FallbackTranslator.php
117127

118128
-
119-
message: "#^Call to method setLocale\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
129+
message: "#^Class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface not found\\.$#"
120130
count: 1
121131
path: Translator/FallbackTranslator.php
122132

123133
-
124-
message: "#^Call to method getLocale\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
134+
message: "#^Parameter \\$symfonyTranslator of method Translation\\\\Bundle\\\\Translator\\\\FallbackTranslator\\:\\:__construct\\(\\) has invalid type Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
125135
count: 1
126136
path: Translator/FallbackTranslator.php
127137

128138
-
129-
message: "#^Call to method getCatalogue\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
139+
message: "#^Property Translation\\\\Bundle\\\\Translator\\\\FallbackTranslator\\:\\:\\$symfonyTranslator has unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface as its type\\.$#"
130140
count: 1
131141
path: Translator/FallbackTranslator.php
132142

133143
-
134-
message: "#^Class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface not found\\.$#"
135-
count: 1
144+
message: "#^Call to an undefined method Symfony\\\\Component\\\\Translation\\\\TranslatorBagInterface\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface\\:\\:transChoice\\(\\)\\.$#"
145+
count: 2
136146
path: Twig/TranslationExtension.php
137147

138148
-
139-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Translation\\\\TranslatorBagInterface\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface\\:\\:transChoice\\(\\)\\.$#"
140-
count: 2
149+
message: "#^Class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface not found\\.$#"
150+
count: 1
141151
path: Twig/TranslationExtension.php
142152

143-
excludes_analyse:
153+
excludePaths:
144154
- Translator/TranslatorInterface.php

0 commit comments

Comments
 (0)