Skip to content

Commit 8a2336e

Browse files
authored
bump: all the things (#213)
* bump: Infra 1.14 * bump: PHPUnit 12.0 * fix: Rector stuff * fix: Rector stuff * fix: fixtures updated to latest version
1 parent a2e086a commit 8a2336e

32 files changed

+68
-80
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"symfony/yaml": "^6.4 || ^7.0"
3232
},
3333
"require-dev": {
34-
"phpunit/phpunit": "^11.0",
35-
"sigwin/infra": "~1.11.0"
34+
"phpunit/phpunit": "^11.4 || ^12.0",
35+
"sigwin/infra": "~1.14.0"
3636
},
3737
"autoload": {
3838
"psr-4": {

infection.json.dist

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55
]
66
},
77
"logs": {
8-
"text": "var\/infection.log"
8+
"text": "var/phpqa/infection.log"
99
},
10-
"minMsi": 100,
1110
"minCoveredMsi": 100,
1211
"mutators": {
1312
"@default": true,
1413
"IdenticalEqual": false,
1514
"NotIdenticalNotEqual": false,
16-
"UnwrapRtrim": false,
17-
"CastBool": false,
1815
"MBString": false
1916
}
2017
}

phpunit.xml.dist

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
beStrictAboutChangesToGlobalState="true"
55
beStrictAboutCoverageMetadata="true"
66
beStrictAboutOutputDuringTests="true"
7-
beStrictAboutTodoAnnotatedTests="true"
87
bootstrap="./vendor/autoload.php"
98
cacheDirectory="var/phpqa/phpunit"
109
colors="true"
10+
displayDetailsOnPhpunitDeprecations="true"
11+
displayDetailsOnTestsThatTriggerDeprecations="true"
12+
displayDetailsOnTestsThatTriggerErrors="true"
13+
displayDetailsOnTestsThatTriggerNotices="true"
14+
displayDetailsOnTestsThatTriggerWarnings="true"
1115
enforceTimeLimit="true"
1216
executionOrder="random"
1317
failOnEmptyTestSuite="true"

psalm.baseline.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.24.0@462c80e31c34e58cc4f750c656be3927e80e550e">
2+
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
33
<file src="bootstrap.php">
44
<PossiblyFalseArgument>
55
<code><![CDATA[getenv('YASSG_SKIP_BUNDLES')]]></code>
@@ -338,6 +338,9 @@
338338
<code><![CDATA[$fallbackLocale]]></code>
339339
<code><![CDATA[$locale]]></code>
340340
</MixedAssignment>
341+
<MixedReturnStatement>
342+
<code><![CDATA[$this->denormalizer->denormalize($data, $type, $format, $context)]]></code>
343+
</MixedReturnStatement>
341344
<PossiblyUndefinedStringArrayOffset>
342345
<code><![CDATA[$context[LocaleContext::LOCALE]]]></code>
343346
<code><![CDATA[$context[LocaleContext::LOCALE_FALLBACK]]]></code>

rector.php

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
3131
LevelSetList::UP_TO_PHP_82,
3232
PHPUnitSetList::PHPUNIT_90,
33-
PHPUnitSetList::PHPUNIT_91,
3433
PHPUnitSetList::PHPUNIT_100,
3534
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
3635
SymfonySetList::SYMFONY_63,

src/Bridge/Symfony/Command/GenerateCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7373
$style->writeln($request->getUri());
7474

7575
if ($style->isDebug()) {
76-
$style->info(sprintf('Response code: %1d$', $response->getStatusCode()));
77-
$style->info(sprintf('Written to: %1s$', $path));
76+
$style->info(\sprintf('Response code: %1d$', $response->getStatusCode()));
77+
$style->info(\sprintf('Written to: %1s$', $path));
7878
}
7979
});
8080

src/Bridge/Symfony/Command/InitCommand.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6161
$namespace = $input->getOption('namespace');
6262
$namespace = trim($namespace, '\\');
6363

64-
$style->section(sprintf('Namespace: %1$s', $namespace));
64+
$style->section(\sprintf('Namespace: %1$s', $namespace));
6565

66-
$style->writeln(sprintf('Ensuring folder <comment>%1$s</comment>', $this->baseDir.'/src/'));
66+
$style->writeln(\sprintf('Ensuring folder <comment>%1$s</comment>', $this->baseDir.'/src/'));
6767
$filesystem->mkdir($this->baseDir.'/src/');
6868
$composerFile = $this->baseDir.'/composer.json';
69-
$style->writeln(sprintf('Registering namespace <comment>%1$s</comment> in <info>%2$s</info>', $namespace, $composerFile));
69+
$style->writeln(\sprintf('Registering namespace <comment>%1$s</comment> in <info>%2$s</info>', $namespace, $composerFile));
7070
$composer = [];
7171
if (file_exists($composerFile)) {
7272
/** @var string $composer */
@@ -84,10 +84,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8484
]);
8585
file_put_contents($composerFile, json_encode($composer, \JSON_PRETTY_PRINT | \JSON_THROW_ON_ERROR));
8686

87-
$style->writeln(sprintf('Ensuring folder <comment>%1$s</comment>', $this->baseDir.'/config/'));
87+
$style->writeln(\sprintf('Ensuring folder <comment>%1$s</comment>', $this->baseDir.'/config/'));
8888
$filesystem->mkdir($this->baseDir.'/config/');
8989
$servicesFile = $this->baseDir.'/config/services.yaml';
90-
$style->writeln(sprintf('Registering namespace <comment>%1$s</comment> in <info>%2$s</info>', $namespace, $servicesFile));
90+
$style->writeln(\sprintf('Registering namespace <comment>%1$s</comment> in <info>%2$s</info>', $namespace, $servicesFile));
9191
/** @var array $services */
9292
$services = file_exists($servicesFile) ? Yaml::parseFile($servicesFile) : [];
9393
$services = array_replace($services, [
@@ -114,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
114114
continue;
115115
}
116116

117-
$style->section(sprintf('Init: %1$s', ucfirst($sourceDir)));
117+
$style->section(\sprintf('Init: %1$s', ucfirst($sourceDir)));
118118

119119
$finder = new Finder();
120120
$finder

src/Bridge/Symfony/Controller/DefaultController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __invoke(RequestStack $requestStack): Response
3232
}
3333

3434
/** @var string $template */
35-
$template = $request->attributes->get('_template') ?? sprintf('pages/%1$s.html.twig', $route);
35+
$template = $request->attributes->get('_template') ?? \sprintf('pages/%1$s.html.twig', $route);
3636

3737
return $this->render($template, $request->attributes->all());
3838
}

src/Bridge/Symfony/DependencyInjection/CompilerPass/ConfigureDatabasesCompilerPass.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function process(ContainerBuilder $container): void
4545
$type = $tag['type'];
4646

4747
if (isset($supportedStorageTypes[$type])) {
48-
throw new \LogicException(sprintf('Data source type %1$s already provided by %2$s', $type, $reference));
48+
throw new \LogicException(\sprintf('Data source type %1$s already provided by %2$s', $type, $reference));
4949
}
5050

5151
/** @var class-string<StorageWithOptions> $class */
@@ -69,7 +69,7 @@ public function process(ContainerBuilder $container): void
6969
foreach ($configuredDatabases as $name => $database) {
7070
$type = $database['storage'];
7171
if (\array_key_exists($type, $supportedStorageTypes) === false) {
72-
throw new \LogicException(sprintf('Unsupported type "%1$s" at "sigwin_yassg.data_sources.%2$s", allowed values: %3$s', $type, $name, implode(', ', array_keys($supportedStorageTypes))));
72+
throw new \LogicException(\sprintf('Unsupported type "%1$s" at "sigwin_yassg.data_sources.%2$s", allowed values: %3$s', $type, $name, implode(', ', array_keys($supportedStorageTypes))));
7373
}
7474

7575
$databaseClass = ltrim($database['class'], '\\');
@@ -84,23 +84,23 @@ public function process(ContainerBuilder $container): void
8484
try {
8585
$options = $callable($database['options'] ?? []);
8686
} catch (OptionsResolverException $resolverException) {
87-
throw new \LogicException(sprintf('Options issue at "sigwin_yassg.data_sources.%1$s.options": %2$s', $name, $resolverException->getMessage()));
87+
throw new \LogicException(\sprintf('Options issue at "sigwin_yassg.data_sources.%1$s.options": %2$s', $name, $resolverException->getMessage()));
8888
}
8989
foreach ($options as $key => $value) {
9090
$storageDefinition->setArgument('$'.$key, $value);
9191
}
92-
$storageId = sprintf('sigwin_yassg.database.storage.%1$s', $name);
92+
$storageId = \sprintf('sigwin_yassg.database.storage.%1$s', $name);
9393
$container->setDefinition($storageId, $storageDefinition);
9494

9595
$denormalizerDefinition = new Definition(Storage\DenormalizingStorage::class);
9696
$denormalizerDefinition->setDecoratedService($storageId);
9797
$denormalizerDefinition
9898
->setArgument(0, new Reference('serializer'))
99-
->setArgument(1, new Reference(sprintf('sigwin_yassg.database.storage_denormalizer.%1$s.inner', $name)))
99+
->setArgument(1, new Reference(\sprintf('sigwin_yassg.database.storage_denormalizer.%1$s.inner', $name)))
100100
->setArgument(2, $databaseClass)
101101
->setArgument(3, new Reference(\Sigwin\YASSG\Context\LocaleContext::class))
102102
;
103-
$container->setDefinition(sprintf('sigwin_yassg.database.storage_denormalizer.%1$s', $name), $denormalizerDefinition);
103+
$container->setDefinition(\sprintf('sigwin_yassg.database.storage_denormalizer.%1$s', $name), $denormalizerDefinition);
104104

105105
$databaseDefinition = new Definition(MemoryDatabase::class);
106106
$databaseDefinition
@@ -114,9 +114,9 @@ public function process(ContainerBuilder $container): void
114114
->setArgument(3, $database['page_limit'])
115115
->addTag('sigwin_yassg.database', ['name' => $name])
116116
;
117-
$databaseId = sprintf('sigwin_yassg.database.%1$s', $name);
117+
$databaseId = \sprintf('sigwin_yassg.database.%1$s', $name);
118118
$container->setDefinition($databaseId, $databaseDefinition);
119-
$container->setAlias(sprintf('%1$s $%2$s', Database::class, $name), $databaseId);
119+
$container->setAlias(\sprintf('%1$s $%2$s', Database::class, $name), $databaseId);
120120

121121
$cachingDatabaseDefinition = new Definition(Database\CachingDatabase::class);
122122
$cachingDatabaseDefinition
@@ -127,7 +127,7 @@ public function process(ContainerBuilder $container): void
127127
->setAutoconfigured(true)
128128
->setDecoratedService($databaseId)
129129
;
130-
$container->setDefinition(sprintf('sigwin_yassg.database.cached.%1$s', $name), $cachingDatabaseDefinition);
130+
$container->setDefinition(\sprintf('sigwin_yassg.database.cached.%1$s', $name), $cachingDatabaseDefinition);
131131

132132
$localizableProperties = $this->getLocalizableProperties($databaseClass);
133133
if ($localizableProperties !== []) {

src/Bridge/Symfony/ExpressionLanguage/FunctionProvider.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ final class FunctionProvider implements ExpressionFunctionProviderInterface
2222
public function getFunctions(): array
2323
{
2424
return [
25-
new ExpressionFunction('yassg_find_all', static fn (string $name): string => sprintf('$provider->getDatabase(%s)', $name), static function (array $variables, string $name, array $arguments = []) {
25+
new ExpressionFunction('yassg_find_all', static fn (string $name): string => \sprintf('$provider->getDatabase(%s)', $name), static function (array $variables, string $name, array $arguments = []) {
2626
/** @var DatabaseProvider $provider */
2727
$provider = $variables['provider'];
2828

2929
return $provider->getDatabase($name)->findAll(...$arguments);
3030
}),
31-
new ExpressionFunction('yassg_pages', static fn (string $name): string => sprintf('$provider->getDatabase(%s)', $name), static function (array $variables, string $name, ?string $condition = null, ?int $limit = null) {
31+
new ExpressionFunction('yassg_pages', static fn (string $name): string => \sprintf('$provider->getDatabase(%s)', $name), static function (array $variables, string $name, ?string $condition = null, ?int $limit = null) {
3232
/** @var DatabaseProvider $provider */
3333
$provider = $variables['provider'];
3434
$database = $provider->getDatabase($name);
3535
$count = $database->count($condition);
3636

3737
return range(1, ceil($count / ($limit ?? $database->getPageLimit())));
3838
}),
39-
new ExpressionFunction('yassg_get', static fn (string $name): string => sprintf('$provider->getDatabase(%s)', $name), static function (array $variables, string $name, string $id) {
39+
new ExpressionFunction('yassg_get', static fn (string $name): string => \sprintf('$provider->getDatabase(%s)', $name), static function (array $variables, string $name, string $id) {
4040
/** @var DatabaseProvider $provider */
4141
$provider = $variables['provider'];
4242

src/Bridge/Symfony/Routing/Generator/FilenameUrlGenerator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function generate(string $name, array $parameters = [], int $referenceTyp
3737

3838
$url = $this->urlGenerator->generate($name, $parameters, $referenceType);
3939
if (parse_url($url, \PHP_URL_QUERY) !== null) {
40-
throw new \LogicException(sprintf('Query string found while generating route "%1$s", query strings are forbidden: %2$s', $name, $url));
40+
throw new \LogicException(\sprintf('Query string found while generating route "%1$s", query strings are forbidden: %2$s', $name, $url));
4141
}
4242

4343
/** @var bool $indexFile */

src/Bridge/Symfony/Serializer/Normalizer/ExpressionNormalizer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a
3636
* @phpstan-ignore-next-line
3737
*/
3838
if (is_a($value, $type, false) === false) {
39-
throw new \LogicException(sprintf('Invalid value denormalized, %1$s expected, %2$s received', $type, get_debug_type($value)));
39+
throw new \LogicException(\sprintf('Invalid value denormalized, %1$s expected, %2$s received', $type, get_debug_type($value)));
4040
}
4141

4242
return $value;

src/Bridge/Symfony/Serializer/Normalizer/LocalizingNormalizer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a
3636
$fallbackLocale = $context[LocaleContext::LOCALE_FALLBACK];
3737

3838
if (! \is_array($data)) {
39-
throw new \LogicException(sprintf('Localizing normalizer can only work on array input data, %1$s given for %2$s', \gettype($data), $type));
39+
throw new \LogicException(\sprintf('Localizing normalizer can only work on array input data, %1$s given for %2$s', \gettype($data), $type));
4040
}
4141

4242
foreach ($this->classes[$type] as $property) {
@@ -45,7 +45,7 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a
4545
continue;
4646
}
4747

48-
$data[$property] = $data[$property][$locale] ?? $data[$property][$fallbackLocale] ?? throw new \RuntimeException(sprintf('Invalid localized property value %1$s::%2$s', $type, $property));
48+
$data[$property] = $data[$property][$locale] ?? $data[$property][$fallbackLocale] ?? throw new \RuntimeException(\sprintf('Invalid localized property value %1$s::%2$s', $type, $property));
4949
}
5050
}
5151

src/Bridge/Twig/Extension/ThumbnailExtension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public function getFunctions(): array
101101
} else {
102102
$build = (bool) $request->attributes->get('yassg_build', false);
103103
}
104-
$url = sprintf('%1$s/insecure/%2$s%3$s', $this->imgproxyUrl, $filter, $this->encode('local:///'.ltrim($relative, '/')));
104+
$url = \sprintf('%1$s/insecure/%2$s%3$s', $this->imgproxyUrl, $filter, $this->encode('local:///'.ltrim($relative, '/')));
105105
if (! $build) {
106106
return $url;
107107
}
108108

109-
$path = sprintf('%1$s/%2$s.%3$s.webp', \dirname($relative), pathinfo($relative, \PATHINFO_FILENAME), mb_substr(md5(md5_file($path).$filter), 0, 8));
109+
$path = \sprintf('%1$s/%2$s.%3$s.webp', \dirname($relative), pathinfo($relative, \PATHINFO_FILENAME), mb_substr(md5(md5_file($path).$filter), 0, 8));
110110
$this->thumbnailQueue->add(new AssetFetch($url, $path));
111111

112112
return $this->packages->getUrl(ltrim($path, '/'));

src/Database/DatabaseTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private function conditionArrayToString(array $condition): ?string
106106
}
107107

108108
array_walk($condition, static function (float|int|string &$value, string $key): void {
109-
$value = sprintf('%1$s == "%2$s"', $key, $value);
109+
$value = \sprintf('%1$s == "%2$s"', $key, $value);
110110
});
111111

112112
return implode(' AND ', $condition);

src/DatabaseProvider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public function __construct(private ContainerInterface $locator)
2424
public function getDatabase(string $name): Database
2525
{
2626
if ($this->locator->has($name) === false) {
27-
throw new \LogicException(sprintf('No such database "%1$s"', $name));
27+
throw new \LogicException(\sprintf('No such database "%1$s"', $name));
2828
}
2929

3030
$database = $this->locator->get($name);
3131
if ($database instanceof Database === false) {
32-
throw new \LogicException(sprintf('Service "%1$s" is not a database', $name));
32+
throw new \LogicException(\sprintf('Service "%1$s" is not a database', $name));
3333
}
3434

3535
return $database;

src/Decoder/CompositeFileDecoder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{
2020
public function __construct(
2121
/** @var iterable<FileDecoder> */
22-
private iterable $decoders
22+
private iterable $decoders,
2323
) {
2424
}
2525

src/Exception/MoreThanOneResultException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ final class MoreThanOneResultException extends \RuntimeException
1717
{
1818
public static function newSelf(int $count): self
1919
{
20-
return new self(sprintf('One result expected, %1$d found', $count));
20+
return new self(\sprintf('One result expected, %1$d found', $count));
2121
}
2222
}

src/Exception/NoResultException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(?string $condition)
2020
if ($condition === null) {
2121
parent::__construct('No result found');
2222
} else {
23-
parent::__construct(sprintf('No result found for condition "%s"', $condition));
23+
parent::__construct(\sprintf('No result found for condition "%s"', $condition));
2424
}
2525
}
2626
}

src/Exception/UnexpectedAttributeException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ final class UnexpectedAttributeException extends \RuntimeException
1717
{
1818
public static function newSelf(string $id, string $message): self
1919
{
20-
return new self(sprintf('Unexpected attribute for "%1$s", %2$s', $id, $message));
20+
return new self(\sprintf('Unexpected attribute for "%1$s", %2$s', $id, $message));
2121
}
2222
}

src/Generator.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ private function generateSitemapPath(bool $deflate, ?string $name = null, ?int $
111111
return $this->generateUrl('/sitemap.xml'.($deflate ? '.gz' : ''));
112112
}
113113

114-
return $this->generateUrl(sprintf('/sitemap-%1$s-%2$d.xml'.($deflate ? '.gz' : ''), $name, $offset ?? throw new \LogicException('Offset must be set when name is set')));
114+
return $this->generateUrl(\sprintf('/sitemap-%1$s-%2$d.xml'.($deflate ? '.gz' : ''), $name, $offset ?? throw new \LogicException('Offset must be set when name is set')));
115115
}
116116

117117
private function generateUrl(string $path): string
118118
{
119119
$context = $this->urlGenerator->getContext();
120120

121-
return sprintf('%1$s://%2$s%3$s%4$s', $context->getScheme(), $context->getHost(), $context->getBaseUrl(), $path);
121+
return \sprintf('%1$s://%2$s%3$s%4$s', $context->getScheme(), $context->getHost(), $context->getBaseUrl(), $path);
122122
}
123123

124124
/**
@@ -136,7 +136,7 @@ private function dumpRequest(callable $callable, Request $request, int $expected
136136

137137
$statusCode = $response->getStatusCode();
138138
if ($statusCode !== $expectedStatusCode) {
139-
throw new \RuntimeException(sprintf('Invalid response for %1$s, expected %2$d, got %3$d', $request->getUri(), $expectedStatusCode, $statusCode));
139+
throw new \RuntimeException(\sprintf('Invalid response for %1$s, expected %2$d, got %3$d', $request->getUri(), $expectedStatusCode, $statusCode));
140140
}
141141

142142
$body = $response->getContent();

src/Location.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{
1818
public function __construct(
1919
private Route $route,
20-
private BuildOptions $buildOptions
20+
private BuildOptions $buildOptions,
2121
) {
2222
}
2323

0 commit comments

Comments
 (0)