From 4304692164bf31df6f8630fecad7b628e0378ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Thu, 25 Jan 2024 17:31:34 +0100 Subject: [PATCH] bump: Sitemap, Infra (#207) --- composer.json | 4 ++-- src/Asset/AssetCopy.php | 4 +++- src/Asset/AssetFetch.php | 4 +++- src/AssetQueue.php | 4 +++- src/Bridge/Attribute/Localized.php | 4 +++- .../Fragment/RelativeUrlInlineFragmentRenderer.php | 4 +++- .../Symfony/Routing/Generator/FilenameUrlGenerator.php | 4 +++- .../Routing/Generator/GlobalVariableUrlGenerator.php | 4 +++- src/Bridge/Symfony/Routing/Loader/RouteLoader.php | 4 +++- .../Symfony/Serializer/Normalizer/ExpressionNormalizer.php | 4 +++- .../Symfony/Serializer/Normalizer/LocalizingNormalizer.php | 4 +++- .../Serializer/Normalizer/ResourceLocatorNormalizer.php | 4 +++- src/Bridge/Twig/Extension/DatabaseExtension.php | 4 +++- src/Bridge/Twig/Extension/IndexExtension.php | 4 +++- src/Bridge/Twig/Extension/PaginatorExtension.php | 4 +++- src/Bridge/Twig/Extension/ThumbnailExtension.php | 6 ++++-- src/BuildOptions.php | 4 +++- src/Context/LocaleContext.php | 4 +++- src/DatabaseProvider.php | 4 +++- src/Decoder/AssetQueueFileDecoder.php | 4 +++- src/Decoder/CachingFileDecoder.php | 4 +++- src/Decoder/CompositeFileDecoder.php | 3 ++- src/Decoder/MarkdownFileDecoder.php | 4 +++- src/Generator.php | 4 +++- src/Location.php | 3 ++- src/Permutator.php | 4 +++- src/Resource.php | 4 +++- src/Route.php | 3 ++- src/Storage/DenormalizingStorage.php | 4 +++- src/Storage/MemoryStorage.php | 3 ++- .../Symfony/Routing/Generator/FilenameUrlGeneratorTest.php | 2 +- 31 files changed, 87 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index c3eb476..8b2b2dd 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "league/commonmark": "^2.3", "phpdocumentor/type-resolver": "^1.0", "phpstan/phpdoc-parser": "^1.0", - "presta/sitemap-bundle": "^3.0", + "presta/sitemap-bundle": "^4.0", "spatie/commonmark-highlighter": "^3.0", "symfony/console": "^6.4 || ^7.0", "symfony/expression-language": "^6.4 || ^7.0", @@ -32,7 +32,7 @@ }, "require-dev": { "phpunit/phpunit": "^10.1", - "sigwin/infra": "~1.8.0" + "sigwin/infra": "~1.9.0" }, "conflict": { "nikic/php-parser": "< 4.14" diff --git a/src/Asset/AssetCopy.php b/src/Asset/AssetCopy.php index ce6d80d..2bb6463 100644 --- a/src/Asset/AssetCopy.php +++ b/src/Asset/AssetCopy.php @@ -15,5 +15,7 @@ final readonly class AssetCopy { - public function __construct(public string $source, public string $destination) {} + public function __construct(public string $source, public string $destination) + { + } } diff --git a/src/Asset/AssetFetch.php b/src/Asset/AssetFetch.php index f0901ae..b376b5f 100644 --- a/src/Asset/AssetFetch.php +++ b/src/Asset/AssetFetch.php @@ -15,5 +15,7 @@ final readonly class AssetFetch { - public function __construct(public string $url, public string $destination) {} + public function __construct(public string $url, public string $destination) + { + } } diff --git a/src/AssetQueue.php b/src/AssetQueue.php index c10aa02..1e39235 100644 --- a/src/AssetQueue.php +++ b/src/AssetQueue.php @@ -25,7 +25,9 @@ final class AssetQueue */ private array $queue = []; - public function __construct(private string $buildDir, private Filesystem $filesystem, private HttpClientInterface $httpClient) {} + public function __construct(private readonly string $buildDir, private readonly Filesystem $filesystem, private readonly HttpClientInterface $httpClient) + { + } public function add(AssetCopy|AssetFetch $specification): void { diff --git a/src/Bridge/Attribute/Localized.php b/src/Bridge/Attribute/Localized.php index df8d451..a1a68b0 100644 --- a/src/Bridge/Attribute/Localized.php +++ b/src/Bridge/Attribute/Localized.php @@ -14,4 +14,6 @@ namespace Sigwin\YASSG\Bridge\Attribute; #[\Attribute(\Attribute::TARGET_PROPERTY)] -final class Localized {} +final class Localized +{ +} diff --git a/src/Bridge/Symfony/HttpKernel/Fragment/RelativeUrlInlineFragmentRenderer.php b/src/Bridge/Symfony/HttpKernel/Fragment/RelativeUrlInlineFragmentRenderer.php index a094208..ff285ca 100644 --- a/src/Bridge/Symfony/HttpKernel/Fragment/RelativeUrlInlineFragmentRenderer.php +++ b/src/Bridge/Symfony/HttpKernel/Fragment/RelativeUrlInlineFragmentRenderer.php @@ -20,7 +20,9 @@ final readonly class RelativeUrlInlineFragmentRenderer implements FragmentRendererInterface { - public function __construct(private InlineFragmentRenderer $fragmentRenderer, private UrlGeneratorInterface $urlGenerator) {} + public function __construct(private InlineFragmentRenderer $fragmentRenderer, private UrlGeneratorInterface $urlGenerator) + { + } /** * @param array $options diff --git a/src/Bridge/Symfony/Routing/Generator/FilenameUrlGenerator.php b/src/Bridge/Symfony/Routing/Generator/FilenameUrlGenerator.php index 1873eac..d04fbc8 100644 --- a/src/Bridge/Symfony/Routing/Generator/FilenameUrlGenerator.php +++ b/src/Bridge/Symfony/Routing/Generator/FilenameUrlGenerator.php @@ -18,7 +18,9 @@ final class FilenameUrlGenerator implements UrlGeneratorInterface { - public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private array $stripParameters, private array $routes) {} + public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private array $stripParameters, private array $routes) + { + } public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH): string { diff --git a/src/Bridge/Symfony/Routing/Generator/GlobalVariableUrlGenerator.php b/src/Bridge/Symfony/Routing/Generator/GlobalVariableUrlGenerator.php index 5f792e9..0a7582f 100644 --- a/src/Bridge/Symfony/Routing/Generator/GlobalVariableUrlGenerator.php +++ b/src/Bridge/Symfony/Routing/Generator/GlobalVariableUrlGenerator.php @@ -19,7 +19,9 @@ final class GlobalVariableUrlGenerator implements UrlGeneratorInterface { - public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly RequestStack $requestStack, private array $routes) {} + public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly RequestStack $requestStack, private array $routes) + { + } public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH): string { diff --git a/src/Bridge/Symfony/Routing/Loader/RouteLoader.php b/src/Bridge/Symfony/Routing/Loader/RouteLoader.php index b3b5496..085d7de 100644 --- a/src/Bridge/Symfony/Routing/Loader/RouteLoader.php +++ b/src/Bridge/Symfony/Routing/Loader/RouteLoader.php @@ -20,7 +20,9 @@ final readonly class RouteLoader implements RouteLoaderInterface { - public function __construct(private array $routes) {} + public function __construct(private array $routes) + { + } public function __invoke(): RouteCollection { diff --git a/src/Bridge/Symfony/Serializer/Normalizer/ExpressionNormalizer.php b/src/Bridge/Symfony/Serializer/Normalizer/ExpressionNormalizer.php index 92d42a0..34f4b66 100644 --- a/src/Bridge/Symfony/Serializer/Normalizer/ExpressionNormalizer.php +++ b/src/Bridge/Symfony/Serializer/Normalizer/ExpressionNormalizer.php @@ -19,7 +19,9 @@ final readonly class ExpressionNormalizer implements DenormalizerInterface { - public function __construct(private ExpressionLanguage $expressionLanguage, private DatabaseProvider $databaseProvider) {} + public function __construct(private ExpressionLanguage $expressionLanguage, private DatabaseProvider $databaseProvider) + { + } public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): object { diff --git a/src/Bridge/Symfony/Serializer/Normalizer/LocalizingNormalizer.php b/src/Bridge/Symfony/Serializer/Normalizer/LocalizingNormalizer.php index ff0c0a0..b44a961 100644 --- a/src/Bridge/Symfony/Serializer/Normalizer/LocalizingNormalizer.php +++ b/src/Bridge/Symfony/Serializer/Normalizer/LocalizingNormalizer.php @@ -25,7 +25,9 @@ final class LocalizingNormalizer implements DenormalizerAwareInterface, Denormal /** * @param array> $classes */ - public function __construct(private readonly array $classes) {} + public function __construct(private readonly array $classes) + { + } public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { diff --git a/src/Bridge/Symfony/Serializer/Normalizer/ResourceLocatorNormalizer.php b/src/Bridge/Symfony/Serializer/Normalizer/ResourceLocatorNormalizer.php index 59be9d0..aae2ae4 100644 --- a/src/Bridge/Symfony/Serializer/Normalizer/ResourceLocatorNormalizer.php +++ b/src/Bridge/Symfony/Serializer/Normalizer/ResourceLocatorNormalizer.php @@ -19,7 +19,9 @@ final readonly class ResourceLocatorNormalizer implements DenormalizerInterface { - public function __construct(private FileLocatorInterface $locator) {} + public function __construct(private FileLocatorInterface $locator) + { + } /** * @return array|string diff --git a/src/Bridge/Twig/Extension/DatabaseExtension.php b/src/Bridge/Twig/Extension/DatabaseExtension.php index 9e2817c..251e8f0 100644 --- a/src/Bridge/Twig/Extension/DatabaseExtension.php +++ b/src/Bridge/Twig/Extension/DatabaseExtension.php @@ -19,7 +19,9 @@ final class DatabaseExtension extends AbstractExtension { - public function __construct(private readonly DatabaseProvider $provider) {} + public function __construct(private readonly DatabaseProvider $provider) + { + } public function getFunctions(): array { diff --git a/src/Bridge/Twig/Extension/IndexExtension.php b/src/Bridge/Twig/Extension/IndexExtension.php index e415c93..1e3e81e 100644 --- a/src/Bridge/Twig/Extension/IndexExtension.php +++ b/src/Bridge/Twig/Extension/IndexExtension.php @@ -19,7 +19,9 @@ final class IndexExtension extends AbstractExtension { - public function __construct(private readonly Permutator $permutator) {} + public function __construct(private readonly Permutator $permutator) + { + } public function getFunctions(): array { diff --git a/src/Bridge/Twig/Extension/PaginatorExtension.php b/src/Bridge/Twig/Extension/PaginatorExtension.php index d7bde7d..0b679a1 100644 --- a/src/Bridge/Twig/Extension/PaginatorExtension.php +++ b/src/Bridge/Twig/Extension/PaginatorExtension.php @@ -19,7 +19,9 @@ final class PaginatorExtension extends AbstractExtension { - public function __construct(private readonly DatabaseProvider $provider) {} + public function __construct(private readonly DatabaseProvider $provider) + { + } public function getFunctions(): array { diff --git a/src/Bridge/Twig/Extension/ThumbnailExtension.php b/src/Bridge/Twig/Extension/ThumbnailExtension.php index 7b2b0d9..a8a495f 100644 --- a/src/Bridge/Twig/Extension/ThumbnailExtension.php +++ b/src/Bridge/Twig/Extension/ThumbnailExtension.php @@ -22,7 +22,9 @@ final class ThumbnailExtension extends AbstractExtension { - public function __construct(private RequestStack $requestStack, private ?string $imgproxyUrl, private readonly Packages $packages, private readonly AssetQueue $thumbnailQueue) {} + public function __construct(private readonly RequestStack $requestStack, private readonly ?string $imgproxyUrl, private readonly Packages $packages, private readonly AssetQueue $thumbnailQueue) + { + } public function getFunctions(): array { @@ -49,7 +51,7 @@ public function getFunctions(): array } } - $newPath = realpath(\dirname($context['_path']).'/'.$path); + $newPath = realpath(\dirname((string) $context['_path']).'/'.$path); if ($newPath === false) { throw new \RuntimeException('Invalid thumbnail path '.$path); } diff --git a/src/BuildOptions.php b/src/BuildOptions.php index 6719075..6d7d490 100644 --- a/src/BuildOptions.php +++ b/src/BuildOptions.php @@ -15,7 +15,9 @@ final readonly class BuildOptions { - public function __construct(private ?array $requestHeaders) {} + public function __construct(private ?array $requestHeaders) + { + } public function getRequestHeaders(): ?array { diff --git a/src/Context/LocaleContext.php b/src/Context/LocaleContext.php index c731326..4e9da03 100644 --- a/src/Context/LocaleContext.php +++ b/src/Context/LocaleContext.php @@ -24,7 +24,9 @@ public const LOCALE = 'sigwin_locale'; public const LOCALE_FALLBACK = 'sigwin_locale_fallback'; - public function __construct(private RequestStack $requestStack, private TranslatorInterface $translator) {} + public function __construct(private RequestStack $requestStack, private TranslatorInterface $translator) + { + } public function getLocale(): array { diff --git a/src/DatabaseProvider.php b/src/DatabaseProvider.php index 7160470..1096242 100644 --- a/src/DatabaseProvider.php +++ b/src/DatabaseProvider.php @@ -17,7 +17,9 @@ final readonly class DatabaseProvider { - public function __construct(private ContainerInterface $locator) {} + public function __construct(private ContainerInterface $locator) + { + } public function getDatabase(string $name): Database { diff --git a/src/Decoder/AssetQueueFileDecoder.php b/src/Decoder/AssetQueueFileDecoder.php index 98533da..f8ac3f2 100644 --- a/src/Decoder/AssetQueueFileDecoder.php +++ b/src/Decoder/AssetQueueFileDecoder.php @@ -20,7 +20,9 @@ final readonly class AssetQueueFileDecoder implements FileDecoder { - public function __construct(private FileDecoder $decoder, private AssetQueue $queue) {} + public function __construct(private FileDecoder $decoder, private AssetQueue $queue) + { + } public function supports(\SplFileInfo $file): bool { diff --git a/src/Decoder/CachingFileDecoder.php b/src/Decoder/CachingFileDecoder.php index b234f62..b6da7c9 100644 --- a/src/Decoder/CachingFileDecoder.php +++ b/src/Decoder/CachingFileDecoder.php @@ -18,7 +18,9 @@ final readonly class CachingFileDecoder implements FileDecoder { - public function __construct(private FileDecoder $decoder, private CacheItemPoolInterface $cachePoolItem) {} + public function __construct(private FileDecoder $decoder, private CacheItemPoolInterface $cachePoolItem) + { + } public function supports(\SplFileInfo $file): bool { diff --git a/src/Decoder/CompositeFileDecoder.php b/src/Decoder/CompositeFileDecoder.php index 519c8a3..3e55887 100644 --- a/src/Decoder/CompositeFileDecoder.php +++ b/src/Decoder/CompositeFileDecoder.php @@ -20,7 +20,8 @@ public function __construct( /** @var iterable */ private iterable $decoders - ) {} + ) { + } public function supports(\SplFileInfo $file): bool { diff --git a/src/Decoder/MarkdownFileDecoder.php b/src/Decoder/MarkdownFileDecoder.php index cba53c2..1f40ba5 100644 --- a/src/Decoder/MarkdownFileDecoder.php +++ b/src/Decoder/MarkdownFileDecoder.php @@ -27,7 +27,9 @@ private const EXTENSIONS = ['md', 'markdown']; - public function __construct(private ConverterInterface $converter, private Environment $twig, private AssetQueue $assetQueue) {} + public function __construct(private ConverterInterface $converter, private Environment $twig, private AssetQueue $assetQueue) + { + } public function decode(\SplFileInfo $file): array { diff --git a/src/Generator.php b/src/Generator.php index 915bcb4..e35e76d 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -30,7 +30,9 @@ */ final readonly class Generator { - public function __construct(private string $buildDir, private Permutator $permutator, private UrlGeneratorInterface $urlGenerator, private KernelInterface $kernel, private Filesystem $filesystem, private AssetQueue $thumbnailQueue) {} + public function __construct(private string $buildDir, private Permutator $permutator, private UrlGeneratorInterface $urlGenerator, private KernelInterface $kernel, private Filesystem $filesystem, private AssetQueue $thumbnailQueue) + { + } /** * @param callable(Request, Response, string): void $callable diff --git a/src/Location.php b/src/Location.php index 5463a73..0bb6fd1 100644 --- a/src/Location.php +++ b/src/Location.php @@ -18,7 +18,8 @@ public function __construct( private Route $route, private BuildOptions $buildOptions - ) {} + ) { + } public function getRoute(): Route { diff --git a/src/Permutator.php b/src/Permutator.php index fa8a5b0..34ec08f 100644 --- a/src/Permutator.php +++ b/src/Permutator.php @@ -19,7 +19,9 @@ final readonly class Permutator { - public function __construct(private array $routes, private DatabaseProvider $provider, private ExpressionLanguage $expressionLanguage) {} + public function __construct(private array $routes, private DatabaseProvider $provider, private ExpressionLanguage $expressionLanguage) + { + } /** * @return \Traversable diff --git a/src/Resource.php b/src/Resource.php index c0145e3..e726429 100644 --- a/src/Resource.php +++ b/src/Resource.php @@ -13,4 +13,6 @@ namespace Sigwin\YASSG; -interface Resource extends \Stringable {} +interface Resource extends \Stringable +{ +} diff --git a/src/Route.php b/src/Route.php index e13f690..dddfab0 100644 --- a/src/Route.php +++ b/src/Route.php @@ -18,7 +18,8 @@ public function __construct( private string $name, private array $parameters, - ) {} + ) { + } public function getName(): string { diff --git a/src/Storage/DenormalizingStorage.php b/src/Storage/DenormalizingStorage.php index 86d798c..40b3c02 100644 --- a/src/Storage/DenormalizingStorage.php +++ b/src/Storage/DenormalizingStorage.php @@ -34,7 +34,9 @@ final class DenormalizingStorage implements Storage * @param Storage $storage * @param class-string $class */ - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Storage $storage, private readonly string $class, private readonly LocaleContext $context) {} + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Storage $storage, private readonly string $class, private readonly LocaleContext $context) + { + } /** * @return iterable diff --git a/src/Storage/MemoryStorage.php b/src/Storage/MemoryStorage.php index 5865f1d..2ce1108 100644 --- a/src/Storage/MemoryStorage.php +++ b/src/Storage/MemoryStorage.php @@ -28,7 +28,8 @@ public function __construct( * @var array */ private array $values - ) {} + ) { + } public static function resolveOptions(array $options): array { diff --git a/tests/functional/site/src/Bridge/Symfony/Routing/Generator/FilenameUrlGeneratorTest.php b/tests/functional/site/src/Bridge/Symfony/Routing/Generator/FilenameUrlGeneratorTest.php index 8c7a306..be10fb8 100644 --- a/tests/functional/site/src/Bridge/Symfony/Routing/Generator/FilenameUrlGeneratorTest.php +++ b/tests/functional/site/src/Bridge/Symfony/Routing/Generator/FilenameUrlGeneratorTest.php @@ -25,7 +25,7 @@ * @small */ #[\PHPUnit\Framework\Attributes\Small] -#[\PHPUnit\Framework\Attributes\CoversClass(\Sigwin\YASSG\Bridge\Symfony\Routing\Generator\FilenameUrlGenerator::class)] +#[\PHPUnit\Framework\Attributes\CoversClass(FilenameUrlGenerator::class)] final class FilenameUrlGeneratorTest extends TestCase { public function testCannotGenerateUnknownRoute(): void