diff --git a/composer.json b/composer.json index 889c369..13a15b6 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ }, "require-dev": { "phpunit/phpunit": "^11.0", - "sigwin/infra": "~1.9.0" + "sigwin/infra": "~1.11.0" }, "autoload": { "psr-4": { diff --git a/psalm.baseline.xml b/psalm.baseline.xml index fdd4edc..8bdf814 100644 --- a/psalm.baseline.xml +++ b/psalm.baseline.xml @@ -1,66 +1,71 @@ - + - true === file_exists($autoloader) + - $image - $slug - $title + + + - Page + - __construct + - __construct + - GenerateCommand + + + + + + - $optional === true + - InitCommand + - $type + - $supportedStorageTypes[$type] - $supportedStorageTypes[$type] + + - $key - $options - $tag - $type - $value + + + + + - $key + @@ -76,87 +81,86 @@ - $routesVariables[$variable] + - $spec - $variable + + - arrayNode - arrayNode - arrayNode - arrayNode - arrayNode - arrayPrototype - arrayPrototype - booleanNode - booleanNode - cannotBeEmpty - cannotBeEmpty - children - children - children - defaultFalse - defaultFalse - defaultValue - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - info - isRequired - isRequired - isRequired - requiresAtLeastOneElement - scalarNode - scalarNode - scalarNode - scalarNode - scalarPrototype - scalarPrototype - scalarPrototype - setDeprecated - setDeprecated - setDeprecated - useAttributeAsKey - variableNode - variableNode - variableNode - variableNode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - arrayNode - end + - arrayNode + @@ -171,21 +175,21 @@ - $stripParameters[$name] + - $name - $route - $stripParameters[$name] + + + - $arguments - $arguments - $arguments - $arguments - $arguments + + + + + @@ -193,39 +197,29 @@ - FunctionProvider + - RelativeUrlInlineFragmentRenderer + - - environment]]]> - - - - $class - $classes - $envs - - new $class() + - iterable + - configureContainer + - Kernel - Kernel + - require $path + @@ -237,41 +231,38 @@ routes[$name]['path']]]> - $parameters[$name] + - $name + - - string - - $variable + routes[$name]['variables']]]> - $parameters[$variable] + - $parameters[$variable] - $value - $variable + + + - GlobalVariableUrlGenerator + - $path + - $name + @@ -282,134 +273,134 @@ - $path - $route + + - RouteLoader + - getAttributesMetadata - getName + + - $classMetadataFactory + - $denormalized[$id] - $item + + - CollectionNormalizer + - CollectionNormalizer + - $format + - $value + - object + - $value + - ExpressionNormalizer + - $format + - $data[$property][$fallbackLocale] - $data[$property][$locale] + + - $data[$property][$fallbackLocale] - $data[$property][$locale] + + - $data[$property] - $fallbackLocale - $locale + + + - $context[LocaleContext::LOCALE] - $context[LocaleContext::LOCALE_FALLBACK] + + - LocalizingNormalizer + - LocalizingNormalizer + - $format + - ResourceLocatorNormalizer + - $format + - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments - $arguments + + + + + + + + + + + + + + + + + + + + + + - DatabaseExtension + - IndexExtension + - $conditions - $conditions - $conditions - $conditions - $conditions + + + + + @@ -419,22 +410,18 @@ - PaginatorExtension + - - $item + - - __path]]> - imgproxyUrl]]> @@ -442,341 +429,302 @@ - ThumbnailExtension + - column - total + + - $item - $values[$id] + + - object - object + + data[$name]]]> data[$offset]]]> - __get - count + + + + + - __construct + - countBy + - $limit - $offset + + - Database - DatabaseTrait + + - $locale - $locale + + - $locale - $locale + + - $limit - $select + + localeContext->getLocale()[LocaleContext::LOCALE]]]> localeContext->getLocale()[LocaleContext::LOCALE]]]> - __construct + - $entity + - - $value - - $condition + - Database - DatabaseTrait + + - - $storage - $storage - $storage - - $key + - - $storage[$id] - - $direction - $itemAValue - $itemBValue - $total + + + - - int - - - $total - - - $total - - __construct + - __construct + - AssetQueueFileDecoder + - CachingFileDecoder + - CompositeFileDecoder + + + + - MarkdownFileDecoder + + + + - $data - array + + - YamlFileDecoder + - __construct + - $expression - $parameters - - - + - $route - $route + + - - - - - - - - - - - $variables[$variable] - - $expression - $parameters - $variable - $variables[$variable] + + - - - - - __construct + - Storage + - $locale - $locale + + - $key + cache[$this->class][$locale]]]> - $locale - $locale - $metadata[$key] - $object - $value - $value + + + + + + - T + class()]]> - denormalizer->denormalize($data, $this->class, null, $context + [ - AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES => false, - ])]]> - $object + - $context[LocaleContext::LOCALE] - $context[LocaleContext::LOCALE] + + - __construct + - StorageWithOptions + - $names + roots]]> - $root - $root + + - $root - $root + + - FilesystemStorage + - MemoryStorage + - array + - EventSubscriber + - TestController + - $body - $image - $publishedAt - $slug - $title - $image + + + + - Article + - $name - $products - $slug + + + - getDescription - method + + - $name - $parent - $products - $slug + + + + - $isoCode - $name + + - Locale + - $categories - $index - $name - $slug + + + + - $category + - ?Category + - $category !== false ? $category : null - $category !== false ? $category : null + + - getCategory - getName + + - $file - $index - $slug + + + diff --git a/src/Bridge/Symfony/DependencyInjection/CompilerPass/ConfigureDatabasesCompilerPass.php b/src/Bridge/Symfony/DependencyInjection/CompilerPass/ConfigureDatabasesCompilerPass.php index bc00007..b51c3c6 100644 --- a/src/Bridge/Symfony/DependencyInjection/CompilerPass/ConfigureDatabasesCompilerPass.php +++ b/src/Bridge/Symfony/DependencyInjection/CompilerPass/ConfigureDatabasesCompilerPass.php @@ -118,7 +118,7 @@ public function process(ContainerBuilder $container): void $container->setDefinition($databaseId, $databaseDefinition); $container->setAlias(sprintf('%1$s $%2$s', Database::class, $name), $databaseId); - $cachingDatabaseDefinition = new Definition(\Sigwin\YASSG\Database\CachingDatabase::class); + $cachingDatabaseDefinition = new Definition(Database\CachingDatabase::class); $cachingDatabaseDefinition ->setArgument(0, $name) ->setArgument(4, new Reference('sigwin_yassg.expression_language')) diff --git a/src/Bridge/Symfony/DependencyInjection/KernelExtension.php b/src/Bridge/Symfony/DependencyInjection/KernelExtension.php index 970c44f..9e8c1e9 100644 --- a/src/Bridge/Symfony/DependencyInjection/KernelExtension.php +++ b/src/Bridge/Symfony/DependencyInjection/KernelExtension.php @@ -14,9 +14,9 @@ namespace Sigwin\YASSG\Bridge\Symfony\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\Finder\Finder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; final class KernelExtension extends Extension implements PrependExtensionInterface { diff --git a/src/Bridge/Symfony/Kernel.php b/src/Bridge/Symfony/Kernel.php index add1702..8d41635 100644 --- a/src/Bridge/Symfony/Kernel.php +++ b/src/Bridge/Symfony/Kernel.php @@ -83,6 +83,9 @@ protected function configureContainer(ContainerConfigurator $container): void private function createEnvironmentClasses(string $path, array $skipBundles = []): iterable { if (is_file($path) && \in_array(realpath($path), get_included_files(), true) === false) { + /** + * @var array> $classes + */ $classes = require $path; foreach ($classes as $class => $envs) { if (($envs[$this->environment] ?? $envs['all'] ?? false) && ! \in_array($class, $skipBundles, true)) { diff --git a/src/Database/DatabaseTrait.php b/src/Database/DatabaseTrait.php index 3f9e5ce..2422aa0 100644 --- a/src/Database/DatabaseTrait.php +++ b/src/Database/DatabaseTrait.php @@ -105,7 +105,7 @@ private function conditionArrayToString(array $condition): ?string return null; } - array_walk($condition, static function (mixed &$value, string $key): void { + array_walk($condition, static function (float|int|string &$value, string $key): void { $value = sprintf('%1$s == "%2$s"', $key, $value); }); diff --git a/src/Permutator.php b/src/Permutator.php index 34ec08f..792b67b 100644 --- a/src/Permutator.php +++ b/src/Permutator.php @@ -28,6 +28,12 @@ public function __construct(private array $routes, private DatabaseProvider $pro */ public function permute(): \Traversable { + /** @var array{ + * catalog?: array, + * defaults?: array, + * options?: array{headers?: array, skip?: bool}, skip?: bool + * } $spec + */ foreach ($this->routes as $route => $spec) { if ($spec['options']['skip'] ?? $spec['skip'] ?? false) { continue; diff --git a/tests/functional/init/fixtures/assets/app.15e42ade.js b/tests/functional/init/fixtures/assets/app.15e42ade.js deleted file mode 100644 index 4153233..0000000 --- a/tests/functional/init/fixtures/assets/app.15e42ade.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[524],{412:()=>{document.addEventListener("DOMContentLoaded",(()=>{console.log("DOM ready!")}))}},e=>{var n;n=412,e(e.s=n)}]); \ No newline at end of file diff --git a/tests/functional/init/fixtures/assets/app.2289004f.js b/tests/functional/init/fixtures/assets/app.2289004f.js new file mode 100644 index 0000000..f6f59dd --- /dev/null +++ b/tests/functional/init/fixtures/assets/app.2289004f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[524],{410:()=>{document.addEventListener("DOMContentLoaded",(()=>{console.log("DOM ready!")}))}},e=>{var n;n=410,e(e.s=n)}]); \ No newline at end of file diff --git a/tests/functional/init/fixtures/assets/entrypoints.json b/tests/functional/init/fixtures/assets/entrypoints.json index 8ad9d4b..690bbc2 100644 --- a/tests/functional/init/fixtures/assets/entrypoints.json +++ b/tests/functional/init/fixtures/assets/entrypoints.json @@ -2,8 +2,8 @@ "entrypoints": { "app": { "js": [ - "/sub/dir/another/assets/runtime.1e02b157.js", - "/sub/dir/another/assets/app.15e42ade.js" + "/sub/dir/another/assets/runtime.ce912fa2.js", + "/sub/dir/another/assets/app.2289004f.js" ], "css": [ "/sub/dir/another/assets/app.2e773b84.css" @@ -11,8 +11,8 @@ } }, "integrity": { - "/sub/dir/another/assets/runtime.1e02b157.js": "sha384-5jxdqASILzXK9ebUc2vUrPNybxKD2ordJReQ1wZL1EOs6eTC2BPyFky4TMPa6A09", - "/sub/dir/another/assets/app.15e42ade.js": "sha384-VnBf9J3ovFKQ4dtek5PGbrcFjIE8bz/MCQnHze9cOEKVi67oXYasIj1ZX0y8tNB5", + "/sub/dir/another/assets/runtime.ce912fa2.js": "sha384-akH8de+2IXVp4vYQJY5TWpLUXNL8/EUBZ0KDgJUIFyHEJiRkwDje0b0SK7WFzRJt", + "/sub/dir/another/assets/app.2289004f.js": "sha384-LONSz9M3gUR3ykQcfpwcgRary/XUFLct2+mz7DgZ6M57VACJmnRewzIPGjjANBE2", "/sub/dir/another/assets/app.2e773b84.css": "sha384-t56F6yDakn/jYRHL6uxVbMaf/JtnF0k7yEall1cerAGjo0kfE3W7foG5+n1Ynxd5" } } \ No newline at end of file diff --git a/tests/functional/init/fixtures/assets/manifest.json b/tests/functional/init/fixtures/assets/manifest.json index 6b05167..900447b 100644 --- a/tests/functional/init/fixtures/assets/manifest.json +++ b/tests/functional/init/fixtures/assets/manifest.json @@ -1,6 +1,6 @@ { "assets/app.css": "/sub/dir/another/assets/app.2e773b84.css", - "assets/app.js": "/sub/dir/another/assets/app.15e42ade.js", - "assets/runtime.js": "/sub/dir/another/assets/runtime.1e02b157.js", + "assets/app.js": "/sub/dir/another/assets/app.2289004f.js", + "assets/runtime.js": "/sub/dir/another/assets/runtime.ce912fa2.js", "assets/images/sigwin.svg": "/sub/dir/another/assets/images/sigwin.6f9a3d5b.svg" } \ No newline at end of file diff --git a/tests/functional/init/fixtures/assets/runtime.1e02b157.js b/tests/functional/init/fixtures/assets/runtime.ce912fa2.js similarity index 94% rename from tests/functional/init/fixtures/assets/runtime.1e02b157.js rename to tests/functional/init/fixtures/assets/runtime.ce912fa2.js index 0ca328c..124c41f 100644 --- a/tests/functional/init/fixtures/assets/runtime.1e02b157.js +++ b/tests/functional/init/fixtures/assets/runtime.ce912fa2.js @@ -1 +1 @@ -(()=>{"use strict";var e,r={},o={};function t(e){var n=o[e];if(void 0!==n)return n.exports;var a=o[e]={exports:{}};return r[e](a,a.exports,t),a.exports}t.m=r,e=[],t.O=(r,o,n,a)=>{if(!o){var i=1/0;for(u=0;u=a)&&Object.keys(t.O).every((e=>t.O[e](o[f])))?o.splice(f--,1):(l=!1,a0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[o,n,a]},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.p="/sub/dir/another/assets/",(()=>{var e={688:0};t.O.j=r=>0===e[r];var r=(r,o)=>{var n,a,[i,l,f]=o,s=0;if(i.some((r=>0!==e[r]))){for(n in l)t.o(l,n)&&(t.m[n]=l[n]);if(f)var u=f(t)}for(r&&r(o);s{"use strict";var e,r={},o={};function t(e){var n=o[e];if(void 0!==n)return n.exports;var a=o[e]={exports:{}};return r[e](a,a.exports,t),a.exports}t.m=r,e=[],t.O=(r,o,n,a)=>{if(!o){var i=1/0;for(u=0;u=a)&&Object.keys(t.O).every((e=>t.O[e](o[f])))?o.splice(f--,1):(l=!1,a0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[o,n,a]},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.p="/sub/dir/another/assets/",(()=>{var e={121:0};t.O.j=r=>0===e[r];var r=(r,o)=>{var n,a,[i,l,f]=o,s=0;if(i.some((r=>0!==e[r]))){for(n in l)t.o(l,n)&&(t.m[n]=l[n]);if(f)var u=f(t)}for(r&&r(o);s - +