diff --git a/composer.json b/composer.json index 991ec97d..9d625b2c 100644 --- a/composer.json +++ b/composer.json @@ -39,8 +39,8 @@ "symfony/twig-bundle": "^6.4 || ^7.4 || ^8.0", "symfony/ux-autocomplete": "^2.17", "symfony/ux-icons": "^2.20", - "symfony/ux-live-component": "^2.17", - "symfony/ux-twig-component": "^2.17", + "symfony/ux-live-component": "^2.17 || ^3.0", + "symfony/ux-twig-component": "^2.17 || ^3.0", "twig/twig": "^2.15 || ^3.0", "webmozart/assert": "^1.9" }, @@ -48,8 +48,8 @@ "doctrine/doctrine-fixtures-bundle": "^4.3", "matthiasnoback/symfony-config-test": "^6.1", "matthiasnoback/symfony-dependency-injection-test": "^6.1.0", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-symfony": "^1.3", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-symfony": "^2.0", "phpunit/phpunit": "^10.5", "sylius-labs/coding-standard": "^4.0", "symfony/browser-kit": "^6.4 || ^7.4 || ^8.0", diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index f299b5cb..4da9c856 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -3,6 +3,8 @@ twig: twig_component: anonymous_template_directory: 'components/' + defaults: + App\Twig\Component\: 'components/' when@test: twig: diff --git a/monorepo-builder.php b/monorepo-builder.php index 7a7b9007..ec0a0a31 100644 --- a/monorepo-builder.php +++ b/monorepo-builder.php @@ -20,8 +20,8 @@ ComposerJsonSection::REQUIRE => [ ], ComposerJsonSection::REQUIRE_DEV => [ - 'phpstan/phpstan' => '^1.10', - 'phpstan/phpstan-symfony' => '^1.3', + 'phpstan/phpstan' => '^2.1', + 'phpstan/phpstan-symfony' => '^2.0', 'symfony/debug-bundle' => '^6.4 || ^7.4 || ^8.0', 'symfony/flex' => '^2.4', 'symplify/monorepo-builder' => '11.2.*', diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 8b23813b..fa60158f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,16 +1,55 @@ parameters: ignoreErrors: - - message: "#^Call to method arrayNode\\(\\) on an unknown class Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeBuilder\\\\.$#" + message: '#^Call to function is_string\(\) with string will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType count: 1 - path: src/TwigExtra/src/Symfony/DependencyInjection/Configuration.php + path: src/TwigHooks/src/Bag/DataBag.php - - message: "#^Call to method arrayNode\\(\\) on an unknown class Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeBuilder\\\\.$#" - count: 2 - path: src/TwigHooks/src/DependencyInjection/Configuration.php + message: '#^Parameter \#1 \$values of method Symfony\\Component\\Console\\Completion\\CompletionSuggestions\:\:suggestValues\(\) expects list\, array\ given\.$#' + identifier: argument.type + count: 1 + path: src/TwigHooks/src/Console/Command/DebugTwigHooksCommand.php + + - + message: '#^Call to function is_string\(\) with string will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 + path: src/TwigHooks/src/Hookable/Metadata/HookableMetadata.php + + - + message: '#^Trait Sylius\\TwigHooks\\LiveComponent\\HookableLiveComponentTrait is used zero times and is not analysed\.$#' + identifier: trait.unused + count: 1 + path: src/TwigHooks/src/LiveComponent/HookableLiveComponentTrait.php + + - + message: '#^Method Sylius\\TwigHooks\\LiveComponent\\Hydration\\DataBagHydrationExtension\:\:hydrate\(\) never returns null so it can be removed from the return type\.$#' + identifier: return.unusedType + count: 1 + path: src/TwigHooks/src/LiveComponent/Hydration/DataBagHydrationExtension.php + + - + message: '#^Property Sylius\\TwigHooks\\Profiler\\HooksDataCollector\:\:\$profile on left side of \?\?\= is not nullable nor uninitialized\.$#' + identifier: nullCoalesce.initializedProperty + count: 1 + path: src/TwigHooks/src/Profiler/HooksDataCollector.php + + - + message: '#^Instanceof between Sylius\\TwigHooks\\Hookable\\AbstractHookable and Sylius\\TwigHooks\\Hookable\\AbstractHookable will always evaluate to true\.$#' + identifier: instanceof.alwaysTrue + count: 1 + path: src/TwigHooks/src/Registry/HookablesRegistry.php - - message: "#^Call to method booleanNode\\(\\) on an unknown class Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeBuilder\\\\.$#" + message: '#^Trait Sylius\\TwigHooks\\Twig\\Component\\HookableComponentTrait is used zero times and is not analysed\.$#' + identifier: trait.unused count: 1 - path: src/TwigHooks/src/DependencyInjection/Configuration.php + path: src/TwigHooks/src/Twig/Component/HookableComponentTrait.php + + - + message: '#^Call to function method_exists\(\) with Twig\\Parser and ''parseExpression'' will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 2 + path: src/TwigHooks/src/Twig/TokenParser/HookTokenParser.php diff --git a/src/AdminUi/tests/Functional/.application/config/packages/twig_component.yaml b/src/AdminUi/tests/Functional/.application/config/packages/twig_component.yaml new file mode 100644 index 00000000..810c72cb --- /dev/null +++ b/src/AdminUi/tests/Functional/.application/config/packages/twig_component.yaml @@ -0,0 +1,4 @@ +twig_component: + anonymous_template_directory: 'components/' + defaults: + App\Twig\Component\: 'components/' diff --git a/src/BootstrapAdminUi/composer.json b/src/BootstrapAdminUi/composer.json index f264af7e..92b8256e 100644 --- a/src/BootstrapAdminUi/composer.json +++ b/src/BootstrapAdminUi/composer.json @@ -17,7 +17,7 @@ "symfony/stimulus-bundle": "^2.17", "symfony/ux-autocomplete": "^2.17", "symfony/ux-icons": "^2.20", - "symfony/ux-live-component": "^2.17" + "symfony/ux-live-component": "^2.17 || ^3.0" }, "require-dev": { "doctrine/doctrine-bundle": "^2.13 || ^3.0 || ^4.0", diff --git a/src/BootstrapAdminUi/tests/Functional/.application/config/packages/twig_component.yaml b/src/BootstrapAdminUi/tests/Functional/.application/config/packages/twig_component.yaml new file mode 100644 index 00000000..810c72cb --- /dev/null +++ b/src/BootstrapAdminUi/tests/Functional/.application/config/packages/twig_component.yaml @@ -0,0 +1,4 @@ +twig_component: + anonymous_template_directory: 'components/' + defaults: + App\Twig\Component\: 'components/' diff --git a/src/TwigExtra/composer.json b/src/TwigExtra/composer.json index 0352930c..2856b2a6 100644 --- a/src/TwigExtra/composer.json +++ b/src/TwigExtra/composer.json @@ -17,7 +17,7 @@ "php": "^8.1", "symfony/http-kernel": "^6.4 || ^7.4 || ^8.0", "symfony/twig-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/ux-twig-component": "^2.17" + "symfony/ux-twig-component": "^2.17 || ^3.0" }, "require-dev": { "matthiasnoback/symfony-dependency-injection-test": "^6.1.0", diff --git a/src/TwigExtra/tests/Functional/.application/config/packages/twig_component.yaml b/src/TwigExtra/tests/Functional/.application/config/packages/twig_component.yaml new file mode 100644 index 00000000..810c72cb --- /dev/null +++ b/src/TwigExtra/tests/Functional/.application/config/packages/twig_component.yaml @@ -0,0 +1,4 @@ +twig_component: + anonymous_template_directory: 'components/' + defaults: + App\Twig\Component\: 'components/' diff --git a/src/TwigHooks/composer.json b/src/TwigHooks/composer.json index 4bd963dd..6317603d 100644 --- a/src/TwigHooks/composer.json +++ b/src/TwigHooks/composer.json @@ -21,8 +21,8 @@ "symfony/expression-language": "^6.4 || ^7.4 || ^8.0", "symfony/http-kernel": "^6.4 || ^7.4 || ^8.0", "symfony/stopwatch": "^6.4 || ^7.4 || ^8.0", - "symfony/ux-live-component": "^2.17", - "symfony/ux-twig-component": "^2.17", + "symfony/ux-live-component": "^2.17 || ^3.0", + "symfony/ux-twig-component": "^2.17 || ^3.0", "symfony/twig-bundle": "^6.4 || ^7.4 || ^8.0", "twig/twig": "^2.15 || ^3.0", "webmozart/assert": "^1.9"