Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump: Sitemap, Infra #207

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/Asset/AssetCopy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
}
4 changes: 3 additions & 1 deletion src/Asset/AssetFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
}
4 changes: 3 additions & 1 deletion src/AssetQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 3 additions & 1 deletion src/Bridge/Attribute/Localized.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@
namespace Sigwin\YASSG\Bridge\Attribute;

#[\Attribute(\Attribute::TARGET_PROPERTY)]
final class Localized {}
final class Localized
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<array-key, mixed> $options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 3 additions & 1 deletion src/Bridge/Symfony/Routing/Loader/RouteLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ final class LocalizingNormalizer implements DenormalizerAwareInterface, Denormal
/**
* @param array<class-string, list<string>> $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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>|string
Expand Down
4 changes: 3 additions & 1 deletion src/Bridge/Twig/Extension/DatabaseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 3 additions & 1 deletion src/Bridge/Twig/Extension/IndexExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 3 additions & 1 deletion src/Bridge/Twig/Extension/PaginatorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 4 additions & 2 deletions src/Bridge/Twig/Extension/ThumbnailExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion src/BuildOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

final readonly class BuildOptions
{
public function __construct(private ?array $requestHeaders) {}
public function __construct(private ?array $requestHeaders)
{
}

public function getRequestHeaders(): ?array
{
Expand Down
4 changes: 3 additions & 1 deletion src/Context/LocaleContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 3 additions & 1 deletion src/DatabaseProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 3 additions & 1 deletion src/Decoder/AssetQueueFileDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 3 additions & 1 deletion src/Decoder/CachingFileDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion src/Decoder/CompositeFileDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
public function __construct(
/** @var iterable<FileDecoder> */
private iterable $decoders
) {}
) {
}

public function supports(\SplFileInfo $file): bool
{
Expand Down
4 changes: 3 additions & 1 deletion src/Decoder/MarkdownFileDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 3 additions & 1 deletion src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
public function __construct(
private Route $route,
private BuildOptions $buildOptions
) {}
) {
}

public function getRoute(): Route
{
Expand Down
4 changes: 3 additions & 1 deletion src/Permutator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<Location>
Expand Down
4 changes: 3 additions & 1 deletion src/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@

namespace Sigwin\YASSG;

interface Resource extends \Stringable {}
interface Resource extends \Stringable
{
}
3 changes: 2 additions & 1 deletion src/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
public function __construct(
private string $name,
private array $parameters,
) {}
) {
}

public function getName(): string
{
Expand Down
4 changes: 3 additions & 1 deletion src/Storage/DenormalizingStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ final class DenormalizingStorage implements Storage
* @param Storage<T> $storage
* @param class-string<T> $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<string, T>
Expand Down
3 changes: 2 additions & 1 deletion src/Storage/MemoryStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function __construct(
* @var array<string, array>
*/
private array $values
) {}
) {
}

public static function resolveOptions(array $options): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading