diff --git a/README.md b/README.md index 84147a2..853e05c 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ Progressive Web App for Symfony =============================== -![Build Status](https://github.com/spomky-labs/phpwa/workflows/Coding%20Standards/badge.svg) -![Build Status](https://github.com/spomky-labs/phpwa/workflows/Static%20Analyze/badge.svg) +![Build Status](https://github.com/Spomky-Labs/phpwa/workflows/Coding%20Standards/badge.svg) +![Build Status](https://github.com/Spomky-Labs/phpwa/workflows/Static%20Analyze/badge.svg) -![Build Status](https://github.com/spomky-labs/phpwa/workflows/Unit%20and%20Functional%20Tests/badge.svg) -![Build Status](https://github.com/spomky-labs/phpwa/workflows/Rector%20Checkstyle/badge.svg) +![Build Status](https://github.com/Spomky-Labs/phpwa/workflows/Unit%20and%20Functional%20Tests/badge.svg) +![Build Status](https://github.com/Spomky-Labs/phpwa/workflows/Rector%20Checkstyle/badge.svg) -[![Latest Stable Version](https://poser.pugx.org/spomky-labs/phpwa/v/stable.png)](https://packagist.org/packages/spomky-labs/phpwa) -[![Total Downloads](https://poser.pugx.org/spomky-labs/phpwa/downloads.png)](https://packagist.org/packages/spomky-labs/phpwa) -[![Latest Unstable Version](https://poser.pugx.org/spomky-labs/phpwa/v/unstable.png)](https://packagist.org/packages/spomky-labs/phpwa) -[![License](https://poser.pugx.org/spomky-labs/phpwa/license.png)](https://packagist.org/packages/spomky-labs/phpwa) +[![Latest Stable Version](https://poser.pugx.org/Spomky-Labs/phpwa/v/stable.png)](https://packagist.org/packages/Spomky-Labs/phpwa) +[![Total Downloads](https://poser.pugx.org/Spomky-Labs/phpwa/downloads.png)](https://packagist.org/packages/Spomky-Labs/phpwa) +[![Latest Unstable Version](https://poser.pugx.org/Spomky-Labs/phpwa/v/unstable.png)](https://packagist.org/packages/Spomky-Labs/phpwa) +[![License](https://poser.pugx.org/Spomky-Labs/phpwa/license.png)](https://packagist.org/packages/Spomky-Labs/phpwa) -[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/spomky-labs/phpwa/badge)](https://api.securityscorecards.dev/projects/github.com/spomky-labs/phpwa) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/Spomky-Labs/phpwa/badge)](https://api.securityscorecards.dev/projects/github.com/Spomky-Labs/phpwa) # Scope -This bundle provides the [spomky-labs/phpwa](https://github.com/spomky-labs/phpwa) bundle for Symfony. +This bundle provides the [Spomky-Labs/phpwa](https://github.com/Spomky-Labs/phpwa) bundle for Symfony. This will help you to generate Progressive Web Apps (PWA) Manifests and assets (icons or screenshots). Also, it will help you to generate Service Workers based on [Workbox](https://developers.google.com/web/tools/workbox). @@ -27,7 +27,7 @@ Please have a look at the [Web app manifests](https://developer.mozilla.org/en-U Install the bundle with Composer: ```bash -composer require spomky-labs/phpwa +composer require Spomky-Labs/phpwa ``` This project follows the [semantic versioning](http://semver.org/) strictly. @@ -205,7 +205,7 @@ It can be served by Asset Mapper. ```yaml # config/packages/phpwa.yaml pwa: - serviceworker: 'script/service-worker.js' + serviceworker: 'sw.js' # File located in assets/sw.js ``` The bundle provides a Service Worker based on [Workbox](https://developers.google.com/web/tools/workbox). @@ -236,7 +236,7 @@ You can disable this feature by calling the Twig function with `false` as argume The injection method uses a CDN version of `workbox-window`. You can install this package with the following command. -The inject code will detect the presence of the package and will use it if available. +The injected code will detect the presence of the package and will use it if available. ```bash symfony console importmap:require workbox-window @@ -246,9 +246,9 @@ See https://developer.chrome.com/docs/workbox/using-workbox-window for more info ### Workbox Precaching -If you use the provided Service Worker, you can enable the Workbox Precaching feature. -It is enabled by default. You can disable it by removing the placeholder in the service worker file. -By default, the placeholder is `//PRECACHING_PLACEHOLDER`. +By default, the Workbox Precaching feature is enabled. +You can disable it by removing the placeholder in the service worker file. +The placeholder is `//PRECACHING_PLACEHOLDER` and can be changed from the bundle configuration. ### Workbox Warm Cache @@ -299,9 +299,9 @@ If you really love that project and the work I have done or if you want I priori # Contributing Requests for new features, bug fixed and all other ideas to make this project useful are welcome. -The best contribution you could provide is by fixing the [opened issues where help is wanted](https://github.com/spomky-labs/phpwa/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). +The best contribution you could provide is by fixing the [opened issues where help is wanted](https://github.com/Spomky-Labs/phpwa/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). -Please report all issues in [the main repository](https://github.com/spomky-labs/phpwa/issues). +Please report all issues in [the main repository](https://github.com/Spomky-Labs/phpwa/issues). Please make sure to [follow these best practices](.github/CONTRIBUTING.md). diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index aab4991..0a2d073 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,2 +1,446 @@ parameters: - ignoreErrors: [] + ignoreErrors: + - + message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: src/Command/CreateIconsCommand.php + + - + message: "#^Cannot cast mixed to int\\.$#" + count: 1 + path: src/Command/CreateIconsCommand.php + + - + message: "#^Cannot cast mixed to string\\.$#" + count: 1 + path: src/Command/CreateIconsCommand.php + + - + message: "#^Parameter \\#1 \\$image of method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\ImageProcessor\\:\\:process\\(\\) expects string, string\\|false given\\.$#" + count: 1 + path: src/Command/CreateIconsCommand.php + + - + message: "#^Parameter \\#1 \\$mimeType of method Symfony\\\\Component\\\\Mime\\\\MimeTypes\\:\\:getExtensions\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/Command/CreateIconsCommand.php + + - + message: "#^Parameter \\#1 \\$source of method SpomkyLabs\\\\PwaBundle\\\\Command\\\\CreateIconsCommand\\:\\:getSourcePath\\(\\) expects string, mixed given\\.$#" + count: 1 + path: src/Command/CreateIconsCommand.php + + - + message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" + count: 1 + path: src/Command/CreateIconsCommand.php + + - + message: "#^Parameter \\#4 \\$format of method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\ImageProcessor\\:\\:process\\(\\) expects string\\|null, mixed given\\.$#" + count: 1 + path: src/Command/CreateIconsCommand.php + + - + message: "#^Parameter \\#5 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" + count: 1 + path: src/Command/CreateIconsCommand.php + + - + message: "#^Cannot cast mixed to int\\.$#" + count: 4 + path: src/Command/CreateScreenshotCommand.php + + - + message: "#^Cannot cast mixed to string\\.$#" + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: "#^Parameter \\#1 \\$image of method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\ImageProcessor\\:\\:getSizes\\(\\) expects string, string\\|false given\\.$#" + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: "#^Parameter \\#1 \\$image of method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\ImageProcessor\\:\\:process\\(\\) expects string, string\\|false given\\.$#" + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: "#^Parameter \\#1 \\$mimeType of method Symfony\\\\Component\\\\Mime\\\\MimeTypes\\:\\:getExtensions\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: "#^Parameter \\#2 \\$uri of method Symfony\\\\Component\\\\Panther\\\\Client\\:\\:request\\(\\) expects string, mixed given\\.$#" + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: "#^Parameter \\#4 \\$format of method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\ImageProcessor\\:\\:process\\(\\) expects string\\|null, mixed given\\.$#" + count: 1 + path: src/Command/CreateScreenshotCommand.php + + - + message: "#^Parameter \\#1 \\$files of method Symfony\\\\Component\\\\Filesystem\\\\Filesystem\\:\\:exists\\(\\) expects iterable\\|string, mixed given\\.$#" + count: 1 + path: src/Command/CreateServiceWorkerCommand.php + + - + message: "#^Parameter \\#1 \\$sourcePath of method Symfony\\\\Component\\\\AssetMapper\\\\AssetMapperInterface\\:\\:getAssetFromSourcePath\\(\\) expects string, mixed given\\.$#" + count: 1 + path: src/Command/CreateServiceWorkerCommand.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\|string given\\.$#" + count: 1 + path: src/Command/CreateServiceWorkerCommand.php + + - + message: "#^Parameter \\#2 \\$targetFile of method Symfony\\\\Component\\\\Filesystem\\\\Filesystem\\:\\:copy\\(\\) expects string, mixed given\\.$#" + count: 1 + path: src/Command/CreateServiceWorkerCommand.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + count: 4 + path: src/DependencyInjection/Configuration.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:append\\(\\)\\.$#" + count: 1 + path: src/DependencyInjection/Configuration.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:arrayNode\\(\\)\\.$#" + count: 1 + path: src/DependencyInjection/Configuration.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:beforeNormalization\\(\\)\\.$#" + count: 1 + path: src/DependencyInjection/Configuration.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:end\\(\\)\\.$#" + count: 1 + path: src/DependencyInjection/Configuration.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:scalarNode\\(\\)\\.$#" + count: 4 + path: src/DependencyInjection/Configuration.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\DependencyInjection\\\\SpomkyLabsPwaExtension\\:\\:getConfiguration\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" + count: 1 + path: src/DependencyInjection/SpomkyLabsPwaExtension.php + + - + message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\File has an uninitialized property \\$accept\\. Give it default value or assign it in the constructor\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + count: 1 + path: src/Dto/FileHandler.php + + - + message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\Icon has an uninitialized property \\$sizeList\\. Give it default value or assign it in the constructor\\.$#" + 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\\.$#" + count: 1 + path: src/Dto/Icon.php + + - + message: "#^Property SpomkyLabs\\\\PwaBundle\\\\Dto\\\\LaunchHandler\\:\\:\\$clientMode type has no value type specified in iterable type array\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + count: 1 + path: src/Dto/Manifest.php + + - + message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ProtocolHandler has an uninitialized property \\$protocol\\. Give it default value or assign it in the constructor\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + count: 1 + path: src/Dto/RelatedApplication.php + + - + message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ScopeExtension has an uninitialized property \\$origin\\. Give it default value or assign it in the constructor\\.$#" + count: 1 + path: src/Dto/ScopeExtension.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\\.$#" + 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\\.$#" + count: 1 + path: src/Dto/ServiceWorker.php + + - + message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ServiceWorker has an uninitialized property \\$offlineFallbackPlaceholder\\. Give it default value or assign it in the constructor\\.$#" + count: 1 + path: src/Dto/ServiceWorker.php + + - + message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ServiceWorker has an uninitialized property \\$precachingPlaceholder\\. Give it default value or assign it in the constructor\\.$#" + count: 1 + path: src/Dto/ServiceWorker.php + + - + message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ServiceWorker has an uninitialized property \\$src\\. Give it default value or assign it in the constructor\\.$#" + count: 1 + path: src/Dto/ServiceWorker.php + + - + message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ServiceWorker has an uninitialized property \\$warmCachePlaceholder\\. Give it default value or assign it in the constructor\\.$#" + count: 1 + path: src/Dto/ServiceWorker.php + + - + message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\ServiceWorker has an uninitialized property \\$widgetsPlaceholder\\. Give it default value or assign it in the constructor\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + 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\\.$#" + count: 1 + path: src/Dto/Widget.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\GDImageProcessor\\:\\:process\\(\\) should return string but returns string\\|false\\.$#" + count: 1 + path: src/ImageProcessor/GDImageProcessor.php + + - + message: "#^Parameter \\#1 \\$image of function imagepng expects GdImage, GdImage\\|false given\\.$#" + count: 1 + path: src/ImageProcessor/GDImageProcessor.php + + - + message: "#^Parameter \\#1 \\$image of function imagesavealpha expects GdImage, GdImage\\|false given\\.$#" + count: 1 + path: src/ImageProcessor/GDImageProcessor.php + + - + message: "#^Parameter \\#1 \\$image of function imagesx expects GdImage, GdImage\\|false given\\.$#" + count: 1 + path: src/ImageProcessor/GDImageProcessor.php + + - + message: "#^Parameter \\#1 \\$image of function imagesy expects GdImage, GdImage\\|false given\\.$#" + count: 1 + path: src/ImageProcessor/GDImageProcessor.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\IconNormalizer\\:\\:normalize\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/IconNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\IconNormalizer\\:\\:normalize\\(\\) should return array\\{src\\: string, sizes\\?\\: string, type\\?\\: string, purpose\\?\\: string\\} but returns array\\\\.$#" + count: 1 + path: src/Normalizer/IconNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\IconNormalizer\\:\\:supportsNormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/IconNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ScreenshotNormalizer\\:\\:normalize\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/ScreenshotNormalizer.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\\\\.$#" + count: 1 + path: src/Normalizer/ScreenshotNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ScreenshotNormalizer\\:\\:supportsNormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/ScreenshotNormalizer.php + + - + message: "#^Parameter \\#1 \\$haystack of function str_starts_with expects string, string\\|null given\\.$#" + count: 1 + path: src/Normalizer/ScreenshotNormalizer.php + + - + message: "#^Parameter \\#1 \\$image of method SpomkyLabs\\\\PwaBundle\\\\ImageProcessor\\\\ImageProcessor\\:\\:getSizes\\(\\) expects string, string\\|false given\\.$#" + count: 1 + path: src/Normalizer/ScreenshotNormalizer.php + + - + message: "#^Parameter \\#1 \\$logicalPath of method Symfony\\\\Component\\\\AssetMapper\\\\AssetMapperInterface\\:\\:getAsset\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/Normalizer/ScreenshotNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ServiceWorkerNormalizer\\:\\:normalize\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/ServiceWorkerNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ServiceWorkerNormalizer\\:\\:normalize\\(\\) should return array\\{scope\\?\\: string, src\\: string, use_cache\\?\\: bool\\} but returns array\\\\.$#" + count: 1 + path: src/Normalizer/ServiceWorkerNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ServiceWorkerNormalizer\\:\\:supportsNormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/ServiceWorkerNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ShortcutNormalizer\\:\\:normalize\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/ShortcutNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ShortcutNormalizer\\:\\:normalize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/ShortcutNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ShortcutNormalizer\\:\\:normalize\\(\\) should return array\\{description\\?\\: string, icons\\?\\: array, name\\: string, short_name\\?\\: string, url\\: string\\} but returns array\\\\.$#" + count: 1 + path: src/Normalizer/ShortcutNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\ShortcutNormalizer\\:\\:supportsNormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/ShortcutNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\UrlNormalizer\\:\\:normalize\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/UrlNormalizer.php + + - + message: "#^Method SpomkyLabs\\\\PwaBundle\\\\Normalizer\\\\UrlNormalizer\\:\\:supportsNormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Normalizer/UrlNormalizer.php diff --git a/src/Command/CreateServiceWorkerCommand.php b/src/Command/CreateServiceWorkerCommand.php index 7d35093..cbaa2f1 100644 --- a/src/Command/CreateServiceWorkerCommand.php +++ b/src/Command/CreateServiceWorkerCommand.php @@ -48,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io->title('PWA Service Worker Generator'); $dest = $input->getArgument('output'); - $force = $input->getOption('force'); + $force = (bool) $input->getOption('force'); if ($this->filesystem->exists($dest) && ! $force) { $io->info('Service worker already exists. Skipping.'); diff --git a/src/Dto/Icon.php b/src/Dto/Icon.php index 04854c7..1c8c65c 100644 --- a/src/Dto/Icon.php +++ b/src/Dto/Icon.php @@ -8,12 +8,12 @@ final class Icon { - public null|string $src = null; + public string $src; - #[SerializedName('sizes')] /** * @var array */ + #[SerializedName('sizes')] public array $sizeList; public null|string $format = null; diff --git a/src/Dto/Manifest.php b/src/Dto/Manifest.php index 9080178..2b9adf8 100644 --- a/src/Dto/Manifest.php +++ b/src/Dto/Manifest.php @@ -75,10 +75,10 @@ final class Manifest */ public array $screenshots = []; - #[SerializedName('file_handlers')] /** * @var array */ + #[SerializedName('file_handlers')] public array $fileHandlers = []; #[SerializedName('launch_handler')] diff --git a/src/Dto/ServiceWorker.php b/src/Dto/ServiceWorker.php index b81a5fd..3df233a 100644 --- a/src/Dto/ServiceWorker.php +++ b/src/Dto/ServiceWorker.php @@ -32,9 +32,9 @@ final class ServiceWorker #[SerializedName('offline_fallback')] public null|Url $offlineFallback = null; - #[SerializedName('warm_cache_urls')] /** * @var array */ + #[SerializedName('warm_cache_urls')] public array $warmCacheUrls = []; } diff --git a/src/Normalizer/IconNormalizer.php b/src/Normalizer/IconNormalizer.php index 5397bfc..b591849 100644 --- a/src/Normalizer/IconNormalizer.php +++ b/src/Normalizer/IconNormalizer.php @@ -18,6 +18,9 @@ public function __construct( ) { } + /** + * @return array{src: string, sizes?: string, type?: string, purpose?: string} + */ public function normalize(mixed $object, string $format = null, array $context = []): array { assert($object instanceof Icon); diff --git a/src/Normalizer/ScreenshotNormalizer.php b/src/Normalizer/ScreenshotNormalizer.php index 3570395..22ef59f 100644 --- a/src/Normalizer/ScreenshotNormalizer.php +++ b/src/Normalizer/ScreenshotNormalizer.php @@ -20,6 +20,9 @@ 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 { assert($object instanceof Screenshot); diff --git a/src/Normalizer/ServiceWorkerNormalizer.php b/src/Normalizer/ServiceWorkerNormalizer.php index 75d0639..d7c78da 100644 --- a/src/Normalizer/ServiceWorkerNormalizer.php +++ b/src/Normalizer/ServiceWorkerNormalizer.php @@ -16,6 +16,9 @@ public function __construct( ) { } + /** + * @return array{scope?: string, src: string, use_cache?: bool} + */ public function normalize(mixed $object, string $format = null, array $context = []): array { assert($object instanceof ServiceWorker); diff --git a/src/Normalizer/ShortcutNormalizer.php b/src/Normalizer/ShortcutNormalizer.php index 400d5d7..d219d75 100644 --- a/src/Normalizer/ShortcutNormalizer.php +++ b/src/Normalizer/ShortcutNormalizer.php @@ -14,6 +14,9 @@ final class ShortcutNormalizer implements NormalizerInterface, NormalizerAwareIn { use NormalizerAwareTrait; + /** + * @return array{description?: string, icons?: array, name: string, short_name?: string, url: string} + */ public function normalize(mixed $object, string $format = null, array $context = []): array { assert($object instanceof Shortcut); diff --git a/src/Normalizer/UrlNormalizer.php b/src/Normalizer/UrlNormalizer.php index 0e563f9..cfb54b9 100644 --- a/src/Normalizer/UrlNormalizer.php +++ b/src/Normalizer/UrlNormalizer.php @@ -24,11 +24,11 @@ public function __construct( ) { } - public function normalize(mixed $object, string $format = null, array $context = []): ?string + public function normalize(mixed $object, string $format = null, array $context = []): string { assert($object instanceof Url); - if (! str_starts_with($object->path, '/') && ! filter_var($object->path, FILTER_VALIDATE_URL)) { + if (! str_starts_with($object->path, '/') && filter_var($object->path, FILTER_VALIDATE_URL) === false) { return $this->router->generate($object->path, $object->params, $this->referenceType); } diff --git a/src/Twig/PwaRuntime.php b/src/Twig/PwaRuntime.php index 209b81b..1a09fd7 100644 --- a/src/Twig/PwaRuntime.php +++ b/src/Twig/PwaRuntime.php @@ -32,7 +32,7 @@ public function __construct( } /** - * @param array $swAttributes + * @param array $swAttributes */ public function load( bool $injectThemeColor = true, @@ -58,7 +58,7 @@ private function injectThemeColor(string $output, bool $themeColor): string } /** - * @param array $swAttributes + * @param array $swAttributes */ private function injectServiceWorker(string $output, bool $injectSW, array $swAttributes): string { @@ -129,7 +129,7 @@ private function getIconInfo(Icon $icon): array $format = $this->getFormat($icon, $asset); } if ($url === null) { - $url = $icon; + $url = $icon->src; } return [ @@ -152,6 +152,9 @@ private function getFormat(Icon $object, ?MappedAsset $asset): ?string return $mime->guessMimeType($asset->sourcePath); } + /** + * @param array $attributes + */ private function createAttributesString(array $attributes): string { $attributeString = '';