From 65c2a879716decc6553a60b1d4782041261db942 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Sat, 8 Jun 2024 09:54:28 +0200 Subject: [PATCH 1/7] Update method return types and yield statements (#218) The methods' return types have been updated from iterable to iterable in several files, namely FaviconsCompiler.php, ManifestCompiler.php, FileCompilerInterface.php, and ServiceWorkerCompiler.php. Moreover, yield statements have been modified to yield a pair of string (URL) and Data instead of just Data to enhance data identification and access. --- src/Service/FaviconsCompiler.php | 19 ++++++++++--------- src/Service/FileCompilerInterface.php | 2 +- src/Service/ManifestCompiler.php | 8 +++++--- src/Service/ServiceWorkerCompiler.php | 9 +++++---- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/Service/FaviconsCompiler.php b/src/Service/FaviconsCompiler.php index b5c4e10..6c2dbbb 100644 --- a/src/Service/FaviconsCompiler.php +++ b/src/Service/FaviconsCompiler.php @@ -32,7 +32,7 @@ public function __construct( } /** - * @return iterable + * @return iterable */ public function getFiles(): iterable { @@ -234,14 +234,15 @@ public function getFiles(): iterable ); $completeHash = hash('xxh128', $hash . $configuration); $filename = sprintf($size['url'], $size['width'], $size['height'], $completeHash); - yield $this->processIcon($asset, $filename, $configuration, $size['mimetype'], $size['rel']); + yield $filename => $this->processIcon($asset, $filename, $configuration, $size['mimetype'], $size['rel']); } if ($this->favicons->tileColor !== null) { $this->logger->debug('Creating browserconfig.xml.'); yield from $this->processBrowserConfig($asset, $hash); } if ($this->favicons->safariPinnedTabColor !== null && $this->favicons->useSilhouette === true) { - yield $this->generateSafariPinnedTab($asset, $hash); + $safariPinnedTab = $this->generateSafariPinnedTab($asset, $hash); + yield $safariPinnedTab->url => $safariPinnedTab; } $this->logger->debug('Favicons created.'); } @@ -400,17 +401,17 @@ private function processBrowserConfig(string $asset, string $hash): array ); return [ - $icon70x70, - $icon150x150, - $icon310x310, - $icon310x150, - Data::create( + $icon70x70->url => $icon70x70, + $icon150x150->url => $icon150x150, + $icon310x310->url => $icon310x310, + $icon310x150->url => $icon310x150, + $icon144x144->url => Data::create( $icon144x144->url, $icon144x144->getRawData(), $icon144x144->headers, sprintf('', $icon144x144->url) ), - $browserConfig, + $browserConfig->url => $browserConfig, ]; } diff --git a/src/Service/FileCompilerInterface.php b/src/Service/FileCompilerInterface.php index a119a53..bd88c1b 100644 --- a/src/Service/FileCompilerInterface.php +++ b/src/Service/FileCompilerInterface.php @@ -7,7 +7,7 @@ interface FileCompilerInterface { /** - * @return iterable + * @return iterable */ public function getFiles(): iterable; } diff --git a/src/Service/ManifestCompiler.php b/src/Service/ManifestCompiler.php index 021e903..6cb56d2 100644 --- a/src/Service/ManifestCompiler.php +++ b/src/Service/ManifestCompiler.php @@ -66,7 +66,7 @@ public function __construct( } /** - * @return iterable + * @return iterable */ public function getFiles(): iterable { @@ -81,13 +81,15 @@ public function getFiles(): iterable } if ($this->locales === []) { $this->logger->debug('No locale defined. Compiling default manifest.'); - yield $this->compileManifest(null); + $manifest = $this->compileManifest(null); + yield $manifest->url => $manifest; } foreach ($this->locales as $locale) { $this->logger->debug('Compiling manifest for locale.', [ 'locale' => $locale, ]); - yield $this->compileManifest($locale); + $manifest = $this->compileManifest($locale); + yield $manifest->url => $manifest; } $this->logger->debug('Manifest files compiled.'); } diff --git a/src/Service/ServiceWorkerCompiler.php b/src/Service/ServiceWorkerCompiler.php index 9ffacb2..1509872 100644 --- a/src/Service/ServiceWorkerCompiler.php +++ b/src/Service/ServiceWorkerCompiler.php @@ -53,11 +53,12 @@ public function __construct( } /** - * @return iterable + * @return iterable */ public function getFiles(): iterable { - yield $this->compileSW(); + $sw = $this->compileSW(); + yield $sw->url => $sw; yield from $this->getWorkboxFiles(); } @@ -118,7 +119,7 @@ private function includeRootSW(): string } /** - * @return iterable + * @return iterable */ private function getWorkboxFiles(): iterable { @@ -150,7 +151,7 @@ private function getWorkboxFiles(): iterable if ($data === null) { continue; } - yield $data; + yield $data->url => $data; } } From a7d00cab4f6c705f3d736a70604c2b10f27dee8b Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Sat, 13 Jul 2024 09:03:20 +0200 Subject: [PATCH 2/7] Replace TaggedIterator with AutowireIterator across multiple files (#222) * Replace TaggedIterator with AutowireIterator across multiple files The commit switches the usage from TaggedIterator to AutowireIterator to better manage dependencies within the application. This affects multiple classes in src directory involving spomky_labs_pwa cache strategy, match callback handlers, and other related dependencies. The change enhances dependency handling and supports cleaner code injection. --- composer.json | 9 +-- phpstan-baseline.neon | 62 +++++-------------- src/CachingStrategy/BackgroundSync.php | 4 +- .../PreloadUrlsGeneratorManager.php | 4 +- src/CachingStrategy/ResourceCaches.php | 4 +- src/Command/ListCacheStrategiesCommand.php | 4 +- src/DataCollector/PwaCollector.php | 4 +- src/Service/ServiceWorkerCompiler.php | 4 +- .../AppendCacheStrategies.php | 4 +- src/Subscriber/FileCompileEventListener.php | 4 +- src/Subscriber/PwaDevServerSubscriber.php | 4 +- tests/config.php | 3 + 12 files changed, 42 insertions(+), 68 deletions(-) diff --git a/composer.json b/composer.json index cdacc0b..966f004 100644 --- a/composer.json +++ b/composer.json @@ -34,6 +34,7 @@ "php": ">=8.2", "phpdocumentor/reflection-docblock": "^5.3", "psr/log": "^1.0|^2.0|^3.0", + "symfony/asset": "^6.4|^7.0", "symfony/asset-mapper": "^6.4|^7.0", "symfony/config": "^6.4|^7.0", "symfony/dependency-injection": "^6.4|^7.0", @@ -58,13 +59,13 @@ "phpstan/phpstan": "^1.0", "phpstan/phpstan-beberlei-assert": "^1.0", "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.3", + "phpstan/phpstan-phpunit": "^1.4", "phpstan/phpstan-strict-rules": "^1.0", - "phpstan/phpstan-symfony": "^1.3", + "phpstan/phpstan-symfony": "^1.4", "phpunit/phpunit": "^10.1|^11.0", "rector/rector": "^1.0", - "staabm/phpstan-todo-by": "^0.1.25", - "struggle-for-php/sfp-phpstan-psr-log": "^0.20.0 || ^0.21.0", + "staabm/phpstan-todo-by": "^0.1.27", + "struggle-for-php/sfp-phpstan-psr-log": "^0.21.0", "symfony/filesystem": "^6.4|^7.0", "symfony/framework-bundle": "^6.4|^7.0", "symfony/mime": "^6.4|^7.0", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 27b867b..ed22a48 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -20,11 +20,6 @@ parameters: count: 1 path: src/CachingStrategy/AssetCache.php - - - message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#" - count: 1 - path: src/CachingStrategy/BackgroundSync.php - - message: "#^Only iterables can be unpacked, mixed given in argument \\#1\\.$#" count: 1 @@ -40,16 +35,6 @@ parameters: count: 2 path: src/CachingStrategy/FontCache.php - - - message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#" - count: 1 - path: src/CachingStrategy/PreloadUrlsGeneratorManager.php - - - - message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#" - count: 1 - path: src/CachingStrategy/ResourceCaches.php - - message: "#^Only iterables can be unpacked, mixed given in argument \\#1\\.$#" count: 1 @@ -135,16 +120,6 @@ parameters: count: 1 path: src/Command/CreateScreenshotCommand.php - - - message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#" - count: 1 - path: src/Command/ListCacheStrategiesCommand.php - - - - message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#" - count: 1 - path: src/DataCollector/PwaCollector.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\BackgroundSync has an uninitialized property \\$forceSyncFallback\\. Give it default value or assign it in the constructor\\.$#" count: 1 @@ -430,6 +405,21 @@ parameters: count: 1 path: src/ImageProcessor/GDImageProcessor.php + - + message: "#^Parameter \\#2 \\$red of function imagecolorallocate expects int\\<0, 255\\>, int given\\.$#" + count: 1 + path: src/ImageProcessor/GDImageProcessor.php + + - + message: "#^Parameter \\#3 \\$green of function imagecolorallocate expects int\\<0, 255\\>, int given\\.$#" + count: 1 + path: src/ImageProcessor/GDImageProcessor.php + + - + message: "#^Parameter \\#4 \\$blue of function imagecolorallocate expects int\\<0, 255\\>, int given\\.$#" + count: 1 + path: src/ImageProcessor/GDImageProcessor.php + - message: "#^Should not use node with type \"Stmt_Echo\", please change the code\\.$#" count: 3 @@ -605,16 +595,6 @@ parameters: count: 1 path: src/Service/FaviconsCompiler.php - - - message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#" - count: 1 - path: src/Service/ServiceWorkerCompiler.php - - - - message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#" - count: 1 - path: src/ServiceWorkerRule/AppendCacheStrategies.php - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" count: 1 @@ -628,14 +608,4 @@ parameters: - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\SpomkyLabsPwaBundle\\:\\:loadExtension\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" count: 1 - path: src/SpomkyLabsPwaBundle.php - - - - message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#" - count: 1 - path: src/Subscriber/FileCompileEventListener.php - - - - message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#" - count: 1 - path: src/Subscriber/PwaDevServerSubscriber.php \ No newline at end of file + path: src/SpomkyLabsPwaBundle.php \ No newline at end of file diff --git a/src/CachingStrategy/BackgroundSync.php b/src/CachingStrategy/BackgroundSync.php index a62ae84..0f03da0 100644 --- a/src/CachingStrategy/BackgroundSync.php +++ b/src/CachingStrategy/BackgroundSync.php @@ -11,7 +11,7 @@ use SpomkyLabs\PwaBundle\MatchCallbackHandler\MatchCallbackHandlerInterface; use SpomkyLabs\PwaBundle\Service\CanLogInterface; use SpomkyLabs\PwaBundle\WorkboxPlugin\BackgroundSyncPlugin; -use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; +use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; final class BackgroundSync implements HasCacheStrategiesInterface, CanLogInterface { @@ -24,7 +24,7 @@ final class BackgroundSync implements HasCacheStrategiesInterface, CanLogInterfa */ public function __construct( ServiceWorker $serviceWorker, - #[TaggedIterator('spomky_labs_pwa.match_callback_handler')] + #[AutowireIterator('spomky_labs_pwa.match_callback_handler')] private readonly iterable $matchCallbackHandlers, ) { $this->workbox = $serviceWorker->workbox; diff --git a/src/CachingStrategy/PreloadUrlsGeneratorManager.php b/src/CachingStrategy/PreloadUrlsGeneratorManager.php index c9ac49c..1842277 100644 --- a/src/CachingStrategy/PreloadUrlsGeneratorManager.php +++ b/src/CachingStrategy/PreloadUrlsGeneratorManager.php @@ -8,7 +8,7 @@ use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use SpomkyLabs\PwaBundle\Service\CanLogInterface; -use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; +use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use function array_key_exists; final class PreloadUrlsGeneratorManager implements CanLogInterface @@ -24,7 +24,7 @@ final class PreloadUrlsGeneratorManager implements CanLogInterface * @param PreloadUrlsGeneratorInterface[] $generators */ public function __construct( - #[TaggedIterator('spomky_labs_pwa.preload_urls_generator')] + #[AutowireIterator('spomky_labs_pwa.preload_urls_generator')] iterable $generators ) { $this->logger = new NullLogger(); diff --git a/src/CachingStrategy/ResourceCaches.php b/src/CachingStrategy/ResourceCaches.php index 9dc0b9b..9a88fb5 100644 --- a/src/CachingStrategy/ResourceCaches.php +++ b/src/CachingStrategy/ResourceCaches.php @@ -16,7 +16,7 @@ use SpomkyLabs\PwaBundle\WorkboxPlugin\ExpirationPlugin; use SpomkyLabs\PwaBundle\WorkboxPlugin\RangeRequestsPlugin; use Symfony\Component\DependencyInjection\Attribute\Autowire; -use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; +use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use Symfony\Component\Serializer\Encoder\JsonEncode; use Symfony\Component\Serializer\SerializerInterface; use function count; @@ -40,7 +40,7 @@ public function __construct( private readonly PreloadUrlsGeneratorManager $preloadUrlsGeneratorManager, ServiceWorker $serviceWorker, private readonly SerializerInterface $serializer, - #[TaggedIterator('spomky_labs_pwa.match_callback_handler')] + #[AutowireIterator('spomky_labs_pwa.match_callback_handler')] private readonly iterable $matchCallbackHandlers, #[Autowire('%kernel.debug%')] bool $debug, diff --git a/src/Command/ListCacheStrategiesCommand.php b/src/Command/ListCacheStrategiesCommand.php index ba0d1b1..5bebe2a 100644 --- a/src/Command/ListCacheStrategiesCommand.php +++ b/src/Command/ListCacheStrategiesCommand.php @@ -14,7 +14,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; +use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use Symfony\Component\Yaml\Yaml; use function count; @@ -25,7 +25,7 @@ final class ListCacheStrategiesCommand extends Command * @param iterable $services */ public function __construct( - #[TaggedIterator('spomky_labs_pwa.cache_strategy')] + #[AutowireIterator('spomky_labs_pwa.cache_strategy')] private readonly iterable $services, ) { parent::__construct(); diff --git a/src/DataCollector/PwaCollector.php b/src/DataCollector/PwaCollector.php index 0fb7862..7efa1e9 100644 --- a/src/DataCollector/PwaCollector.php +++ b/src/DataCollector/PwaCollector.php @@ -13,7 +13,7 @@ use SpomkyLabs\PwaBundle\Service\FaviconsCompiler; use SpomkyLabs\PwaBundle\Service\ManifestCompiler; use SpomkyLabs\PwaBundle\Service\ServiceWorkerCompiler; -use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; +use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\DataCollector; @@ -37,7 +37,7 @@ final class PwaCollector extends DataCollector */ public function __construct( private readonly SerializerInterface $serializer, - #[TaggedIterator('spomky_labs_pwa.cache_strategy')] + #[AutowireIterator('spomky_labs_pwa.cache_strategy')] private readonly iterable $cachingServices, private readonly Manifest $manifest, private readonly ServiceWorker $serviceWorker, diff --git a/src/Service/ServiceWorkerCompiler.php b/src/Service/ServiceWorkerCompiler.php index 1509872..9165214 100644 --- a/src/Service/ServiceWorkerCompiler.php +++ b/src/Service/ServiceWorkerCompiler.php @@ -11,7 +11,7 @@ use Symfony\Component\AssetMapper\AssetMapperInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Attribute\Autowire; -use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; +use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use function assert; use function count; use function in_array; @@ -34,7 +34,7 @@ final class ServiceWorkerCompiler implements FileCompilerInterface, CanLogInterf public function __construct( private readonly ServiceWorker $serviceWorker, private readonly AssetMapperInterface $assetMapper, - #[TaggedIterator('spomky_labs_pwa.service_worker_rule', defaultPriorityMethod: 'getPriority')] + #[AutowireIterator('spomky_labs_pwa.service_worker_rule', defaultPriorityMethod: 'getPriority')] private readonly iterable $serviceworkerRules, #[Autowire('%kernel.debug%')] public readonly bool $debug, diff --git a/src/ServiceWorkerRule/AppendCacheStrategies.php b/src/ServiceWorkerRule/AppendCacheStrategies.php index 083495e..b895b69 100644 --- a/src/ServiceWorkerRule/AppendCacheStrategies.php +++ b/src/ServiceWorkerRule/AppendCacheStrategies.php @@ -6,7 +6,7 @@ use SpomkyLabs\PwaBundle\CachingStrategy\HasCacheStrategiesInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; -use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; +use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use const PHP_EOL; final readonly class AppendCacheStrategies implements ServiceWorkerRuleInterface @@ -15,7 +15,7 @@ * @param iterable $cacheStrategies */ public function __construct( - #[TaggedIterator('spomky_labs_pwa.cache_strategy')] + #[AutowireIterator('spomky_labs_pwa.cache_strategy')] private iterable $cacheStrategies, #[Autowire('%kernel.debug%')] public bool $debug, diff --git a/src/Subscriber/FileCompileEventListener.php b/src/Subscriber/FileCompileEventListener.php index b00d8d2..cc6fa7f 100644 --- a/src/Subscriber/FileCompileEventListener.php +++ b/src/Subscriber/FileCompileEventListener.php @@ -11,7 +11,7 @@ use Symfony\Component\AssetMapper\Event\PreAssetsCompileEvent; use Symfony\Component\AssetMapper\Path\PublicAssetsFilesystemInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; -use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; +use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use Symfony\Component\EventDispatcher\Attribute\AsEventListener; #[AsEventListener(PreAssetsCompileEvent::class)] @@ -23,7 +23,7 @@ final class FileCompileEventListener implements CanLogInterface * @param iterable $fileCompilers */ public function __construct( - #[TaggedIterator('spomky_labs_pwa.compiler')] + #[AutowireIterator('spomky_labs_pwa.compiler')] private readonly iterable $fileCompilers, #[Autowire('@asset_mapper.local_public_assets_filesystem')] private readonly PublicAssetsFilesystemInterface $assetsFilesystem, diff --git a/src/Subscriber/PwaDevServerSubscriber.php b/src/Subscriber/PwaDevServerSubscriber.php index 2d13250..b1c0735 100644 --- a/src/Subscriber/PwaDevServerSubscriber.php +++ b/src/Subscriber/PwaDevServerSubscriber.php @@ -9,7 +9,7 @@ use SpomkyLabs\PwaBundle\Service\CanLogInterface; use SpomkyLabs\PwaBundle\Service\Data; use SpomkyLabs\PwaBundle\Service\FileCompilerInterface; -use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; +use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\RequestEvent; @@ -25,7 +25,7 @@ final class PwaDevServerSubscriber implements EventSubscriberInterface, CanLogIn * @param iterable $fileCompilers */ public function __construct( - #[TaggedIterator('spomky_labs_pwa.compiler')] + #[AutowireIterator('spomky_labs_pwa.compiler')] private readonly iterable $fileCompilers, private readonly null|Profiler $profiler, ) { diff --git a/tests/config.php b/tests/config.php index c19a04b..dca9a04 100644 --- a/tests/config.php +++ b/tests/config.php @@ -28,6 +28,9 @@ 'secret' => 'test', 'http_method_override' => true, 'handle_all_throwables' => true, + 'assets' => [ + 'enabled' => true, + ], 'session' => [ 'storage_factory_id' => 'session.storage.factory.mock_file', 'cookie_secure' => 'auto', From a699a9e59655c918004a9ec9dba8272971f25538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Roman=C3=AD?= Date: Fri, 9 Aug 2024 18:34:38 +0200 Subject: [PATCH 3/7] fix issue #230 (#231) --- src/CachingStrategy/AssetCache.php | 2 +- src/CachingStrategy/FontCache.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CachingStrategy/AssetCache.php b/src/CachingStrategy/AssetCache.php index c4dc039..5d3d576 100644 --- a/src/CachingStrategy/AssetCache.php +++ b/src/CachingStrategy/AssetCache.php @@ -93,7 +93,7 @@ private function getAssets(): array { $assets = []; foreach ($this->assetMapper->allAssets() as $asset) { - if (preg_match($this->workbox->assetCache->regex, $asset->sourcePath) === 1) { + if (preg_match($this->workbox->assetCache->regex, $asset->publicPath) === 1) { $assets[] = $asset->publicPath; } } diff --git a/src/CachingStrategy/FontCache.php b/src/CachingStrategy/FontCache.php index 827f96f..cf4f438 100644 --- a/src/CachingStrategy/FontCache.php +++ b/src/CachingStrategy/FontCache.php @@ -90,7 +90,7 @@ private function getFonts(): array { $fonts = []; foreach ($this->assetMapper->allAssets() as $asset) { - if (preg_match($this->workbox->fontCache->regex, $asset->sourcePath) === 1) { + if (preg_match($this->workbox->fontCache->regex, $asset->publicPath) === 1) { $fonts[] = $asset->publicPath; } } From c24711ea8428d14a01132d9e42cb17d84218a1ee Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Mon, 16 Dec 2024 09:02:21 +0100 Subject: [PATCH 4/7] Refactor normalization methods for consistency and clarity. (#257) * Refactor normalization methods for consistency and clarity. Updated method parameter names from `$object` to `$data` across multiple normalizers to align with coding standards. Improved nullable type hints and applied minor cleanups for better readability and maintainability. * Update dependencies and clean up PHPStan baseline Add support for newer versions of development dependencies in `composer.json` by updating version constraints. Remove resolved deprecation issues from the PHPStan baseline to maintain a cleaner codebase. * Update test assertions and refine PHPStan configurations Updated file path assertions in `CompileCommandTest` to align with new screenshot file naming conventions. Enhanced PHPStan configuration by adding banned code settings, adjusting indentation, and significantly expanding the baseline for ignored errors. * Refactor CompileCommandTest and update PHPStan configurations Remove redundant assertions in CompileCommandTest for improved clarity and tweak PHPStan to allow ignorable banned code. Added new rules to PHPStan baseline for managing specific edge cases in code analysis. --- .github/workflows/integrate.yml | 1 + composer.json | 24 +- phpstan-baseline.neon | 1032 +++++++++++++++-- phpstan.neon | 26 +- src/CachingStrategy/AssetCache.php | 1 + src/CachingStrategy/ImageCache.php | 1 + src/CachingStrategy/ManifestCache.php | 1 + .../PreloadUrlsGeneratorManager.php | 1 + src/CachingStrategy/ResourceCaches.php | 1 + src/CachingStrategy/WorkboxCacheStrategy.php | 1 + src/Command/CreateIconsCommand.php | 1 + src/Command/CreateScreenshotCommand.php | 1 + src/CompilerPass/PreloadUrlCompilerPass.php | 1 + src/DataCollector/PwaCollector.php | 2 +- src/ImageProcessor/Configuration.php | 1 + src/ImageProcessor/GDImageProcessor.php | 9 +- .../DestinationMatchCallbackHandler.php | 1 + .../ExactPathnameMatchCallbackHandler.php | 1 + .../OriginMatchCallbackHandler.php | 1 + .../PathnameEndsWithMatchCallbackHandler.php | 1 + ...PathnameStartsWithMatchCallbackHandler.php | 1 + .../RouteMatchCallbackHandler.php | 1 + src/Normalizer/AssetNormalizer.php | 16 +- src/Normalizer/IconNormalizer.php | 21 +- src/Normalizer/ScreenshotNormalizer.php | 21 +- src/Normalizer/ServiceWorkerNormalizer.php | 12 +- src/Normalizer/UrlNormalizer.php | 16 +- src/Service/FaviconsCompiler.php | 1 + src/Service/ServiceWorkerCompiler.php | 1 + .../AppendCacheStrategies.php | 1 + src/Subscriber/PwaDevServerSubscriber.php | 2 +- src/Twig/PwaRuntime.php | 1 + src/WorkboxPlugin/BroadcastUpdatePlugin.php | 2 + src/WorkboxPlugin/CacheableResponsePlugin.php | 2 + src/WorkboxPlugin/ExpirationPlugin.php | 2 + tests/Functional/AbstractPwaTestCase.php | 1 + tests/Functional/CompileCommandTest.php | 14 +- tests/Functional/GenerateIconsCommandTest.php | 1 + .../Functional/TakeScreenshotCommandTest.php | 1 + tests/TestFilesystem.php | 1 + 40 files changed, 1022 insertions(+), 204 deletions(-) diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index 499a5d3..dcef2e8 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -70,6 +70,7 @@ jobs: php-version: - "8.2" - "8.3" + - "8.4" dependencies: - "highest" runs-on: ${{ matrix.operating-system }} diff --git a/composer.json b/composer.json index 966f004..d2c7326 100644 --- a/composer.json +++ b/composer.json @@ -49,23 +49,23 @@ "require-dev": { "ext-sockets": "*", "dbrekelmans/bdi": "^1.1", - "ekino/phpstan-banned-code": "^1.0", + "ekino/phpstan-banned-code": "^1.0|^2.0|^3.0", "ergebnis/phpunit-slow-test-detector": "^2.14", - "infection/infection": "^0.28", + "infection/infection": "^0.28|^0.29", "matthiasnoback/symfony-config-test": "^5.1", "php-parallel-lint/php-parallel-lint": "^1.4", "phpstan/extension-installer": "^1.1", - "phpstan/phpdoc-parser": "^1.28", - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-beberlei-assert": "^1.0", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.4", - "phpstan/phpstan-strict-rules": "^1.0", - "phpstan/phpstan-symfony": "^1.4", + "phpstan/phpdoc-parser": "^1.28|^2.0", + "phpstan/phpstan": "^1.0|^2.0", + "phpstan/phpstan-beberlei-assert": "^1.0|^2.0", + "phpstan/phpstan-deprecation-rules": "^1.0|^2.0", + "phpstan/phpstan-phpunit": "^1.4|^2.0", + "phpstan/phpstan-strict-rules": "^1.0|^2.0", + "phpstan/phpstan-symfony": "^1.4|^2.0", "phpunit/phpunit": "^10.1|^11.0", - "rector/rector": "^1.0", - "staabm/phpstan-todo-by": "^0.1.27", - "struggle-for-php/sfp-phpstan-psr-log": "^0.21.0", + "rector/rector": "^1.0|^2.0", + "staabm/phpstan-todo-by": "^0.1.27|^0.2", + "struggle-for-php/sfp-phpstan-psr-log": "^0.21.0|^0.22|^0.23", "symfony/filesystem": "^6.4|^7.0", "symfony/framework-bundle": "^6.4|^7.0", "symfony/mime": "^6.4|^7.0", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ed22a48..5077e76 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,611 +1,1399 @@ parameters: ignoreErrors: - - message: "#^Only iterables can be unpacked, mixed given in argument \\#1\\.$#" + message: '#^Only iterables can be unpacked, mixed given in argument \#1\.$#' + identifier: argument.unpackNonIterable count: 1 path: src/CachingStrategy/AssetCache.php - - message: "#^Parameter \\#1 \\$name of method SpomkyLabs\\\\PwaBundle\\\\CachingStrategy\\\\WorkboxCacheStrategy\\:\\:withName\\(\\) expects string, string\\|null given\\.$#" + message: '#^Parameter \#1 \$name of method SpomkyLabs\\PwaBundle\\CachingStrategy\\WorkboxCacheStrategy\:\:withName\(\) expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/CachingStrategy/AssetCache.php - - message: "#^Parameter \\#1 \\$preloadUrl of method SpomkyLabs\\\\PwaBundle\\\\CachingStrategy\\\\WorkboxCacheStrategy\\:\\:withPreloadUrl\\(\\) expects string, mixed given\\.$#" + message: '#^Parameter \#1 \$preloadUrl of method SpomkyLabs\\PwaBundle\\CachingStrategy\\WorkboxCacheStrategy\:\:withPreloadUrl\(\) expects string, mixed given\.$#' + identifier: argument.type count: 1 path: src/CachingStrategy/AssetCache.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + message: '#^Parameter \#1 \$value of function count expects array\|Countable, mixed given\.$#' + identifier: argument.type count: 1 path: src/CachingStrategy/AssetCache.php - - message: "#^Only iterables can be unpacked, mixed given in argument \\#1\\.$#" + message: '#^Only iterables can be unpacked, mixed given in argument \#1\.$#' + identifier: argument.unpackNonIterable count: 1 path: src/CachingStrategy/FontCache.php - - message: "#^Parameter \\#1 \\$preloadUrl of method SpomkyLabs\\\\PwaBundle\\\\CachingStrategy\\\\WorkboxCacheStrategy\\:\\:withPreloadUrl\\(\\) expects string, mixed given\\.$#" + message: '#^Parameter \#1 \$preloadUrl of method SpomkyLabs\\PwaBundle\\CachingStrategy\\WorkboxCacheStrategy\:\:withPreloadUrl\(\) expects string, mixed given\.$#' + identifier: argument.type count: 1 path: src/CachingStrategy/FontCache.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + message: '#^Parameter \#1 \$value of function count expects array\|Countable, mixed given\.$#' + identifier: argument.type count: 2 path: src/CachingStrategy/FontCache.php - - message: "#^Only iterables can be unpacked, mixed given in argument \\#1\\.$#" + message: '#^Only iterables can be unpacked, mixed given in argument \#1\.$#' + identifier: argument.unpackNonIterable count: 1 path: src/CachingStrategy/ResourceCaches.php - - message: "#^Parameter \\#1 \\$preloadUrl of method SpomkyLabs\\\\PwaBundle\\\\CachingStrategy\\\\WorkboxCacheStrategy\\:\\:withPreloadUrl\\(\\) expects string, mixed given\\.$#" + message: '#^Parameter \#1 \$headersToCheck of static method SpomkyLabs\\PwaBundle\\WorkboxPlugin\\BroadcastUpdatePlugin\:\:create\(\) expects array\, array\ given\.$#' + identifier: argument.type count: 1 path: src/CachingStrategy/ResourceCaches.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + message: '#^Parameter \#1 \$preloadUrl of method SpomkyLabs\\PwaBundle\\CachingStrategy\\WorkboxCacheStrategy\:\:withPreloadUrl\(\) expects string, mixed given\.$#' + identifier: argument.type count: 1 path: src/CachingStrategy/ResourceCaches.php - - message: "#^Part \\$this\\-\\>options\\['networkTimeoutSeconds'\\] \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: '#^Parameter \#1 \$value of function count expects array\|Countable, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/CachingStrategy/ResourceCaches.php + + - + message: '#^Part \$this\-\>options\[''networkTimeoutSeconds''\] \(mixed\) of encapsed string cannot be cast to string\.$#' + identifier: encapsedStringPart.nonString count: 1 path: src/CachingStrategy/WorkboxCacheStrategy.php - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#' + identifier: foreach.nonIterable count: 1 path: src/Command/CreateIconsCommand.php - - message: "#^Cannot cast mixed to int\\.$#" + message: '#^Cannot cast mixed to int\.$#' + identifier: cast.int count: 1 path: src/Command/CreateIconsCommand.php - - message: "#^Cannot cast mixed to string\\.$#" + message: '#^Cannot cast mixed to string\.$#' + identifier: cast.string count: 1 path: src/Command/CreateIconsCommand.php - - message: "#^Parameter \\#1 \\$image of method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\ImageProcessorInterface\\:\\:process\\(\\) expects string, string\\|false given\\.$#" + message: '#^Parameter \#1 \$image of method SpomkyLabs\\PwaBundle\\ImageProcessor\\ImageProcessorInterface\:\:process\(\) expects string, string\|false given\.$#' + identifier: argument.type count: 1 path: src/Command/CreateIconsCommand.php - - message: "#^Parameter \\#1 \\$source of method SpomkyLabs\\\\PwaBundle\\\\Command\\\\CreateIconsCommand\\:\\:getSourcePath\\(\\) expects string, mixed given\\.$#" + message: '#^Parameter \#1 \$source of method SpomkyLabs\\PwaBundle\\Command\\CreateIconsCommand\:\:getSourcePath\(\) expects string, mixed given\.$#' + identifier: argument.type count: 1 path: src/Command/CreateIconsCommand.php - - message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" + message: '#^Parameter \#3 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' + identifier: argument.type count: 1 path: src/Command/CreateIconsCommand.php - - message: "#^Cannot cast mixed to int\\.$#" + message: '#^Cannot cast mixed to int\.$#' + identifier: cast.int count: 2 path: src/Command/CreateScreenshotCommand.php - - message: "#^Cannot cast mixed to string\\.$#" + message: '#^Cannot cast mixed to string\.$#' + identifier: cast.string count: 2 path: src/Command/CreateScreenshotCommand.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Command\\\\CreateScreenshotCommand\\:\\:getDefaultArguments\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Command\\CreateScreenshotCommand\:\:getAvailablePort\(\) should return int but returns mixed\.$#' + identifier: return.type count: 1 path: src/Command/CreateScreenshotCommand.php - - message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Command\\CreateScreenshotCommand\:\:getDefaultArguments\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/Command/CreateScreenshotCommand.php - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + message: '#^Only booleans are allowed in a negated boolean, mixed given\.$#' + identifier: booleanNot.exprNotBoolean + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: '#^Only booleans are allowed in an if condition, mixed given\.$#' + identifier: if.condNotBoolean count: 3 path: src/Command/CreateScreenshotCommand.php - - message: "#^Parameter \\#2 \\$uri of method Symfony\\\\Component\\\\Panther\\\\Client\\:\\:request\\(\\) expects string, mixed given\\.$#" + message: '#^Parameter \#2 \$uri of method Symfony\\Component\\Panther\\Client\:\:request\(\) expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: '#^Parameter \#3 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' + identifier: argument.type count: 1 path: src/Command/CreateScreenshotCommand.php - - message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" + message: '#^Parameter \$arguments of static method Symfony\\Component\\Panther\\Client\:\:createChromeClient\(\) expects array\\|null, array given\.$#' + identifier: argument.type count: 1 path: src/Command/CreateScreenshotCommand.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\BackgroundSync has an uninitialized property \\$forceSyncFallback\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Strict comparison using \!\=\= between non\-empty\-string and '''' will always evaluate to true\.$#' + identifier: notIdentical.alwaysTrue + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: '#^Cannot access offset ''data'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 4 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Cannot access offset ''files'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 3 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Cannot access property \$workbox on mixed\.$#' + identifier: property.nonObject + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\DataCollector\\PwaCollector\:\:getCachingStrategies\(\) should return array\ but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\DataCollector\\PwaCollector\:\:getData\(\) should return array\\|Symfony\\Component\\VarDumper\\Cloner\\Data but returns array\|Symfony\\Component\\VarDumper\\Cloner\\Data\.$#' + identifier: return.type + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\DataCollector\\PwaCollector\:\:getFavicons\(\) should return SpomkyLabs\\PwaBundle\\Dto\\Favicons but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\DataCollector\\PwaCollector\:\:getFaviconsFiles\(\) should return array\ but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\DataCollector\\PwaCollector\:\:getManifest\(\) should return SpomkyLabs\\PwaBundle\\Dto\\Manifest but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\DataCollector\\PwaCollector\:\:getManifestFiles\(\) should return array\ but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\DataCollector\\PwaCollector\:\:getServiceWorker\(\) should return SpomkyLabs\\PwaBundle\\Dto\\ServiceWorker but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\DataCollector\\PwaCollector\:\:getServiceWorkerFiles\(\) should return array\ but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\DataCollector\\PwaCollector\:\:getWorkbox\(\) should return SpomkyLabs\\PwaBundle\\Dto\\Workbox but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/DataCollector/PwaCollector.php + + - + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\BackgroundSync has an uninitialized property \$forceSyncFallback\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/BackgroundSync.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\BackgroundSync has an uninitialized property \\$matchCallback\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\BackgroundSync has an uninitialized property \$matchCallback\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/BackgroundSync.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\BackgroundSync has an uninitialized property \\$maxRetentionTime\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\BackgroundSync has an uninitialized property \$maxRetentionTime\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/BackgroundSync.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\BackgroundSync has an uninitialized property \\$method\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\BackgroundSync has an uninitialized property \$method\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/BackgroundSync.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\BackgroundSync has an uninitialized property \\$queueName\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\BackgroundSync has an uninitialized property \$queueName\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/BackgroundSync.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Favicons has an uninitialized property \\$src\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Favicons has an uninitialized property \$src\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Favicons.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\File has an uninitialized property \\$accept\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\File has an uninitialized property \$accept\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/File.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\File has an uninitialized property \\$name\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\File has an uninitialized property \$name\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/File.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\FileHandler has an uninitialized property \\$accept\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\FileHandler has an uninitialized property \$accept\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/FileHandler.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\FileHandler has an uninitialized property \\$action\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\FileHandler has an uninitialized property \$action\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/FileHandler.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\GoogleFontCache has an uninitialized property \\$enabled\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\GoogleFontCache has an uninitialized property \$enabled\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/GoogleFontCache.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Icon has an uninitialized property \\$sizeList\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Icon has an uninitialized property \$sizeList\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Icon.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Icon has an uninitialized property \\$src\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Icon has an uninitialized property \$src\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Icon.php - - message: "#^Property SpomkyLabs\\\\PwaBundle\\\\Dto\\\\LaunchHandler\\:\\:\\$clientMode type has no value type specified in iterable type array\\.$#" + message: '#^Property SpomkyLabs\\PwaBundle\\Dto\\LaunchHandler\:\:\$clientMode type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/Dto/LaunchHandler.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Manifest\\:\\:getCategories\\(\\) should return array\\ but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Manifest\:\:getCategories\(\) should return array\ but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Manifest.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Manifest\\:\\:getDescription\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Manifest\:\:getDescription\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Manifest.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Manifest\\:\\:getName\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Manifest\:\:getName\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Manifest.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Manifest\\:\\:getShortName\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Manifest\:\:getShortName\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Manifest.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Manifest\\:\\:getStartUrl\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Manifest\:\:getStartUrl\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Manifest.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\PageCache extends @final class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ResourceCache\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\PageCache extends @final class SpomkyLabs\\PwaBundle\\Dto\\ResourceCache\.$#' + identifier: class.extendsFinalByPhpDoc count: 1 path: src/Dto/PageCache.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ProtocolHandler has an uninitialized property \\$protocol\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\ProtocolHandler has an uninitialized property \$protocol\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/ProtocolHandler.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ProtocolHandler has an uninitialized property \\$url\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\ProtocolHandler has an uninitialized property \$url\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/ProtocolHandler.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\RelatedApplication has an uninitialized property \\$platform\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\RelatedApplication has an uninitialized property \$platform\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/RelatedApplication.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\RelatedApplication has an uninitialized property \\$url\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\RelatedApplication has an uninitialized property \$url\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/RelatedApplication.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ResourceCache has an uninitialized property \\$matchCallback\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\ResourceCache has an uninitialized property \$matchCallback\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/ResourceCache.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ScopeExtension has an uninitialized property \\$origin\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\ScopeExtension has an uninitialized property \$origin\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/ScopeExtension.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Screenshot has an uninitialized property \\$src\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Screenshot has an uninitialized property \$src\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Screenshot.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Screenshot\\:\\:getLabel\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Screenshot\:\:getLabel\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Screenshot.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ServiceWorker has an uninitialized property \\$dest\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\ServiceWorker has an uninitialized property \$dest\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/ServiceWorker.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ServiceWorker has an uninitialized property \\$enabled\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\ServiceWorker has an uninitialized property \$enabled\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/ServiceWorker.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ServiceWorker has an uninitialized property \\$workbox\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\ServiceWorker has an uninitialized property \$workbox\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/ServiceWorker.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ShareTarget has an uninitialized property \\$action\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\ShareTarget has an uninitialized property \$action\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/ShareTarget.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ShareTargetParameters\\:\\:getText\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\ShareTargetParameters\:\:getText\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/ShareTargetParameters.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ShareTargetParameters\\:\\:getTitle\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\ShareTargetParameters\:\:getTitle\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/ShareTargetParameters.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Shortcut has an uninitialized property \\$name\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Shortcut has an uninitialized property \$name\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Shortcut.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Shortcut has an uninitialized property \\$url\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Shortcut has an uninitialized property \$url\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Shortcut.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Shortcut\\:\\:getDescription\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Shortcut\:\:getDescription\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Shortcut.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Shortcut\\:\\:getName\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Shortcut\:\:getName\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Shortcut.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Shortcut\\:\\:getShortName\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Shortcut\:\:getShortName\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Shortcut.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Url has an uninitialized property \\$path\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Url has an uninitialized property \$path\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Url.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Widget has an uninitialized property \\$adaptativeCardTemplate\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Widget has an uninitialized property \$adaptativeCardTemplate\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Widget.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Widget has an uninitialized property \\$name\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Widget has an uninitialized property \$name\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Widget.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Widget\\:\\:getDescription\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Widget\:\:getDescription\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Widget.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Widget\\:\\:getName\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Widget\:\:getName\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Widget.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Widget\\:\\:getShortName\\(\\) should return string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null but returns array\\\\|string\\|Symfony\\\\Contracts\\\\Translation\\\\TranslatableInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Dto\\Widget\:\:getShortName\(\) should return string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null but returns array\\|string\|Symfony\\Contracts\\Translation\\TranslatableInterface\|null\.$#' + identifier: return.type count: 1 path: src/Dto/Widget.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$assetCache\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$assetCache\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$cacheManifest\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$cacheManifest\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$enabled\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$enabled\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$fontCache\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$fontCache\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$googleFontCache\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$googleFontCache\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$imageCache\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$imageCache\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$offlineFallback\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$offlineFallback\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$resourceCaches\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$resourceCaches\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$useCDN\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$useCDN\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$version\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$version\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Workbox has an uninitialized property \\$workboxPublicUrl\\. Give it default value or assign it in the constructor\\.$#" + message: '#^Class SpomkyLabs\\PwaBundle\\Dto\\Workbox has an uninitialized property \$workboxPublicUrl\. Give it default value or assign it in the constructor\.$#' + identifier: property.uninitialized count: 1 path: src/Dto/Workbox.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\GDImageProcessor\\:\\:process\\(\\) should return string but returns string\\|false\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\ImageProcessor\\GDImageProcessor\:\:process\(\) should return string but returns string\|false\.$#' + identifier: return.type count: 1 path: src/ImageProcessor/GDImageProcessor.php - - message: "#^Parameter \\#2 \\$red of function imagecolorallocate expects int\\<0, 255\\>, int given\\.$#" + message: '#^Parameter \#1 \$width of function imagecreatetruecolor expects int\<1, max\>, int given\.$#' + identifier: argument.type + count: 2 + path: src/ImageProcessor/GDImageProcessor.php + + - + message: '#^Parameter \#2 \$height of function imagecreatetruecolor expects int\<1, max\>, int given\.$#' + identifier: argument.type + count: 2 + path: src/ImageProcessor/GDImageProcessor.php + + - + message: '#^Parameter \#2 \$red of function imagecolorallocate expects int\<0, 255\>, int given\.$#' + identifier: argument.type count: 1 path: src/ImageProcessor/GDImageProcessor.php - - message: "#^Parameter \\#3 \\$green of function imagecolorallocate expects int\\<0, 255\\>, int given\\.$#" + message: '#^Parameter \#3 \$green of function imagecolorallocate expects int\<0, 255\>, int given\.$#' + identifier: argument.type count: 1 path: src/ImageProcessor/GDImageProcessor.php - - message: "#^Parameter \\#4 \\$blue of function imagecolorallocate expects int\\<0, 255\\>, int given\\.$#" + message: '#^Parameter \#4 \$blue of function imagecolorallocate expects int\<0, 255\>, int given\.$#' + identifier: argument.type count: 1 path: src/ImageProcessor/GDImageProcessor.php - - message: "#^Should not use node with type \"Stmt_Echo\", please change the code\\.$#" + message: '#^Should not use node with type "Stmt_Echo", please change the code\.$#' + identifier: ekinoBannedCode.expression count: 3 path: src/ImageProcessor/GDImageProcessor.php - - message: "#^PHPDoc tag @return with type array\\ is incompatible with native type string\\.$#" + message: '#^PHPDoc tag @return with type array\ is incompatible with native type string\.$#' + identifier: return.phpDocType count: 1 path: src/Normalizer/AssetNormalizer.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\IconNormalizer\\:\\:normalize\\(\\) should return array\\{src\\: string, sizes\\?\\: string, type\\?\\: string, purpose\\?\\: string\\} but returns array\\\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Normalizer\\IconNormalizer\:\:normalize\(\) should return array\{src\: string, sizes\?\: string, type\?\: string, purpose\?\: string\} but returns array\\.$#' + identifier: return.type count: 1 path: src/Normalizer/IconNormalizer.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ScreenshotNormalizer\\:\\:normalize\\(\\) should return array\\{src\\: string, sizes\\?\\: string, form_factor\\?\\: string, label\\?\\: string, platform\\?\\: string, format\\?\\: string\\} but returns array\\\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Normalizer\\ScreenshotNormalizer\:\:normalize\(\) should return array\{src\: string, sizes\?\: string, form_factor\?\: string, label\?\: string, platform\?\: string, format\?\: string\} but returns array\\.$#' + identifier: return.type count: 1 path: src/Normalizer/ScreenshotNormalizer.php - - message: "#^Parameter \\#1 \\$image of method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\ImageProcessorInterface\\:\\:getSizes\\(\\) expects string, string\\|false given\\.$#" + message: '#^Parameter \#1 \$image of method SpomkyLabs\\PwaBundle\\ImageProcessor\\ImageProcessorInterface\:\:getSizes\(\) expects string, string\|false given\.$#' + identifier: argument.type count: 1 path: src/Normalizer/ScreenshotNormalizer.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ServiceWorkerNormalizer\\:\\:normalize\\(\\) should return array\\{scope\\?\\: string, src\\: string, use_cache\\?\\: bool\\} but returns array\\\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Normalizer\\ServiceWorkerNormalizer\:\:normalize\(\) should return array\{scope\?\: string, src\: string, use_cache\?\: bool\} but returns array\\.$#' + identifier: return.type count: 1 path: src/Normalizer/ServiceWorkerNormalizer.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + message: '#^Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method arrayNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method booleanNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method canBeEnabled\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method children\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method defaultFalse\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method defaultNull\(\) on mixed\.$#' + identifier: method.nonObject + count: 6 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method defaultValue\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method end\(\) on mixed\.$#' + identifier: method.nonObject + count: 13 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method example\(\) on mixed\.$#' + identifier: method.nonObject + count: 3 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method info\(\) on mixed\.$#' + identifier: method.nonObject + count: 9 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method integerNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method isRequired\(\) on mixed\.$#' + identifier: method.nonObject count: 1 path: src/Resources/config/definition/favicons.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + message: '#^Cannot call method max\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method min\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Cannot call method scalarNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 5 + path: src/Resources/config/definition/favicons.php + + - + message: '#^Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Resources/config/definition/image_processor.php + + - + message: '#^Cannot call method defaultNull\(\) on mixed\.$#' + identifier: method.nonObject count: 1 path: src/Resources/config/definition/image_processor.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + message: '#^Cannot call method end\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/image_processor.php + + - + message: '#^Cannot call method example\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/image_processor.php + + - + message: '#^Cannot call method info\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/image_processor.php + + - + message: '#^Cannot call method scalarNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/image_processor.php + + - + message: '#^Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Resources/config/definition/logging.php + + - + message: '#^Cannot call method defaultNull\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/logging.php + + - + message: '#^Cannot call method end\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/logging.php + + - + message: '#^Cannot call method info\(\) on mixed\.$#' + identifier: method.nonObject count: 1 path: src/Resources/config/definition/logging.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + message: '#^Cannot call method scalarNode\(\) on mixed\.$#' + identifier: method.nonObject count: 1 + path: src/Resources/config/definition/logging.php + + - + message: '#^Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method append\(\) on mixed\.$#' + identifier: method.nonObject + count: 9 path: src/Resources/config/definition/manifest.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + message: '#^Cannot call method arrayNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 5 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method arrayPrototype\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method booleanNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method canBeEnabled\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method cannotBeEmpty\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method children\(\) on mixed\.$#' + identifier: method.nonObject + count: 3 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method defaultTrue\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method defaultValue\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method end\(\) on mixed\.$#' + identifier: method.nonObject + count: 32 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method example\(\) on mixed\.$#' + identifier: method.nonObject + count: 18 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method info\(\) on mixed\.$#' + identifier: method.nonObject + count: 24 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method integerNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method isRequired\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method scalarNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 17 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Cannot call method scalarPrototype\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/manifest.php + + - + message: '#^Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Resources/config/definition/path_type_reference.php + + - + message: '#^Cannot call method defaultValue\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/path_type_reference.php + + - + message: '#^Cannot call method end\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/path_type_reference.php + + - + message: '#^Cannot call method example\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/path_type_reference.php + + - + message: '#^Cannot call method ifNotInArray\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/path_type_reference.php + + - + message: '#^Cannot call method info\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/path_type_reference.php + + - + message: '#^Cannot call method integerNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/path_type_reference.php + + - + message: '#^Cannot call method setDeprecated\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/path_type_reference.php + + - + message: '#^Cannot call method thenInvalid\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/path_type_reference.php + + - + message: '#^Cannot call method validate\(\) on mixed\.$#' + identifier: method.nonObject count: 1 path: src/Resources/config/definition/path_type_reference.php - - message: "#^Anonymous function should return array but returns mixed\\.$#" + message: '#^Anonymous function should return array but returns mixed\.$#' + identifier: return.type count: 8 path: src/Resources/config/definition/service_worker.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + message: '#^Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)\.$#' + identifier: method.notFound count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access an offset on mixed\\.$#" + message: '#^Cannot access an offset on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'asset_cache' on mixed\\.$#" + message: '#^Cannot access offset ''asset_cache'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 2 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'asset_cache_name' on mixed\\.$#" + message: '#^Cannot access offset ''asset_cache_name'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'font_cache' on mixed\\.$#" + message: '#^Cannot access offset ''font_cache'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 2 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'font_cache_name' on mixed\\.$#" + message: '#^Cannot access offset ''font_cache_name'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'font_regex' on mixed\\.$#" + message: '#^Cannot access offset ''font_regex'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'image_cache' on mixed\\.$#" + message: '#^Cannot access offset ''image_cache'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 2 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'image_cache_name' on mixed\\.$#" + message: '#^Cannot access offset ''image_cache_name'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'image_regex' on mixed\\.$#" + message: '#^Cannot access offset ''image_regex'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'max_font_age' on mixed\\.$#" + message: '#^Cannot access offset ''max_font_age'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'max_font_cache…' on mixed\\.$#" + message: '#^Cannot access offset ''max_font_cache_entries'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'max_image_age' on mixed\\.$#" + message: '#^Cannot access offset ''max_image_age'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'max_image_cache…' on mixed\\.$#" + message: '#^Cannot access offset ''max_image_cache_entries'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'network_timeout…' on mixed\\.$#" + message: '#^Cannot access offset ''network_timeout_seconds'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'page_cache_name' on mixed\\.$#" + message: '#^Cannot access offset ''page_cache_name'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'resource_caches' on mixed\\.$#" + message: '#^Cannot access offset ''resource_caches'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 2 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'static_regex' on mixed\\.$#" + message: '#^Cannot access offset ''static_regex'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Cannot access offset 'warm_cache_urls' on mixed\\.$#" + message: '#^Cannot access offset ''warm_cache_urls'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/Resources/config/definition/service_worker.php - - message: "#^Strict comparison using \\!\\=\\= between mixed and null will always evaluate to true\\.$#" + message: '#^Cannot call method append\(\) on mixed\.$#' + identifier: method.nonObject + count: 6 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method arrayNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 16 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method arrayPrototype\(\) on mixed\.$#' + identifier: method.nonObject + count: 4 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method beforeNormalization\(\) on mixed\.$#' + identifier: method.nonObject + count: 7 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method booleanNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 8 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method canBeDisabled\(\) on mixed\.$#' + identifier: method.nonObject + count: 5 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method canBeEnabled\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method cannotBeEmpty\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method children\(\) on mixed\.$#' + identifier: method.nonObject + count: 11 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method defaultFalse\(\) on mixed\.$#' + identifier: method.nonObject + count: 5 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method defaultNull\(\) on mixed\.$#' + identifier: method.nonObject + count: 6 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method defaultTrue\(\) on mixed\.$#' + identifier: method.nonObject count: 3 path: src/Resources/config/definition/service_worker.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + message: '#^Cannot call method defaultValue\(\) on mixed\.$#' + identifier: method.nonObject + count: 36 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method end\(\) on mixed\.$#' + identifier: method.nonObject + count: 102 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method example\(\) on mixed\.$#' + identifier: method.nonObject + count: 33 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method ifNotInArray\(\) on mixed\.$#' + identifier: method.nonObject count: 1 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method ifString\(\) on mixed\.$#' + identifier: method.nonObject + count: 3 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method ifTrue\(\) on mixed\.$#' + identifier: method.nonObject + count: 4 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method info\(\) on mixed\.$#' + identifier: method.nonObject + count: 64 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method integerNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 11 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method integerPrototype\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method isRequired\(\) on mixed\.$#' + identifier: method.nonObject + count: 5 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method prototype\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method scalarNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 37 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method scalarPrototype\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method setDeprecated\(\) on mixed\.$#' + identifier: method.nonObject + count: 17 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method then\(\) on mixed\.$#' + identifier: method.nonObject + count: 7 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method thenInvalid\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method treatFalseLike\(\) on mixed\.$#' + identifier: method.nonObject + count: 10 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method treatNullLike\(\) on mixed\.$#' + identifier: method.nonObject + count: 10 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method treatTrueLike\(\) on mixed\.$#' + identifier: method.nonObject + count: 10 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Cannot call method validate\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Strict comparison using \!\=\= between mixed and null will always evaluate to true\.$#' + identifier: notIdentical.alwaysTrue + count: 3 + path: src/Resources/config/definition/service_worker.php + + - + message: '#^Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Resources/config/definition/web_client.php + + - + message: '#^Cannot call method defaultNull\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/web_client.php + + - + message: '#^Cannot call method end\(\) on mixed\.$#' + identifier: method.nonObject + count: 3 + path: src/Resources/config/definition/web_client.php + + - + message: '#^Cannot call method info\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: src/Resources/config/definition/web_client.php + + - + message: '#^Cannot call method scalarNode\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 path: src/Resources/config/definition/web_client.php - - message: "#^Cannot call method process\\(\\) on SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\ImageProcessorInterface\\|null\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Service\\Data\:\:getData\(\) should return string but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/Service/Data.php + + - + message: '#^Property SpomkyLabs\\PwaBundle\\Service\\Data\:\:\$data \(Closure\|string\) does not accept mixed\.$#' + identifier: assign.propertyType + count: 1 + path: src/Service/Data.php + + - + message: '#^Cannot call method process\(\) on SpomkyLabs\\PwaBundle\\ImageProcessor\\ImageProcessorInterface\|null\.$#' + identifier: method.nonObject count: 1 path: src/Service/FaviconsCompiler.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Service\\\\FaviconsCompiler\\:\\:getFavicon\\(\\) should return array\\{string, string\\} but returns array\\{string\\|false, string\\}\\.$#" + message: '#^Method SpomkyLabs\\PwaBundle\\Service\\FaviconsCompiler\:\:getFavicon\(\) should return array\{string, string\} but returns array\{string\|false, string\}\.$#' + identifier: return.type count: 1 path: src/Service/FaviconsCompiler.php - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" + message: '#^Parameter \#2 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' + identifier: argument.type count: 1 path: src/ServiceWorkerRule/AppendCacheStrategies.php - - message: "#^Strict comparison using \\=\\=\\= between int\\<1, max\\> and 0 will always evaluate to false\\.$#" + message: '#^Strict comparison using \=\=\= between int\<1, max\> and 0 will always evaluate to false\.$#' + identifier: identical.alwaysFalse count: 1 path: src/ServiceWorkerRule/OfflineFallback.php - - message: "#^Method SpomkyLabs\\\\PwaBundle\\\\SpomkyLabsPwaBundle\\:\\:loadExtension\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" + message: '#^Cannot access offset ''dest'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/SpomkyLabsPwaBundle.php + + - + message: '#^Cannot access offset ''enabled'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 4 + path: src/SpomkyLabsPwaBundle.php + + - + message: '#^Cannot access offset ''public_url'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 + path: src/SpomkyLabsPwaBundle.php + + - + message: '#^Cannot access offset ''serviceworker'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/SpomkyLabsPwaBundle.php + + - + message: '#^Method SpomkyLabs\\PwaBundle\\SpomkyLabsPwaBundle\:\:loadExtension\(\) has parameter \$config with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/SpomkyLabsPwaBundle.php + + - + message: '#^Parameter \#2 \$id of method Symfony\\Component\\DependencyInjection\\ContainerBuilder\:\:setAlias\(\) expects string\|Symfony\\Component\\DependencyInjection\\Alias, mixed given\.$#' + identifier: argument.type + count: 3 + path: src/SpomkyLabsPwaBundle.php + + - + message: '#^Parameter \#2 \$value of method Symfony\\Component\\DependencyInjection\\Container\:\:setParameter\(\) expects array\|bool\|float\|int\|string\|UnitEnum\|null, mixed given\.$#' + identifier: argument.type + count: 8 path: src/SpomkyLabsPwaBundle.php \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon index d550a2c..094aebc 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,14 +1,16 @@ parameters: - level: max - paths: - - src - - tests - checkMissingIterableValueType: true - checkGenericClassInNonGenericObjectType: true - checkUninitializedProperties: true - treatPhpDocTypesAsCertain: false - scanFiles: - - vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php + level: max + paths: + - src + - tests + + banned_code: + non_ignorable: false + checkUninitializedProperties: true + treatPhpDocTypesAsCertain: false + scanFiles: + - vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php + includes: - - vendor/phpstan/phpstan/conf/bleedingEdge.neon - - phpstan-baseline.neon + - vendor/phpstan/phpstan/conf/bleedingEdge.neon + - phpstan-baseline.neon diff --git a/src/CachingStrategy/AssetCache.php b/src/CachingStrategy/AssetCache.php index 5d3d576..a68e44a 100644 --- a/src/CachingStrategy/AssetCache.php +++ b/src/CachingStrategy/AssetCache.php @@ -16,6 +16,7 @@ use Symfony\Component\Serializer\Encoder\JsonEncode; use Symfony\Component\Serializer\SerializerInterface; use function count; +use function sprintf; use const JSON_PRETTY_PRINT; use const JSON_THROW_ON_ERROR; use const JSON_UNESCAPED_SLASHES; diff --git a/src/CachingStrategy/ImageCache.php b/src/CachingStrategy/ImageCache.php index daaeffe..506add9 100644 --- a/src/CachingStrategy/ImageCache.php +++ b/src/CachingStrategy/ImageCache.php @@ -11,6 +11,7 @@ use SpomkyLabs\PwaBundle\Service\CanLogInterface; use Symfony\Component\AssetMapper\Path\PublicAssetsPathResolverInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; +use function sprintf; final class ImageCache implements HasCacheStrategiesInterface, CanLogInterface { diff --git a/src/CachingStrategy/ManifestCache.php b/src/CachingStrategy/ManifestCache.php index 2447720..416626b 100644 --- a/src/CachingStrategy/ManifestCache.php +++ b/src/CachingStrategy/ManifestCache.php @@ -10,6 +10,7 @@ use SpomkyLabs\PwaBundle\Dto\Workbox; use SpomkyLabs\PwaBundle\Service\CanLogInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; +use function sprintf; final class ManifestCache implements HasCacheStrategiesInterface, CanLogInterface { diff --git a/src/CachingStrategy/PreloadUrlsGeneratorManager.php b/src/CachingStrategy/PreloadUrlsGeneratorManager.php index 1842277..db3dbd0 100644 --- a/src/CachingStrategy/PreloadUrlsGeneratorManager.php +++ b/src/CachingStrategy/PreloadUrlsGeneratorManager.php @@ -10,6 +10,7 @@ use SpomkyLabs\PwaBundle\Service\CanLogInterface; use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use function array_key_exists; +use function sprintf; final class PreloadUrlsGeneratorManager implements CanLogInterface { diff --git a/src/CachingStrategy/ResourceCaches.php b/src/CachingStrategy/ResourceCaches.php index 9a88fb5..33cb29d 100644 --- a/src/CachingStrategy/ResourceCaches.php +++ b/src/CachingStrategy/ResourceCaches.php @@ -20,6 +20,7 @@ use Symfony\Component\Serializer\Encoder\JsonEncode; use Symfony\Component\Serializer\SerializerInterface; use function count; +use function sprintf; use const JSON_PRETTY_PRINT; use const JSON_THROW_ON_ERROR; use const JSON_UNESCAPED_SLASHES; diff --git a/src/CachingStrategy/WorkboxCacheStrategy.php b/src/CachingStrategy/WorkboxCacheStrategy.php index 73076ec..21086f6 100644 --- a/src/CachingStrategy/WorkboxCacheStrategy.php +++ b/src/CachingStrategy/WorkboxCacheStrategy.php @@ -6,6 +6,7 @@ use SpomkyLabs\PwaBundle\WorkboxPlugin\CachePluginInterface; use function in_array; +use function sprintf; use const JSON_PRETTY_PRINT; use const JSON_THROW_ON_ERROR; use const JSON_UNESCAPED_SLASHES; diff --git a/src/Command/CreateIconsCommand.php b/src/Command/CreateIconsCommand.php index 87e9b81..9b3d100 100644 --- a/src/Command/CreateIconsCommand.php +++ b/src/Command/CreateIconsCommand.php @@ -19,6 +19,7 @@ use Symfony\Component\Mime\MimeTypes; use Symfony\Component\Yaml\Yaml; use function is_string; +use function sprintf; #[AsCommand(name: 'pwa:create:icons', description: 'Generate icons for your PWA')] final class CreateIconsCommand extends Command diff --git a/src/Command/CreateScreenshotCommand.php b/src/Command/CreateScreenshotCommand.php index bf2da79..9c98783 100644 --- a/src/Command/CreateScreenshotCommand.php +++ b/src/Command/CreateScreenshotCommand.php @@ -24,6 +24,7 @@ use function assert; use function is_int; use function is_string; +use function sprintf; #[AsCommand( name: 'pwa:create:screenshot', diff --git a/src/CompilerPass/PreloadUrlCompilerPass.php b/src/CompilerPass/PreloadUrlCompilerPass.php index 286e173..8ecbf9d 100644 --- a/src/CompilerPass/PreloadUrlCompilerPass.php +++ b/src/CompilerPass/PreloadUrlCompilerPass.php @@ -17,6 +17,7 @@ use Throwable; use function array_key_exists; use function is_string; +use function sprintf; /** * @internal diff --git a/src/DataCollector/PwaCollector.php b/src/DataCollector/PwaCollector.php index 7efa1e9..951b32f 100644 --- a/src/DataCollector/PwaCollector.php +++ b/src/DataCollector/PwaCollector.php @@ -48,7 +48,7 @@ public function __construct( ) { } - public function collect(Request $request, Response $response, Throwable $exception = null): void + public function collect(Request $request, Response $response, ?Throwable $exception = null): void { $jsonOptions = [ AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES => true, diff --git a/src/ImageProcessor/Configuration.php b/src/ImageProcessor/Configuration.php index e64755f..fc4df4b 100644 --- a/src/ImageProcessor/Configuration.php +++ b/src/ImageProcessor/Configuration.php @@ -6,6 +6,7 @@ use InvalidArgumentException; use Stringable; +use function sprintf; final readonly class Configuration implements Stringable { diff --git a/src/ImageProcessor/GDImageProcessor.php b/src/ImageProcessor/GDImageProcessor.php index 4153e0c..8649735 100644 --- a/src/ImageProcessor/GDImageProcessor.php +++ b/src/ImageProcessor/GDImageProcessor.php @@ -121,11 +121,10 @@ private function createMainImage(string $image, Configuration $configuration): G } /*if ($configuration->width === $configuration->height) { - $mainImage = imagescale($mainImage, $configuration->width, $configuration->height); - assert($mainImage !== false); - - return $mainImage; - }*/ + * $mainImage = imagescale($mainImage, $configuration->width, $configuration->height); + * assert($mainImage !== false); + * return $mainImage; + * }*/ $srcWidth = imagesx($mainImage); $srcHeight = imagesy($mainImage); diff --git a/src/MatchCallbackHandler/DestinationMatchCallbackHandler.php b/src/MatchCallbackHandler/DestinationMatchCallbackHandler.php index ba4ff12..d99250c 100644 --- a/src/MatchCallbackHandler/DestinationMatchCallbackHandler.php +++ b/src/MatchCallbackHandler/DestinationMatchCallbackHandler.php @@ -7,6 +7,7 @@ use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use SpomkyLabs\PwaBundle\Service\CanLogInterface; +use function sprintf; final class DestinationMatchCallbackHandler implements MatchCallbackHandlerInterface, CanLogInterface { diff --git a/src/MatchCallbackHandler/ExactPathnameMatchCallbackHandler.php b/src/MatchCallbackHandler/ExactPathnameMatchCallbackHandler.php index 050177a..a295b33 100644 --- a/src/MatchCallbackHandler/ExactPathnameMatchCallbackHandler.php +++ b/src/MatchCallbackHandler/ExactPathnameMatchCallbackHandler.php @@ -7,6 +7,7 @@ use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use SpomkyLabs\PwaBundle\Service\CanLogInterface; +use function sprintf; final class ExactPathnameMatchCallbackHandler implements MatchCallbackHandlerInterface, CanLogInterface { diff --git a/src/MatchCallbackHandler/OriginMatchCallbackHandler.php b/src/MatchCallbackHandler/OriginMatchCallbackHandler.php index 7d0eb7a..f34f943 100644 --- a/src/MatchCallbackHandler/OriginMatchCallbackHandler.php +++ b/src/MatchCallbackHandler/OriginMatchCallbackHandler.php @@ -7,6 +7,7 @@ use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use SpomkyLabs\PwaBundle\Service\CanLogInterface; +use function sprintf; final class OriginMatchCallbackHandler implements MatchCallbackHandlerInterface, CanLogInterface { diff --git a/src/MatchCallbackHandler/PathnameEndsWithMatchCallbackHandler.php b/src/MatchCallbackHandler/PathnameEndsWithMatchCallbackHandler.php index f134627..71ed16c 100644 --- a/src/MatchCallbackHandler/PathnameEndsWithMatchCallbackHandler.php +++ b/src/MatchCallbackHandler/PathnameEndsWithMatchCallbackHandler.php @@ -7,6 +7,7 @@ use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use SpomkyLabs\PwaBundle\Service\CanLogInterface; +use function sprintf; final class PathnameEndsWithMatchCallbackHandler implements MatchCallbackHandlerInterface, CanLogInterface { diff --git a/src/MatchCallbackHandler/PathnameStartsWithMatchCallbackHandler.php b/src/MatchCallbackHandler/PathnameStartsWithMatchCallbackHandler.php index b643f86..d0ed63b 100644 --- a/src/MatchCallbackHandler/PathnameStartsWithMatchCallbackHandler.php +++ b/src/MatchCallbackHandler/PathnameStartsWithMatchCallbackHandler.php @@ -7,6 +7,7 @@ use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use SpomkyLabs\PwaBundle\Service\CanLogInterface; +use function sprintf; final class PathnameStartsWithMatchCallbackHandler implements MatchCallbackHandlerInterface, CanLogInterface { diff --git a/src/MatchCallbackHandler/RouteMatchCallbackHandler.php b/src/MatchCallbackHandler/RouteMatchCallbackHandler.php index 2494790..bfc51cf 100644 --- a/src/MatchCallbackHandler/RouteMatchCallbackHandler.php +++ b/src/MatchCallbackHandler/RouteMatchCallbackHandler.php @@ -8,6 +8,7 @@ use Psr\Log\NullLogger; use SpomkyLabs\PwaBundle\Service\CanLogInterface; use Symfony\Component\Routing\RouterInterface; +use function sprintf; final class RouteMatchCallbackHandler implements MatchCallbackHandlerInterface, CanLogInterface { diff --git a/src/Normalizer/AssetNormalizer.php b/src/Normalizer/AssetNormalizer.php index 5521de7..dc40999 100644 --- a/src/Normalizer/AssetNormalizer.php +++ b/src/Normalizer/AssetNormalizer.php @@ -21,29 +21,29 @@ public function __construct( /** * @return array{src: string, sizes?: string, form_factor?: string, label?: string, platform?: string, format?: string} */ - public function normalize(mixed $object, string $format = null, array $context = []): string + public function normalize(mixed $data, ?string $format = null, array $context = []): string { - assert($object instanceof Asset); + assert($data instanceof Asset); $url = null; - if (! str_starts_with($object->src, '/')) { - $asset = $this->assetMapper->getAsset($object->src); + if (! str_starts_with($data->src, '/')) { + $asset = $this->assetMapper->getAsset($data->src); $url = $asset?->publicPath; } if ($url === null) { - $url = $object->src; + $url = $data->src; } return $url; } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { assert(is_string($data)); return Asset::create($data); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Asset; } @@ -51,7 +51,7 @@ public function supportsNormalization(mixed $data, string $format = null, array public function supportsDenormalization( mixed $data, string $type, - string $format = null, + ?string $format = null, array $context = [] ): bool { return $type === Asset::class; diff --git a/src/Normalizer/IconNormalizer.php b/src/Normalizer/IconNormalizer.php index 0c18982..d7d22d0 100644 --- a/src/Normalizer/IconNormalizer.php +++ b/src/Normalizer/IconNormalizer.php @@ -25,20 +25,20 @@ public function __construct( /** * @return array{src: string, sizes?: string, type?: string, purpose?: string} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $data, ?string $format = null, array $context = []): array { - assert($object instanceof Icon); - $imageType = $object->type; - if (! str_starts_with($object->src->src, '/')) { - $asset = $this->assetMapper->getAsset($object->src->src); + assert($data instanceof Icon); + $imageType = $data->type; + if (! str_starts_with($data->src->src, '/')) { + $asset = $this->assetMapper->getAsset($data->src->src); $imageType = $this->getType($asset); } $result = [ - 'src' => $this->normalizer->normalize($object->src, $format, $context), - 'sizes' => $object->getSizeList(), + 'src' => $this->normalizer->normalize($data->src, $format, $context), + 'sizes' => $data->getSizeList(), 'type' => $imageType, - 'purpose' => $object->purpose, + 'purpose' => $data->purpose, ]; $cleanup = static fn (array $data): array => array_filter( @@ -49,7 +49,7 @@ public function normalize(mixed $object, string $format = null, array $context = return $cleanup($result); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Icon; } @@ -70,7 +70,6 @@ private function getType(?MappedAsset $asset): ?string return null; } - $mime = MimeTypes::getDefault(); - return $mime->guessMimeType($asset->sourcePath); + return MimeTypes::getDefault()->guessMimeType($asset->sourcePath); } } diff --git a/src/Normalizer/ScreenshotNormalizer.php b/src/Normalizer/ScreenshotNormalizer.php index 9efb9c1..d95dbf0 100644 --- a/src/Normalizer/ScreenshotNormalizer.php +++ b/src/Normalizer/ScreenshotNormalizer.php @@ -13,6 +13,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use function assert; +use function sprintf; final class ScreenshotNormalizer implements NormalizerInterface, NormalizerAwareInterface { @@ -27,23 +28,23 @@ public function __construct( /** * @return array{src: string, sizes?: string, form_factor?: string, label?: string, platform?: string, format?: string} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $data, ?string $format = null, array $context = []): array { - assert($object instanceof Screenshot); + assert($data instanceof Screenshot); $asset = null; - $imageType = $object->type; - if ($imageType === null && ! str_starts_with($object->src->src, '/')) { - $asset = $this->assetMapper->getAsset($object->src->src); + $imageType = $data->type; + if ($imageType === null && ! str_starts_with($data->src->src, '/')) { + $asset = $this->assetMapper->getAsset($data->src->src); $imageType = $this->getType($asset); } - ['sizes' => $sizes, 'formFactor' => $formFactor] = $this->getSizes($object, $asset); + ['sizes' => $sizes, 'formFactor' => $formFactor] = $this->getSizes($data, $asset); $result = [ - 'src' => $this->normalizer->normalize($object->src, $format, $context), + 'src' => $this->normalizer->normalize($data->src, $format, $context), 'sizes' => $sizes, 'form_factor' => $formFactor, - 'label' => $object->label, - 'platform' => $object->platform, + 'label' => $data->label, + 'platform' => $data->platform, 'format' => $imageType, ]; @@ -54,7 +55,7 @@ public function normalize(mixed $object, string $format = null, array $context = return $cleanup($result); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Screenshot; } diff --git a/src/Normalizer/ServiceWorkerNormalizer.php b/src/Normalizer/ServiceWorkerNormalizer.php index c9d11a8..2480074 100644 --- a/src/Normalizer/ServiceWorkerNormalizer.php +++ b/src/Normalizer/ServiceWorkerNormalizer.php @@ -13,14 +13,14 @@ /** * @return array{scope?: string, src: string, use_cache?: bool} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $data, ?string $format = null, array $context = []): array { - assert($object instanceof ServiceWorker); + assert($data instanceof ServiceWorker); $result = [ - 'src' => '/' . trim($object->dest, '/'), - 'scope' => $object->scope, - 'use_cache' => $object->useCache, + 'src' => '/' . trim($data->dest, '/'), + 'scope' => $data->scope, + 'use_cache' => $data->useCache, ]; $cleanup = static fn (array $data): array => array_filter( @@ -30,7 +30,7 @@ public function normalize(mixed $object, string $format = null, array $context = return $cleanup($result); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof ServiceWorker; } diff --git a/src/Normalizer/UrlNormalizer.php b/src/Normalizer/UrlNormalizer.php index e373fef..84ebafb 100644 --- a/src/Normalizer/UrlNormalizer.php +++ b/src/Normalizer/UrlNormalizer.php @@ -24,31 +24,31 @@ public function __construct( ) { } - public function normalize(mixed $object, string $format = null, array $context = []): string + public function normalize(mixed $data, ?string $format = null, array $context = []): string { - assert($object instanceof Url); + assert($data instanceof Url); // If the path is a valid URL, we return it directly - if (str_starts_with($object->path, '/') && filter_var($object->path, FILTER_VALIDATE_URL) !== false) { - return $object->path; + if (str_starts_with($data->path, '/') && filter_var($data->path, FILTER_VALIDATE_URL) !== false) { + return $data->path; } // If the path is an asset, we return the public path - $asset = $this->assetMapper->getAsset($object->path); + $asset = $this->assetMapper->getAsset($data->path); if ($asset !== null) { return $asset->publicPath; } // Otherwise, we try to generate the URL try { - return $this->router->generate($object->path, $object->params, $object->pathTypeReference); + return $this->router->generate($data->path, $data->params, $data->pathTypeReference); } catch (Throwable) { // If the URL cannot be generated, we return the path as is - return $object->path; + return $data->path; } } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Url; } diff --git a/src/Service/FaviconsCompiler.php b/src/Service/FaviconsCompiler.php index 6c2dbbb..1d77317 100644 --- a/src/Service/FaviconsCompiler.php +++ b/src/Service/FaviconsCompiler.php @@ -15,6 +15,7 @@ use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Process\Process; use function assert; +use function sprintf; use const PHP_EOL; final class FaviconsCompiler implements FileCompilerInterface, CanLogInterface diff --git a/src/Service/ServiceWorkerCompiler.php b/src/Service/ServiceWorkerCompiler.php index 9165214..ef49142 100644 --- a/src/Service/ServiceWorkerCompiler.php +++ b/src/Service/ServiceWorkerCompiler.php @@ -17,6 +17,7 @@ use function in_array; use function is_array; use function is_string; +use function sprintf; final class ServiceWorkerCompiler implements FileCompilerInterface, CanLogInterface { diff --git a/src/ServiceWorkerRule/AppendCacheStrategies.php b/src/ServiceWorkerRule/AppendCacheStrategies.php index b895b69..94857f5 100644 --- a/src/ServiceWorkerRule/AppendCacheStrategies.php +++ b/src/ServiceWorkerRule/AppendCacheStrategies.php @@ -7,6 +7,7 @@ use SpomkyLabs\PwaBundle\CachingStrategy\HasCacheStrategiesInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; +use function sprintf; use const PHP_EOL; final readonly class AppendCacheStrategies implements ServiceWorkerRuleInterface diff --git a/src/Subscriber/PwaDevServerSubscriber.php b/src/Subscriber/PwaDevServerSubscriber.php index b1c0735..41d47e6 100644 --- a/src/Subscriber/PwaDevServerSubscriber.php +++ b/src/Subscriber/PwaDevServerSubscriber.php @@ -58,7 +58,7 @@ public function onKernelRequest(RequestEvent $event): void public function onKernelResponse(ResponseEvent $event): void { $headers = $event->getResponse() -->headers; + ->headers; if ($headers->has('X-Manifest-Dev') || $headers->has('X-SW-Dev') || $headers->has('X-Favicons-Dev')) { $event->stopPropagation(); } diff --git a/src/Twig/PwaRuntime.php b/src/Twig/PwaRuntime.php index 8b7db30..e8146e0 100644 --- a/src/Twig/PwaRuntime.php +++ b/src/Twig/PwaRuntime.php @@ -13,6 +13,7 @@ use Symfony\Component\AssetMapper\MappedAsset; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Mime\MimeTypes; +use function sprintf; use const ENT_COMPAT; use const ENT_SUBSTITUTE; use const PHP_EOL; diff --git a/src/WorkboxPlugin/BroadcastUpdatePlugin.php b/src/WorkboxPlugin/BroadcastUpdatePlugin.php index 8d5011d..33fde5a 100644 --- a/src/WorkboxPlugin/BroadcastUpdatePlugin.php +++ b/src/WorkboxPlugin/BroadcastUpdatePlugin.php @@ -4,6 +4,8 @@ namespace SpomkyLabs\PwaBundle\WorkboxPlugin; +use function sprintf; + final readonly class BroadcastUpdatePlugin implements CachePluginInterface, HasDebugInterface { private const NAME = 'BroadcastUpdatePlugin'; diff --git a/src/WorkboxPlugin/CacheableResponsePlugin.php b/src/WorkboxPlugin/CacheableResponsePlugin.php index 011d145..6cec135 100644 --- a/src/WorkboxPlugin/CacheableResponsePlugin.php +++ b/src/WorkboxPlugin/CacheableResponsePlugin.php @@ -4,6 +4,8 @@ namespace SpomkyLabs\PwaBundle\WorkboxPlugin; +use function sprintf; + final readonly class CacheableResponsePlugin implements CachePluginInterface, HasDebugInterface { private const NAME = 'CacheableResponsePlugin'; diff --git a/src/WorkboxPlugin/ExpirationPlugin.php b/src/WorkboxPlugin/ExpirationPlugin.php index 79eb733..141b913 100644 --- a/src/WorkboxPlugin/ExpirationPlugin.php +++ b/src/WorkboxPlugin/ExpirationPlugin.php @@ -4,6 +4,8 @@ namespace SpomkyLabs\PwaBundle\WorkboxPlugin; +use function sprintf; + final readonly class ExpirationPlugin implements CachePluginInterface, HasDebugInterface { private const NAME = 'ExpirationPlugin'; diff --git a/tests/Functional/AbstractPwaTestCase.php b/tests/Functional/AbstractPwaTestCase.php index 64a27b5..046c286 100644 --- a/tests/Functional/AbstractPwaTestCase.php +++ b/tests/Functional/AbstractPwaTestCase.php @@ -8,6 +8,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Filesystem\Filesystem; use function assert; +use function sprintf; /** * @internal diff --git a/tests/Functional/CompileCommandTest.php b/tests/Functional/CompileCommandTest.php index d4d3233..899d26b 100644 --- a/tests/Functional/CompileCommandTest.php +++ b/tests/Functional/CompileCommandTest.php @@ -29,22 +29,20 @@ public static function theFileAreCompiled(): void static::assertFileExists(self::$kernel->getCacheDir() . '/output/site.webmanifest'); static::assertFileExists(self::$kernel->getCacheDir() . '/output/sw.js'); static::assertFileExists( - self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/360x800-86e5e530cd7674b4f1137a418b6d0264.svg' + self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/360x800-huXlMM1.svg' ); static::assertFileExists( - self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/390x844-3f5c4bdccd303b49c95aa4344651c7e2.svg' + self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/390x844-P1xL3M0.svg' ); static::assertFileExists( - self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/600x400-a6d84c84616946feb5f92f8ca0ae4047.svg' + self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/600x400-pthMhGF.svg' ); static::assertFileExists( - self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/780x360-5bf5dc07ede9d26a9b2e9dc9f53d1959.svg' + self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/780x360-W_XcB-3.svg' ); static::assertFileExists( - self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/915x412-6141e808964c20e880f141190100d6e6.svg' - ); - static::assertFileExists( - self::$kernel->getCacheDir() . '/output/assets/pwa/1920x1920-862cb89ba358ac021badfbe32a89bbfb.svg' + self::$kernel->getCacheDir() . '/output/assets/pwa/screenshots/915x412-YUHoCJZ.svg' ); + static::assertFileExists(self::$kernel->getCacheDir() . '/output/assets/pwa/1920x1920-hiy4m6N.svg'); } } diff --git a/tests/Functional/GenerateIconsCommandTest.php b/tests/Functional/GenerateIconsCommandTest.php index 77b16c6..7e2b2ee 100644 --- a/tests/Functional/GenerateIconsCommandTest.php +++ b/tests/Functional/GenerateIconsCommandTest.php @@ -7,6 +7,7 @@ use PHPUnit\Framework\Attributes\Test; use Symfony\Component\Console\Tester\CommandTester; use function assert; +use function sprintf; /** * @internal diff --git a/tests/Functional/TakeScreenshotCommandTest.php b/tests/Functional/TakeScreenshotCommandTest.php index b8dd723..1a5d7c1 100644 --- a/tests/Functional/TakeScreenshotCommandTest.php +++ b/tests/Functional/TakeScreenshotCommandTest.php @@ -8,6 +8,7 @@ use PHPUnit\Framework\Attributes\Test; use Symfony\Component\Console\Tester\CommandTester; use function assert; +use function sprintf; /** * @internal diff --git a/tests/TestFilesystem.php b/tests/TestFilesystem.php index 002a7b5..70a7e02 100644 --- a/tests/TestFilesystem.php +++ b/tests/TestFilesystem.php @@ -7,6 +7,7 @@ use Symfony\Component\AssetMapper\Path\PublicAssetsFilesystemInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; use function dirname; +use function sprintf; final readonly class TestFilesystem implements PublicAssetsFilesystemInterface { From 6225673273203c53b0ae57bbb00c67673232cd98 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Mon, 16 Dec 2024 09:15:51 +0100 Subject: [PATCH 5/7] Fix incorrect variable naming in IconNormalizer Replaced instances of `$object` with `$data` in the normalize method to match the method's parameter declaration. Ensures consistency and correct type handling during normalization. --- src/Normalizer/IconNormalizer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Normalizer/IconNormalizer.php b/src/Normalizer/IconNormalizer.php index 3d39bc9..1043f31 100644 --- a/src/Normalizer/IconNormalizer.php +++ b/src/Normalizer/IconNormalizer.php @@ -25,13 +25,13 @@ public function __construct( */ public function normalize(mixed $data, ?string $format = null, array $context = []): array { - assert($object instanceof Icon); - $icon = $this->iconResolver->getIcon($object); - $imageType = $this->iconResolver->getType($object->type, $icon->url); + assert($data instanceof Icon); + $icon = $this->iconResolver->getIcon($data); + $imageType = $this->iconResolver->getType($data->type, $icon->url); $result = [ 'src' => $icon->url, - 'sizes' => $object->getSizeList(), + 'sizes' => $data->getSizeList(), 'type' => $imageType, 'purpose' => $data->purpose, ]; From 7131d5b40b15b48ed879c26de1a433c9a5a356cb Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Mon, 16 Dec 2024 09:18:26 +0100 Subject: [PATCH 6/7] Add NelmioSecurityBundle and minor code improvements Included NelmioSecurityBundle in composer dependencies to enhance security features. Simplified import management in PwaRuntime and improved code readability in PwaDevServerSubscriber by adjusting line formatting. These changes aim to improve maintainability and clarity. --- composer.json | 1 + src/Subscriber/PwaDevServerSubscriber.php | 3 ++- src/Twig/PwaRuntime.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d2c7326..4f01d6c 100644 --- a/composer.json +++ b/composer.json @@ -53,6 +53,7 @@ "ergebnis/phpunit-slow-test-detector": "^2.14", "infection/infection": "^0.28|^0.29", "matthiasnoback/symfony-config-test": "^5.1", + "nelmio/security-bundle": "^3.0", "php-parallel-lint/php-parallel-lint": "^1.4", "phpstan/extension-installer": "^1.1", "phpstan/phpdoc-parser": "^1.28|^2.0", diff --git a/src/Subscriber/PwaDevServerSubscriber.php b/src/Subscriber/PwaDevServerSubscriber.php index 3ae55d3..df5f936 100644 --- a/src/Subscriber/PwaDevServerSubscriber.php +++ b/src/Subscriber/PwaDevServerSubscriber.php @@ -57,7 +57,8 @@ public function onKernelRequest(RequestEvent $event): void public function onKernelResponse(ResponseEvent $event): void { - $headers = $event->getResponse()->headers; + $headers = $event->getResponse() + ->headers; if ($headers->has('X-Pwa-Dev')) { $event->stopPropagation(); } diff --git a/src/Twig/PwaRuntime.php b/src/Twig/PwaRuntime.php index a97e387..484a0aa 100644 --- a/src/Twig/PwaRuntime.php +++ b/src/Twig/PwaRuntime.php @@ -14,6 +14,7 @@ use Symfony\Component\AssetMapper\MappedAsset; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Mime\MimeTypes; +use function array_key_exists; use function sprintf; use const ENT_COMPAT; use const ENT_SUBSTITUTE; From 884a374392047a6b6defcb1b59a464b216b692ca Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Mon, 16 Dec 2024 09:21:51 +0100 Subject: [PATCH 7/7] Remove obsolete PHPStan baseline entries and update counts. Obsolete error entries were removed from the PHPStan baseline file, and counts for some existing errors were updated to reflect current analysis results. This streamlines static analysis and reduces unnecessary suppressions in the codebase. --- phpstan-baseline.neon | 61 ++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 9e9ce9f..9bb10b8 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -162,12 +162,6 @@ parameters: count: 1 path: src/Command/CreateScreenshotCommand.php - - - message: '#^Strict comparison using \!\=\= between non\-empty\-string and '''' will always evaluate to true\.$#' - identifier: notIdentical.alwaysTrue - count: 1 - path: src/Command/CreateScreenshotCommand.php - - message: '#^Cannot access offset ''data'' on mixed\.$#' identifier: offsetAccess.nonOffsetAccessible @@ -612,11 +606,6 @@ parameters: count: 1 path: src/ImageProcessor/GDImageProcessor.php - - - message: '#^Should not use node with type "Stmt_Echo", please change the code\.$#' - identifier: ekinoBannedCode.expression - path: src/ImageProcessor/GDImageProcessor.php - - message: '#^PHPDoc tag @return with type array\ is incompatible with native type string\.$#' identifier: return.phpDocType @@ -1091,6 +1080,12 @@ parameters: count: 1 path: src/Resources/config/definition/service_worker.php + - + message: '#^Cannot call method addDefaultsIfNotSet\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Resources/config/definition/service_worker.php + - message: '#^Cannot call method append\(\) on mixed\.$#' identifier: method.nonObject @@ -1100,7 +1095,7 @@ parameters: - message: '#^Cannot call method arrayNode\(\) on mixed\.$#' identifier: method.nonObject - count: 16 + count: 17 path: src/Resources/config/definition/service_worker.php - @@ -1118,7 +1113,7 @@ parameters: - message: '#^Cannot call method booleanNode\(\) on mixed\.$#' identifier: method.nonObject - count: 8 + count: 11 path: src/Resources/config/definition/service_worker.php - @@ -1148,7 +1143,7 @@ parameters: - message: '#^Cannot call method defaultFalse\(\) on mixed\.$#' identifier: method.nonObject - count: 5 + count: 6 path: src/Resources/config/definition/service_worker.php - @@ -1160,7 +1155,7 @@ parameters: - message: '#^Cannot call method defaultTrue\(\) on mixed\.$#' identifier: method.nonObject - count: 3 + count: 5 path: src/Resources/config/definition/service_worker.php - @@ -1172,7 +1167,7 @@ parameters: - message: '#^Cannot call method end\(\) on mixed\.$#' identifier: method.nonObject - count: 102 + count: 107 path: src/Resources/config/definition/service_worker.php - @@ -1202,7 +1197,7 @@ parameters: - message: '#^Cannot call method info\(\) on mixed\.$#' identifier: method.nonObject - count: 64 + count: 68 path: src/Resources/config/definition/service_worker.php - @@ -1214,7 +1209,7 @@ parameters: - message: '#^Cannot call method integerPrototype\(\) on mixed\.$#' identifier: method.nonObject - count: 1 + count: 2 path: src/Resources/config/definition/service_worker.php - @@ -1262,19 +1257,19 @@ parameters: - message: '#^Cannot call method treatFalseLike\(\) on mixed\.$#' identifier: method.nonObject - count: 10 + count: 11 path: src/Resources/config/definition/service_worker.php - message: '#^Cannot call method treatNullLike\(\) on mixed\.$#' identifier: method.nonObject - count: 10 + count: 11 path: src/Resources/config/definition/service_worker.php - message: '#^Cannot call method treatTrueLike\(\) on mixed\.$#' identifier: method.nonObject - count: 10 + count: 11 path: src/Resources/config/definition/service_worker.php - @@ -1319,6 +1314,12 @@ parameters: count: 2 path: src/Resources/config/definition/web_client.php + - + message: '#^Return type \(iterable\\) of method SpomkyLabs\\PwaBundle\\Service\\ApplicationIconCompiler\:\:getFiles\(\) should be covariant with return type \(iterable\\) of method SpomkyLabs\\PwaBundle\\Service\\FileCompilerInterface\:\:getFiles\(\)$#' + identifier: method.childReturnType + count: 1 + path: src/Service/ApplicationIconCompiler.php + - message: '#^Method SpomkyLabs\\PwaBundle\\Service\\Data\:\:getData\(\) should return string but returns mixed\.$#' identifier: return.type @@ -1343,6 +1344,18 @@ parameters: count: 1 path: src/Service/FaviconsCompiler.php + - + message: '#^Cannot access property \$sourcePath on Symfony\\Component\\AssetMapper\\MappedAsset\|null\.$#' + identifier: property.nonObject + count: 1 + path: src/Service/IconResolver.php + + - + message: '#^Parameter \#3 \$headers of class SpomkyLabs\\PwaBundle\\Service\\Data constructor expects array\, array\ given\.$#' + identifier: argument.type + count: 2 + path: src/Service/IconResolver.php + - message: '#^Parameter \#2 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' identifier: argument.type @@ -1396,3 +1409,9 @@ parameters: identifier: argument.type count: 8 path: src/SpomkyLabsPwaBundle.php + + - + message: '#^Unreachable statement \- code above always terminates\.$#' + identifier: deadCode.unreachable + count: 1 + path: tests/Functional/TakeScreenshotCommandTest.php