From 93be49cb17432098a0a2cc6f116d7e7fc7422734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Chru=C5=9Bciel?= Date: Mon, 4 Jul 2022 17:18:38 +0200 Subject: [PATCH 1/4] [Maintenance] Allow flex plugin during plugin installation --- composer.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/composer.json b/composer.json index 87804e098..0d0ba7619 100644 --- a/composer.json +++ b/composer.json @@ -54,6 +54,9 @@ "replace": { "sylius/resource": "self.version" }, + "conflict": { + "phpstan/phpdoc-parser": "^1.6.0" + }, "require-dev": { "doctrine/orm": "^2.5", "lchrusciel/api-test-case": "^5.0", @@ -80,6 +83,12 @@ "doctrine/orm": "^2.5", "sylius/locale": "^1.0" }, + "config": { + "allow-plugins": { + "symfony/flex": true, + "dealerdirect/phpcodesniffer-composer-installer": false + } + }, "extra": { "branch-alias": { "dev-master": "1.9-dev" From aa3cda7730b7243fac0a7f9bb1a8e1a225de826f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Chru=C5=9Bciel?= Date: Tue, 5 Jul 2022 10:53:54 +0200 Subject: [PATCH 2/4] [Maintenance] Execution of easy-coding-standard --- src/Bundle/AbstractResourceBundle.php | 12 +- src/Bundle/Controller/EventDispatcher.php | 12 +- .../Controller/EventDispatcherInterface.php | 10 +- src/Bundle/Controller/FlashHelper.php | 4 +- .../Controller/FlashHelperInterface.php | 2 +- src/Bundle/Controller/ParametersParser.php | 6 +- src/Bundle/Controller/RedirectHandler.php | 6 +- .../Controller/RequestConfiguration.php | 2 +- .../RequestConfigurationFactory.php | 2 +- src/Bundle/Controller/ResourceController.php | 10 +- .../Controller/ResourceUpdateHandler.php | 2 +- .../ResourceUpdateHandlerInterface.php | 2 +- .../ResourcesCollectionProvider.php | 2 +- .../Helper/TargetEntitiesResolver.php | 4 +- .../Compiler/PagerfantaBridgePass.php | 9 +- .../Compiler/RegisterFqcnControllersPass.php | 2 +- .../Compiler/RegisterResourcesPass.php | 2 +- .../Compiler/RegisterStateMachinePass.php | 4 +- .../Driver/AbstractDriver.php | 4 +- .../Doctrine/AbstractDoctrineDriver.php | 4 +- .../Driver/Doctrine/DoctrineORMDriver.php | 6 +- .../Driver/Doctrine/DoctrinePHPCRDriver.php | 16 +-- .../Exception/InvalidDriverException.php | 2 +- .../Exception/UnknownDriverException.php | 2 +- .../Extension/AbstractResourceExtension.php | 2 +- .../SyliusResourceExtension.php | 4 +- .../Doctrine/ODM/PHPCR/DocumentRepository.php | 6 +- .../EventListener/DefaultParentListener.php | 10 +- .../EventListener/NameFilterListener.php | 4 +- .../EventListener/NameResolverListener.php | 4 +- .../PHPCR/Form/Builder/DefaultFormBuilder.php | 2 +- .../ORM/ContainerRepositoryFactory.php | 2 +- .../ODMMappedSuperClassSubscriber.php | 4 +- .../ORMMappedSuperClassSubscriber.php | 4 +- .../EventListener/ORMTranslatableListener.php | 8 +- .../NotNullExpressionFunctionProvider.php | 2 +- .../CollectionToStringTransformer.php | 8 +- .../DataTransformer/RecursiveTransformer.php | 8 +- .../ResourceToIdentifierTransformer.php | 2 +- .../EventSubscriber/AddCodeFormSubscriber.php | 2 +- .../HttpFoundationRequestHandler.php | 2 +- .../Type/ResourceAutocompleteChoiceType.php | 10 +- .../Form/Type/ResourceToIdentifierType.php | 2 +- .../Grid/Controller/ResourcesResolver.php | 2 +- src/Bundle/Grid/Parser/OptionsParser.php | 6 +- .../Renderer/TwigBulkActionGridRenderer.php | 4 +- src/Bundle/Grid/Renderer/TwigGridRenderer.php | 4 +- src/Bundle/Grid/View/ResourceGridView.php | 2 +- .../Grid/View/ResourceGridViewFactory.php | 2 +- .../View/ResourceGridViewFactoryInterface.php | 2 +- .../Routing/CrudRoutesAttributesLoader.php | 2 +- src/Bundle/Routing/ResourceLoader.php | 4 +- src/Bundle/Routing/RouteAttributesFactory.php | 2 +- src/Bundle/Routing/RouteFactory.php | 2 +- src/Bundle/Routing/RouteFactoryInterface.php | 2 +- .../Tests/Configuration/ConfigurationTest.php | 12 +- ...DoctrineTargetEntitiesResolverPassTest.php | 6 +- .../Compiler/RegisterFormBuilderPassTest.php | 6 +- .../RegisterFqcnControllersPassTest.php | 6 +- .../RegisterResourceRepositoryPassTest.php | 16 +-- .../Compiler/RegisterResourcesPassTest.php | 6 +- .../Compiler/WinzouStateMachinePassTest.php | 2 +- .../PagerfantaExtensionTest.php | 2 +- .../ResourceAutocompleteChoiceTypeTest.php | 30 ++--- .../Type/ResourceTranslationsTypeTest.php | 2 +- src/Bundle/Validator/DisabledValidator.php | 2 +- src/Bundle/Validator/EnabledValidator.php | 2 +- ...queWithinCollectionConstraintValidator.php | 6 +- .../spec/Controller/EventDispatcherSpec.php | 14 +-- .../spec/Controller/FlashHelperSpec.php | 24 ++-- .../Controller/NewResourceFactorySpec.php | 6 +- .../spec/Controller/RedirectHandlerSpec.php | 6 +- .../RequestConfigurationFactorySpec.php | 28 ++--- .../Controller/ResourceControllerSpec.php | 118 +++++++++--------- .../Controller/ResourceFormFactorySpec.php | 4 +- .../Controller/ResourceUpdateHandlerSpec.php | 4 +- .../ResourcesCollectionProviderSpec.php | 10 +- .../spec/Controller/ResourcesResolverSpec.php | 10 +- .../Controller/SingleResourceProviderSpec.php | 16 +-- .../spec/Controller/StateMachineSpec.php | 6 +- .../spec/Controller/ViewHandlerSpec.php | 4 +- src/Bundle/spec/Controller/WorkflowSpec.php | 6 +- .../DefaultParentListenerSpec.php | 44 +++---- .../EventListener/NameFilterListenerSpec.php | 6 +- .../NameResolverListenerSpec.php | 22 ++-- .../Form/Builder/DefaultFormBuilderSpec.php | 14 +-- .../RecursiveTransformerSpec.php | 4 +- .../AddCodeFormSubscriberSpec.php | 8 +- .../Grid/Controller/ResourcesResolverSpec.php | 8 +- .../spec/Grid/Parser/OptionsParserSpec.php | 15 +-- .../TwigBulkActionGridRendererSpec.php | 6 +- .../Grid/Renderer/TwigGridRendererSpec.php | 8 +- .../Grid/View/ResourceGridViewFactorySpec.php | 4 +- .../spec/Grid/View/ResourceGridViewSpec.php | 2 +- .../CrudRoutesAttributesLoaderSpec.php | 4 +- .../spec/Routing/ResourceLoaderSpec.php | 42 ++++--- .../spec/Validator/DisabledValidatorSpec.php | 4 +- .../spec/Validator/EnabledValidatorSpec.php | 4 +- .../src/Entity/CrudRoutes/BookWithAlias.php | 2 +- .../Entity/CrudRoutes/BookWithCriteria.php | 2 +- .../src/Entity/CrudRoutes/BookWithExcept.php | 2 +- .../src/Entity/CrudRoutes/BookWithGrid.php | 2 +- .../src/Entity/CrudRoutes/BookWithOnly.php | 2 +- .../Entity/CrudRoutes/BookWithPermission.php | 2 +- .../Entity/CrudRoutes/BookWithRedirect.php | 2 +- .../src/Entity/CrudRoutes/BookWithSection.php | 2 +- .../Entity/CrudRoutes/BookWithTemplate.php | 2 +- .../src/Entity/CrudRoutes/BookWithVars.php | 2 +- .../src/Entity/Route/RegisterUserWithForm.php | 2 +- src/Bundle/test/src/Entity/Route/ShowBook.php | 2 +- .../src/Entity/Route/ShowBookWithCriteria.php | 2 +- .../src/Entity/Route/ShowBookWithHost.php | 2 +- .../src/Entity/Route/ShowBookWithMethods.php | 2 +- .../src/Entity/Route/ShowBookWithOptions.php | 2 +- .../src/Entity/Route/ShowBookWithPriority.php | 2 +- .../Entity/Route/ShowBookWithRepository.php | 2 +- .../Entity/Route/ShowBookWithRequirements.php | 2 +- .../src/Entity/Route/ShowBookWithSchemes.php | 2 +- .../Route/ShowBookWithSerializationGroups.php | 2 +- .../ShowBookWithSerializationVersion.php | 2 +- .../src/Entity/Route/ShowBookWithTemplate.php | 2 +- .../src/Entity/Route/ShowBookWithVars.php | 2 +- .../src/Service/FirstAutowiredService.php | 2 +- .../Service/NoInterfaceAutowiredService.php | 2 +- .../src/Service/SecondAutowiredService.php | 2 +- .../Tests/Controller/ScienceBookUiTest.php | 4 +- src/Component/Annotation/SyliusCrudRoutes.php | 2 +- src/Component/Annotation/SyliusRoute.php | 2 +- .../Exception/DeleteHandlingException.php | 2 +- .../Exception/RaceConditionException.php | 2 +- .../Exception/UnexpectedTypeException.php | 2 +- .../Exception/UnsupportedMethodException.php | 2 +- .../Exception/UpdateHandlingException.php | 2 +- src/Component/Tests/Metadata/MetadataTest.php | 2 +- .../spec/Factory/TranslatableFactorySpec.php | 2 +- .../spec/Model/AbstractTranslationSpec.php | 2 +- .../Repository/InMemoryRepositorySpec.php | 8 +- .../TranslatableEntityLocaleAssignerSpec.php | 2 +- 138 files changed, 450 insertions(+), 434 deletions(-) diff --git a/src/Bundle/AbstractResourceBundle.php b/src/Bundle/AbstractResourceBundle.php index 4b60ed78e..e5269cf00 100644 --- a/src/Bundle/AbstractResourceBundle.php +++ b/src/Bundle/AbstractResourceBundle.php @@ -38,7 +38,7 @@ public function build(ContainerBuilder $container): void if (class_exists($compilerPassClassName)) { if (!method_exists($compilerPassClassName, $compilerPassMethod)) { throw new InvalidConfigurationException( - "The 'mappingFormat' value is invalid, must be 'xml', 'yaml' or 'annotation'." + "The 'mappingFormat' value is invalid, must be 'xml', 'yaml' or 'annotation'.", ); } @@ -48,7 +48,7 @@ public function build(ContainerBuilder $container): void $container->addCompilerPass($compilerPassClassName::$compilerPassMethod( [$this->getConfigFilesPath() => $this->getModelNamespace()], [$this->getObjectManagerParameter()], - sprintf('%s.driver.%s', $this->getBundlePrefix(), $driver) + sprintf('%s.driver.%s', $this->getBundlePrefix(), $driver), )); break; @@ -57,7 +57,7 @@ public function build(ContainerBuilder $container): void [$this->getModelNamespace()], [$this->getConfigFilesPath()], [sprintf('%s.object_manager', $this->getBundlePrefix())], - sprintf('%s.driver.%s', $this->getBundlePrefix(), $driver) + sprintf('%s.driver.%s', $this->getBundlePrefix(), $driver), )); break; @@ -106,7 +106,7 @@ protected function getMappingCompilerPassInfo(string $driverType): array case SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM: @trigger_error(sprintf( 'The "%s" driver is deprecated in Sylius 1.3. Doctrine MongoDB and PHPCR will no longer be supported in Sylius 2.0.', - $driverType + $driverType, ), \E_USER_DEPRECATED); $mappingsPassClassname = DoctrineMongoDBMappingsPass::class; @@ -119,7 +119,7 @@ protected function getMappingCompilerPassInfo(string $driverType): array case SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM: @trigger_error(sprintf( 'The "%s" driver is deprecated in Sylius 1.3. Doctrine MongoDB and PHPCR will no longer be supported in Sylius 2.0.', - $driverType + $driverType, ), \E_USER_DEPRECATED); $mappingsPassClassname = DoctrinePhpcrMappingsPass::class; @@ -142,7 +142,7 @@ protected function getConfigFilesPath(): string return sprintf( '%s/Resources/config/doctrine/%s', $this->getPath(), - strtolower($this->getDoctrineMappingDirectory()) + strtolower($this->getDoctrineMappingDirectory()), ); } diff --git a/src/Bundle/Controller/EventDispatcher.php b/src/Bundle/Controller/EventDispatcher.php index 9c50f16a2..8b2fcc099 100644 --- a/src/Bundle/Controller/EventDispatcher.php +++ b/src/Bundle/Controller/EventDispatcher.php @@ -29,7 +29,7 @@ public function __construct(SymfonyEventDispatcherInterface $eventDispatcher) public function dispatch( string $eventName, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): ResourceControllerEvent { $eventName = $requestConfiguration->getEvent() ?: $eventName; $metadata = $requestConfiguration->getMetadata(); @@ -43,7 +43,7 @@ public function dispatch( public function dispatchMultiple( string $eventName, RequestConfiguration $requestConfiguration, - $resources + $resources, ): ResourceControllerEvent { $eventName = $requestConfiguration->getEvent() ?: $eventName; $metadata = $requestConfiguration->getMetadata(); @@ -57,7 +57,7 @@ public function dispatchMultiple( public function dispatchPreEvent( string $eventName, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): ResourceControllerEvent { $eventName = $requestConfiguration->getEvent() ?: $eventName; $metadata = $requestConfiguration->getMetadata(); @@ -71,7 +71,7 @@ public function dispatchPreEvent( public function dispatchPostEvent( string $eventName, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): ResourceControllerEvent { $eventName = $requestConfiguration->getEvent() ?: $eventName; $metadata = $requestConfiguration->getMetadata(); @@ -85,7 +85,7 @@ public function dispatchPostEvent( public function dispatchInitializeEvent( string $eventName, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): ResourceControllerEvent { $eventName = $requestConfiguration->getEvent() ?: $eventName; $metadata = $requestConfiguration->getMetadata(); @@ -93,7 +93,7 @@ public function dispatchInitializeEvent( $this->eventDispatcher->dispatch( $event, - sprintf('%s.%s.initialize_%s', $metadata->getApplicationName(), $metadata->getName(), $eventName) + sprintf('%s.%s.initialize_%s', $metadata->getApplicationName(), $metadata->getName(), $eventName), ); return $event; diff --git a/src/Bundle/Controller/EventDispatcherInterface.php b/src/Bundle/Controller/EventDispatcherInterface.php index 87b8a1891..1b785896e 100644 --- a/src/Bundle/Controller/EventDispatcherInterface.php +++ b/src/Bundle/Controller/EventDispatcherInterface.php @@ -21,31 +21,31 @@ interface EventDispatcherInterface public function dispatch( string $eventName, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): ResourceControllerEvent; /** @param mixed $resources */ public function dispatchMultiple( string $eventName, RequestConfiguration $requestConfiguration, - $resources + $resources, ): ResourceControllerEvent; public function dispatchPreEvent( string $eventName, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): ResourceControllerEvent; public function dispatchPostEvent( string $eventName, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): ResourceControllerEvent; public function dispatchInitializeEvent( string $eventName, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): ResourceControllerEvent; } diff --git a/src/Bundle/Controller/FlashHelper.php b/src/Bundle/Controller/FlashHelper.php index 116ebe273..bd2a5df78 100644 --- a/src/Bundle/Controller/FlashHelper.php +++ b/src/Bundle/Controller/FlashHelper.php @@ -39,7 +39,7 @@ public function __construct(SessionInterface $session, TranslatorInterface $tran public function addSuccessFlash( RequestConfiguration $requestConfiguration, string $actionName, - ?ResourceInterface $resource = null + ?ResourceInterface $resource = null, ): void { $this->addFlashWithType($requestConfiguration, $actionName, 'success'); } @@ -79,7 +79,7 @@ private function addFlashWithType(RequestConfiguration $requestConfiguration, st $this->addFlash( $type, $this->getResourceMessage($actionName), - $parameters + $parameters, ); } diff --git a/src/Bundle/Controller/FlashHelperInterface.php b/src/Bundle/Controller/FlashHelperInterface.php index 368b6f0ce..573d3c847 100644 --- a/src/Bundle/Controller/FlashHelperInterface.php +++ b/src/Bundle/Controller/FlashHelperInterface.php @@ -21,7 +21,7 @@ interface FlashHelperInterface public function addSuccessFlash( RequestConfiguration $requestConfiguration, string $actionName, - ?ResourceInterface $resource = null + ?ResourceInterface $resource = null, ): void; public function addErrorFlash(RequestConfiguration $requestConfiguration, string $actionName): void; diff --git a/src/Bundle/Controller/ParametersParser.php b/src/Bundle/Controller/ParametersParser.php index 90a9de374..7b4e9ab8a 100644 --- a/src/Bundle/Controller/ParametersParser.php +++ b/src/Bundle/Controller/ParametersParser.php @@ -45,7 +45,7 @@ function ($parameter) use ($request) { return $this->parseRequestValue($parameter, $request); }, - $parameters + $parameters, ); } @@ -90,13 +90,13 @@ function (array $matches) use ($request) { throw new \InvalidArgumentException(sprintf( 'Cannot use %s ($%s) as parameter in expression.', gettype($variable), - $matches[1] + $matches[1], )); } return is_string($variable) ? sprintf('"%s"', addslashes($variable)) : $variable; }, - $expression + $expression, ); return $this->expression->evaluate($expression, ['container' => $this->container]); diff --git a/src/Bundle/Controller/RedirectHandler.php b/src/Bundle/Controller/RedirectHandler.php index 8d756dc91..084650024 100644 --- a/src/Bundle/Controller/RedirectHandler.php +++ b/src/Bundle/Controller/RedirectHandler.php @@ -35,13 +35,13 @@ public function redirectToResource(RequestConfiguration $configuration, Resource return $this->redirectToRoute( $configuration, (string) $configuration->getRedirectRoute(ResourceActions::SHOW), - $configuration->getRedirectParameters($resource) + $configuration->getRedirectParameters($resource), ); } catch (RouteNotFoundException $exception) { return $this->redirectToRoute( $configuration, (string) $configuration->getRedirectRoute(ResourceActions::INDEX), - $configuration->getRedirectParameters($resource) + $configuration->getRedirectParameters($resource), ); } } @@ -51,7 +51,7 @@ public function redirectToIndex(RequestConfiguration $configuration, ?ResourceIn return $this->redirectToRoute( $configuration, (string) $configuration->getRedirectRoute('index'), - $configuration->getRedirectParameters($resource) + $configuration->getRedirectParameters($resource), ); } diff --git a/src/Bundle/Controller/RequestConfiguration.php b/src/Bundle/Controller/RequestConfiguration.php index 07281ae58..d37991ffb 100644 --- a/src/Bundle/Controller/RequestConfiguration.php +++ b/src/Bundle/Controller/RequestConfiguration.php @@ -358,7 +358,7 @@ public function getRequestParameter($parameter, $defaults = []) { return array_replace_recursive( $defaults, - $this->request->get($parameter, []) + $this->request->get($parameter, []), ); } diff --git a/src/Bundle/Controller/RequestConfigurationFactory.php b/src/Bundle/Controller/RequestConfigurationFactory.php index 04b8a94e6..50795406e 100644 --- a/src/Bundle/Controller/RequestConfigurationFactory.php +++ b/src/Bundle/Controller/RequestConfigurationFactory.php @@ -73,7 +73,7 @@ private function parseApiParameters(Request $request): array $allowedSerializationGroups = array_merge( $parameters['allowed_serialization_groups'] ?? [], - $parameters['serialization_groups'] ?? [] + $parameters['serialization_groups'] ?? [], ); /** @var string[] $apiGroupsHeaders */ diff --git a/src/Bundle/Controller/ResourceController.php b/src/Bundle/Controller/ResourceController.php index 245e7adb1..ac9ec1a73 100644 --- a/src/Bundle/Controller/ResourceController.php +++ b/src/Bundle/Controller/ResourceController.php @@ -89,7 +89,7 @@ public function __construct( EventDispatcherInterface $eventDispatcher, ?StateMachineInterface $stateMachine, ResourceUpdateHandlerInterface $resourceUpdateHandler, - ResourceDeleteHandlerInterface $resourceDeleteHandler + ResourceDeleteHandlerInterface $resourceDeleteHandler, ) { $this->metadata = $metadata; $this->requestConfigurationFactory = $requestConfigurationFactory; @@ -244,9 +244,9 @@ public function updateAction(Request $request): Response $form->handleRequest($request); if ( - in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true) - && $form->isSubmitted() - && $form->isValid() + in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true) && + $form->isSubmitted() && + $form->isValid() ) { $resource = $form->getData(); @@ -516,7 +516,7 @@ protected function getParameter(string $name) throw new \RuntimeException(sprintf( 'Container passed to "%s" has to implements "%s".', self::class, - ContainerInterface::class + ContainerInterface::class, )); } diff --git a/src/Bundle/Controller/ResourceUpdateHandler.php b/src/Bundle/Controller/ResourceUpdateHandler.php index 3dd634bdc..dac31029e 100644 --- a/src/Bundle/Controller/ResourceUpdateHandler.php +++ b/src/Bundle/Controller/ResourceUpdateHandler.php @@ -28,7 +28,7 @@ public function __construct(?StateMachineInterface $stateMachine) public function handle( ResourceInterface $resource, RequestConfiguration $requestConfiguration, - ObjectManager $manager + ObjectManager $manager, ): void { if (null !== $this->stateMachine && $requestConfiguration->hasStateMachine()) { $this->stateMachine->apply($requestConfiguration, $resource); diff --git a/src/Bundle/Controller/ResourceUpdateHandlerInterface.php b/src/Bundle/Controller/ResourceUpdateHandlerInterface.php index 97423c435..97c651117 100644 --- a/src/Bundle/Controller/ResourceUpdateHandlerInterface.php +++ b/src/Bundle/Controller/ResourceUpdateHandlerInterface.php @@ -21,6 +21,6 @@ interface ResourceUpdateHandlerInterface public function handle( ResourceInterface $resource, RequestConfiguration $requestConfiguration, - ObjectManager $manager + ObjectManager $manager, ): void; } diff --git a/src/Bundle/Controller/ResourcesCollectionProvider.php b/src/Bundle/Controller/ResourcesCollectionProvider.php index 2a9aa9b8a..8f33eb2ed 100644 --- a/src/Bundle/Controller/ResourcesCollectionProvider.php +++ b/src/Bundle/Controller/ResourcesCollectionProvider.php @@ -52,7 +52,7 @@ public function get(RequestConfiguration $requestConfiguration, RepositoryInterf $paginator->setMaxPerPage($this->resolveMaxPerPage( $request->query->has('limit') ? $request->query->getInt('limit') : null, $requestConfiguration->getPaginationMaxPerPage(), - $paginationLimits + $paginationLimits, )); $currentPage = (int) $request->query->get('page', '1'); $paginator->setCurrentPage($currentPage); diff --git a/src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolver.php b/src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolver.php index ab0054639..6a68a3522 100644 --- a/src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolver.php +++ b/src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolver.php @@ -55,9 +55,9 @@ public function resolve(array $resources): array 'Triggered by resource "%s" with model "%s" and interface "%s".', $alias, $model, - $interface + $interface, ), - \E_USER_DEPRECATED + \E_USER_DEPRECATED, ); $interfaces[$interface] = $model; diff --git a/src/Bundle/DependencyInjection/Compiler/PagerfantaBridgePass.php b/src/Bundle/DependencyInjection/Compiler/PagerfantaBridgePass.php index 702bdbba1..fbe04262e 100644 --- a/src/Bundle/DependencyInjection/Compiler/PagerfantaBridgePass.php +++ b/src/Bundle/DependencyInjection/Compiler/PagerfantaBridgePass.php @@ -41,19 +41,22 @@ private function changeViewFactoryClass(ContainerBuilder $container): void $viewFactoryClass = $container->getParameter('white_october_pagerfanta.view_factory.class'); $container->getDefinition('pagerfanta.view_factory') - ->setClass($viewFactoryClass); + ->setClass($viewFactoryClass) + ; } private function aliasRenamedServices(ContainerBuilder $container): void { if ($container->hasDefinition('pagerfanta.twig_extension')) { $container->setAlias('twig.extension.pagerfanta', 'pagerfanta.twig_extension') - ->setDeprecated(true, 'The "%alias_id%" service alias is deprecated since Sylius 1.8, use the "pagerfanta.twig_extension" service ID instead.'); + ->setDeprecated(true, 'The "%alias_id%" service alias is deprecated since Sylius 1.8, use the "pagerfanta.twig_extension" service ID instead.') + ; } if ($container->hasDefinition('pagerfanta.view_factory')) { $container->setAlias('white_october_pagerfanta.view_factory', 'pagerfanta.view_factory') - ->setDeprecated(true, 'The "%alias_id%" service alias is deprecated since Sylius 1.8, use the "pagerfanta.view_factory" service ID instead.'); + ->setDeprecated(true, 'The "%alias_id%" service alias is deprecated since Sylius 1.8, use the "pagerfanta.view_factory" service ID instead.') + ; } } } diff --git a/src/Bundle/DependencyInjection/Compiler/RegisterFqcnControllersPass.php b/src/Bundle/DependencyInjection/Compiler/RegisterFqcnControllersPass.php index 189c9e9d9..fc47b6d10 100644 --- a/src/Bundle/DependencyInjection/Compiler/RegisterFqcnControllersPass.php +++ b/src/Bundle/DependencyInjection/Compiler/RegisterFqcnControllersPass.php @@ -57,7 +57,7 @@ private function validateSyliusResource(string $class): void throw new InvalidArgumentException(sprintf( 'Class "%s" must implement "%s" to be registered as a Sylius resource.', $class, - ResourceInterface::class + ResourceInterface::class, )); } } diff --git a/src/Bundle/DependencyInjection/Compiler/RegisterResourcesPass.php b/src/Bundle/DependencyInjection/Compiler/RegisterResourcesPass.php index cc5ac67b6..13f3e35a4 100644 --- a/src/Bundle/DependencyInjection/Compiler/RegisterResourcesPass.php +++ b/src/Bundle/DependencyInjection/Compiler/RegisterResourcesPass.php @@ -45,7 +45,7 @@ private function validateSyliusResource(string $class): void throw new InvalidArgumentException(sprintf( 'Class "%s" must implement "%s" to be registered as a Sylius resource.', $class, - ResourceInterface::class + ResourceInterface::class, )); } } diff --git a/src/Bundle/DependencyInjection/Compiler/RegisterStateMachinePass.php b/src/Bundle/DependencyInjection/Compiler/RegisterStateMachinePass.php index 280f5df00..1540a349b 100644 --- a/src/Bundle/DependencyInjection/Compiler/RegisterStateMachinePass.php +++ b/src/Bundle/DependencyInjection/Compiler/RegisterStateMachinePass.php @@ -41,8 +41,8 @@ public function process(ContainerBuilder $container): void // No state machine enabled if ( - !$this->isSymfonyWorkflowEnabled($container) - && !$this->isWinzouStateMachineEnabled($container) + !$this->isSymfonyWorkflowEnabled($container) && + !$this->isWinzouStateMachineEnabled($container) ) { return; } diff --git a/src/Bundle/DependencyInjection/Driver/AbstractDriver.php b/src/Bundle/DependencyInjection/Driver/AbstractDriver.php index 29b1fd060..59cc3f4bf 100644 --- a/src/Bundle/DependencyInjection/Driver/AbstractDriver.php +++ b/src/Bundle/DependencyInjection/Driver/AbstractDriver.php @@ -116,14 +116,14 @@ protected function addFactory(ContainerBuilder $container, MetadataInterface $me $typehintClasses = array_merge( $factoryInterfaces, [$factoryClass], - $factoryParents + $factoryParents, ); foreach ($typehintClasses as $typehintClass) { $container->registerAliasForArgument( $metadata->getServiceId('factory'), $typehintClass, - $metadata->getHumanizedName() . ' factory' + $metadata->getHumanizedName() . ' factory', ); } } diff --git a/src/Bundle/DependencyInjection/Driver/Doctrine/AbstractDoctrineDriver.php b/src/Bundle/DependencyInjection/Driver/Doctrine/AbstractDoctrineDriver.php index bc5bf99b7..6a1615862 100644 --- a/src/Bundle/DependencyInjection/Driver/Doctrine/AbstractDoctrineDriver.php +++ b/src/Bundle/DependencyInjection/Driver/Doctrine/AbstractDoctrineDriver.php @@ -40,7 +40,7 @@ protected function addManager(ContainerBuilder $container, MetadataInterface $me { $container->setAlias( $metadata->getServiceId('manager'), - new Alias($this->getManagerServiceId($metadata), true) + new Alias($this->getManagerServiceId($metadata), true), ); foreach ([DeprecatedObjectManager::class, ObjectManager::class] as $objectManagerClass) { @@ -51,7 +51,7 @@ protected function addManager(ContainerBuilder $container, MetadataInterface $me $container->registerAliasForArgument( $metadata->getServiceId('manager'), $objectManagerClass, - $metadata->getHumanizedName() . ' manager' + $metadata->getHumanizedName() . ' manager', ); } } diff --git a/src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineORMDriver.php b/src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineORMDriver.php index 476e313d6..d3a736885 100644 --- a/src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineORMDriver.php +++ b/src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineORMDriver.php @@ -89,14 +89,14 @@ protected function addRepository(ContainerBuilder $container, MetadataInterface $typehintClasses = array_merge( $repositoryInterfaces, [$repositoryClass], - $repositoryParents + $repositoryParents, ); foreach ($typehintClasses as $typehintClass) { $container->registerAliasForArgument( $metadata->getServiceId('repository'), $typehintClass, - $metadata->getHumanizedName() . ' repository' + $metadata->getHumanizedName() . ' repository', ); } @@ -117,7 +117,7 @@ protected function addManager(ContainerBuilder $container, MetadataInterface $me $container->registerAliasForArgument( $metadata->getServiceId('manager'), $typehintClass, - $metadata->getHumanizedName() . ' manager' + $metadata->getHumanizedName() . ' manager', ); } } diff --git a/src/Bundle/DependencyInjection/Driver/Doctrine/DoctrinePHPCRDriver.php b/src/Bundle/DependencyInjection/Driver/Doctrine/DoctrinePHPCRDriver.php index 8d5ad5fb4..f3f009a13 100644 --- a/src/Bundle/DependencyInjection/Driver/Doctrine/DoctrinePHPCRDriver.php +++ b/src/Bundle/DependencyInjection/Driver/Doctrine/DoctrinePHPCRDriver.php @@ -58,13 +58,13 @@ protected function addResourceListeners(ContainerBuilder $container, MetadataInt if ($diff = array_diff(array_keys($metadataOptions), array_keys($defaultOptions))) { throw new InvalidArgumentException(sprintf( 'Unknown PHPCR-ODM configuration options: "%s"', - implode('", "', $diff) + implode('", "', $diff), )); } $options = array_merge( $defaultOptions, - $metadataOptions + $metadataOptions, ); $createEventName = sprintf('%s.%s.pre_%s', $metadata->getApplicationName(), $metadata->getName(), 'create'); @@ -87,9 +87,9 @@ protected function addResourceListeners(ContainerBuilder $container, MetadataInt sprintf( '%s.resource.%s.doctrine.odm.phpcr.event_listener.default_path', $metadata->getApplicationName(), - $metadata->getName() + $metadata->getName(), ), - $defaultPath + $defaultPath, ); } @@ -111,9 +111,9 @@ protected function addResourceListeners(ContainerBuilder $container, MetadataInt sprintf( '%s.resource.%s.doctrine.odm.phpcr.event_listener.name_filter', $metadata->getApplicationName(), - $metadata->getName() + $metadata->getName(), ), - $nameFilter + $nameFilter, ); } @@ -135,9 +135,9 @@ protected function addResourceListeners(ContainerBuilder $container, MetadataInt sprintf( '%s.resource.%s.doctrine.odm.phpcr.event_listener.name_resolver', $metadata->getApplicationName(), - $metadata->getName() + $metadata->getName(), ), - $nameResolver + $nameResolver, ); } } diff --git a/src/Bundle/DependencyInjection/Driver/Exception/InvalidDriverException.php b/src/Bundle/DependencyInjection/Driver/Exception/InvalidDriverException.php index 3ea448327..1b500150d 100644 --- a/src/Bundle/DependencyInjection/Driver/Exception/InvalidDriverException.php +++ b/src/Bundle/DependencyInjection/Driver/Exception/InvalidDriverException.php @@ -20,7 +20,7 @@ public function __construct(string $driver, string $className) parent::__construct(sprintf( 'Driver "%s" is not supported by %s.', $driver, - $className + $className, )); } } diff --git a/src/Bundle/DependencyInjection/Driver/Exception/UnknownDriverException.php b/src/Bundle/DependencyInjection/Driver/Exception/UnknownDriverException.php index 9161bb9cd..33ed243ee 100644 --- a/src/Bundle/DependencyInjection/Driver/Exception/UnknownDriverException.php +++ b/src/Bundle/DependencyInjection/Driver/Exception/UnknownDriverException.php @@ -19,7 +19,7 @@ public function __construct(string $driver) { parent::__construct(sprintf( 'Unknown driver "%s".', - $driver + $driver, )); } } diff --git a/src/Bundle/DependencyInjection/Extension/AbstractResourceExtension.php b/src/Bundle/DependencyInjection/Extension/AbstractResourceExtension.php index a65757413..191992a31 100644 --- a/src/Bundle/DependencyInjection/Extension/AbstractResourceExtension.php +++ b/src/Bundle/DependencyInjection/Extension/AbstractResourceExtension.php @@ -24,7 +24,7 @@ protected function registerResources( string $applicationName, string $driver, array $registeredResources, - ContainerBuilder $container + ContainerBuilder $container, ): void { $container->setParameter(sprintf('%s.driver.%s', $this->getAlias(), $driver), true); $container->setParameter(sprintf('%s.driver', $this->getAlias()), $driver); diff --git a/src/Bundle/DependencyInjection/SyliusResourceExtension.php b/src/Bundle/DependencyInjection/SyliusResourceExtension.php index fec4372ab..824cedcbd 100644 --- a/src/Bundle/DependencyInjection/SyliusResourceExtension.php +++ b/src/Bundle/DependencyInjection/SyliusResourceExtension.php @@ -92,7 +92,7 @@ private function loadPersistence(array $drivers, array $resources, LoaderInterfa throw new InvalidArgumentException(sprintf( 'Resource "%s" uses driver "%s", but this driver has not been enabled.', $alias, - $resource['driver'] + $resource['driver'], )); } } @@ -101,7 +101,7 @@ private function loadPersistence(array $drivers, array $resources, LoaderInterfa if (in_array($driver, [SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM, SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM], true)) { @trigger_error(sprintf( 'The "%s" driver is deprecated in Sylius 1.3. Doctrine MongoDB and PHPCR will no longer be supported in Sylius 2.0.', - $driver + $driver, ), \E_USER_DEPRECATED); } diff --git a/src/Bundle/Doctrine/ODM/PHPCR/DocumentRepository.php b/src/Bundle/Doctrine/ODM/PHPCR/DocumentRepository.php index 6e31c6de9..d4992eda4 100644 --- a/src/Bundle/Doctrine/ODM/PHPCR/DocumentRepository.php +++ b/src/Bundle/Doctrine/ODM/PHPCR/DocumentRepository.php @@ -71,13 +71,15 @@ protected function applyCriteria(QueryBuilder $queryBuilder, array $criteria = [ ->andWhere() ->eq() ->localName($this->getAlias()) - ->literal($value); + ->literal($value) + ; } else { $queryBuilder ->andWhere() ->eq() ->field($this->getPropertyName($property)) - ->literal($value); + ->literal($value) + ; } } } diff --git a/src/Bundle/Doctrine/ODM/PHPCR/EventListener/DefaultParentListener.php b/src/Bundle/Doctrine/ODM/PHPCR/EventListener/DefaultParentListener.php index 339ef3f5e..2ad2f62f0 100644 --- a/src/Bundle/Doctrine/ODM/PHPCR/EventListener/DefaultParentListener.php +++ b/src/Bundle/Doctrine/ODM/PHPCR/EventListener/DefaultParentListener.php @@ -43,7 +43,7 @@ public function __construct( DocumentManagerInterface $documentManager, $parentPath, $autocreate = false, - $force = false + $force = false, ) { $this->documentManager = $documentManager; $this->parentPath = $parentPath; @@ -58,18 +58,18 @@ public function onPreCreate(ResourceControllerEvent $event) $this->resolveParent( $document, - $this->documentManager->getClassMetadata($class) + $this->documentManager->getClassMetadata($class), ); } private function resolveParent( $document, - ClassMetadata $metadata + ClassMetadata $metadata, ) { if (!$parentField = $metadata->parentMapping) { throw new \RuntimeException(sprintf( 'A default parent path has been specified, but no parent mapping has been applied to document "%s"', - get_class($document) + get_class($document), )); } @@ -92,7 +92,7 @@ private function resolveParent( throw new \RuntimeException(sprintf( 'Document at default parent path "%s" does not exist. `autocreate` was set to "%s"', $this->parentPath, - $this->autocreate ? 'true' : 'false' + $this->autocreate ? 'true' : 'false', )); } diff --git a/src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameFilterListener.php b/src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameFilterListener.php index 5f4c8fe2c..274bd882b 100644 --- a/src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameFilterListener.php +++ b/src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameFilterListener.php @@ -35,7 +35,7 @@ class NameFilterListener public function __construct( DocumentManagerInterface $documentManager, - $replacementCharacter = ' ' + $replacementCharacter = ' ', ) { $this->documentManager = $documentManager; $this->replacementCharacter = $replacementCharacter; @@ -50,7 +50,7 @@ public function onEvent(ResourceControllerEvent $event) if (null === $nameField = $metadata->nodename) { throw new \RuntimeException(sprintf( 'In order to use the node name filter on "%s" it is necessary to map a field as the "nodename"', - get_class($document) + get_class($document), )); } diff --git a/src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameResolverListener.php b/src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameResolverListener.php index 27da5c031..c8e0540da 100644 --- a/src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameResolverListener.php +++ b/src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameResolverListener.php @@ -31,7 +31,7 @@ class NameResolverListener private $documentManager; public function __construct( - DocumentManagerInterface $documentManager + DocumentManagerInterface $documentManager, ) { $this->documentManager = $documentManager; } @@ -47,7 +47,7 @@ public function onEvent(ResourceControllerEvent $event) 'Document of class "%s" must be using the GENERATOR_TYPE_PARENT identificatio strategy (value %s), it is current using "%s" (this may be an automatic configuration: be sure to map both the `nodename` and the `parentDocument`).', get_class($document), ClassMetadata::GENERATOR_TYPE_PARENT, - $metadata->idGenerator + $metadata->idGenerator, )); } diff --git a/src/Bundle/Doctrine/ODM/PHPCR/Form/Builder/DefaultFormBuilder.php b/src/Bundle/Doctrine/ODM/PHPCR/Form/Builder/DefaultFormBuilder.php index 4dd47cdb7..2a16b1a24 100644 --- a/src/Bundle/Doctrine/ODM/PHPCR/Form/Builder/DefaultFormBuilder.php +++ b/src/Bundle/Doctrine/ODM/PHPCR/Form/Builder/DefaultFormBuilder.php @@ -26,7 +26,7 @@ class DefaultFormBuilder implements DefaultFormBuilderInterface private $documentManager; public function __construct( - DocumentManagerInterface $documentManager + DocumentManagerInterface $documentManager, ) { $this->documentManager = $documentManager; } diff --git a/src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php b/src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php index 42214f871..6b4ddca98 100644 --- a/src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php +++ b/src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php @@ -50,7 +50,7 @@ public function getRepository(EntityManagerInterface $entityManager, $entityName private function getOrCreateRepository( EntityManagerInterface $entityManager, - ClassMetadata $metadata + ClassMetadata $metadata, ): ObjectRepository { $repositoryHash = $metadata->getName() . spl_object_hash($entityManager); diff --git a/src/Bundle/EventListener/ODMMappedSuperClassSubscriber.php b/src/Bundle/EventListener/ODMMappedSuperClassSubscriber.php index 8b979f555..c84e18d3a 100644 --- a/src/Bundle/EventListener/ODMMappedSuperClassSubscriber.php +++ b/src/Bundle/EventListener/ODMMappedSuperClassSubscriber.php @@ -77,7 +77,7 @@ private function setAssociationMappings(ClassMetadataInfo $metadata, $configurat $parentMetadata = new ClassMetadata( $parent, - $configuration->getNamingStrategy() + $configuration->getNamingStrategy(), ); // Wakeup Reflection @@ -128,7 +128,7 @@ private function isRelation($type) ClassMetadataInfo::EMBED_ONE, ClassMetadataInfo::EMBED_MANY, ], - true + true, ); } } diff --git a/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php b/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php index 7d6da5e84..51666c6c0 100644 --- a/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php +++ b/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php @@ -61,7 +61,7 @@ private function setAssociationMappings(ClassMetadataInfo $metadata, Configurati $parentMetadata = new ClassMetadata( $parent, - $configuration->getNamingStrategy() + $configuration->getNamingStrategy(), ); // Wakeup Reflection @@ -109,7 +109,7 @@ private function isRelation(int $type): bool ClassMetadataInfo::ONE_TO_MANY, ClassMetadataInfo::ONE_TO_ONE, ], - true + true, ); } } diff --git a/src/Bundle/EventListener/ORMTranslatableListener.php b/src/Bundle/EventListener/ORMTranslatableListener.php index f1efe6434..391dc2d6d 100644 --- a/src/Bundle/EventListener/ORMTranslatableListener.php +++ b/src/Bundle/EventListener/ORMTranslatableListener.php @@ -34,7 +34,7 @@ final class ORMTranslatableListener implements EventSubscriber public function __construct( RegistryInterface $resourceMetadataRegistry, - object $translatableEntityLocaleAssigner + object $translatableEntityLocaleAssigner, ) { $this->resourceMetadataRegistry = $resourceMetadataRegistry; $this->translatableEntityLocaleAssigner = $this->processTranslatableEntityLocaleAssigner($translatableEntityLocaleAssigner); @@ -195,9 +195,9 @@ private function processTranslatableEntityLocaleAssigner(object $translatableEnt sprintf( 'Passing an instance of "%s" is deprecated since 1.4. Use "%s" instead.', ContainerInterface::class, - TranslatableEntityLocaleAssignerInterface::class + TranslatableEntityLocaleAssignerInterface::class, ), - \E_USER_DEPRECATED + \E_USER_DEPRECATED, ); /** @var object $translatableEntityLocaleAssigner */ @@ -208,7 +208,7 @@ private function processTranslatableEntityLocaleAssigner(object $translatableEnt throw new \InvalidArgumentException(sprintf( '`$translatableEntityLocaleAssigner` was expected to return an instance of "%s" , "%s" found', TranslatableEntityLocaleAssignerInterface::class, - get_class($translatableEntityLocaleAssigner) + get_class($translatableEntityLocaleAssigner), )); } diff --git a/src/Bundle/ExpressionLanguage/NotNullExpressionFunctionProvider.php b/src/Bundle/ExpressionLanguage/NotNullExpressionFunctionProvider.php index 828ddd5be..c241b49bd 100644 --- a/src/Bundle/ExpressionLanguage/NotNullExpressionFunctionProvider.php +++ b/src/Bundle/ExpressionLanguage/NotNullExpressionFunctionProvider.php @@ -42,7 +42,7 @@ function ($arguments, $result) { } return $result; - } + }, ), ]; } diff --git a/src/Bundle/Form/DataTransformer/CollectionToStringTransformer.php b/src/Bundle/Form/DataTransformer/CollectionToStringTransformer.php index 68aaee00a..8490d636b 100644 --- a/src/Bundle/Form/DataTransformer/CollectionToStringTransformer.php +++ b/src/Bundle/Form/DataTransformer/CollectionToStringTransformer.php @@ -34,8 +34,8 @@ public function transform($value): string sprintf( 'Expected "%s", but got "%s"', Collection::class, - is_object($value) ? get_class($value) : gettype($value) - ) + is_object($value) ? get_class($value) : gettype($value), + ), ); } @@ -52,8 +52,8 @@ public function reverseTransform($value): Collection throw new TransformationFailedException( sprintf( 'Expected string, but got "%s"', - is_object($value) ? get_class($value) : gettype($value) - ) + is_object($value) ? get_class($value) : gettype($value), + ), ); } diff --git a/src/Bundle/Form/DataTransformer/RecursiveTransformer.php b/src/Bundle/Form/DataTransformer/RecursiveTransformer.php index 10ba0c70d..b5dcb8a9b 100644 --- a/src/Bundle/Form/DataTransformer/RecursiveTransformer.php +++ b/src/Bundle/Form/DataTransformer/RecursiveTransformer.php @@ -43,7 +43,7 @@ public function transform($value): Collection */ function ($currentValue) { return $this->decoratedTransformer->transform($currentValue); - } + }, ); } @@ -63,7 +63,7 @@ public function reverseTransform($value): Collection */ function ($currentValue) { return $this->decoratedTransformer->reverseTransform($currentValue); - } + }, ); } @@ -79,8 +79,8 @@ private function assertTransformationValueType($value, string $expectedType): vo sprintf( 'Expected "%s", but got "%s"', $expectedType, - is_object($value) ? get_class($value) : gettype($value) - ) + is_object($value) ? get_class($value) : gettype($value), + ), ); } } diff --git a/src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php b/src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php index 7035eb1f8..385ba7dde 100644 --- a/src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php +++ b/src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php @@ -60,7 +60,7 @@ public function reverseTransform($value): ?ResourceInterface 'Object "%s" with identifier "%s"="%s" does not exist.', $this->repository->getClassName(), $this->identifier, - $value + $value, )); } diff --git a/src/Bundle/Form/EventSubscriber/AddCodeFormSubscriber.php b/src/Bundle/Form/EventSubscriber/AddCodeFormSubscriber.php index 63f8ce339..eb8d46bd5 100644 --- a/src/Bundle/Form/EventSubscriber/AddCodeFormSubscriber.php +++ b/src/Bundle/Form/EventSubscriber/AddCodeFormSubscriber.php @@ -57,7 +57,7 @@ public function preSetData(FormEvent $event): void $form->add('code', $this->type, array_merge( ['label' => 'sylius.ui.code'], $this->options, - ['disabled' => $disabled] + ['disabled' => $disabled], )); } } diff --git a/src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php b/src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php index a84479926..0c31b35c9 100644 --- a/src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php +++ b/src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php @@ -72,7 +72,7 @@ public function handleRequest(FormInterface $form, $request = null) $form->addError(new FormError( call_user_func($form->getConfig()->getOption('upload_max_size_message')), null, - ['{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()] + ['{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()], )); return; diff --git a/src/Bundle/Form/Type/ResourceAutocompleteChoiceType.php b/src/Bundle/Form/Type/ResourceAutocompleteChoiceType.php index 724c68583..2b1c3669d 100644 --- a/src/Bundle/Form/Type/ResourceAutocompleteChoiceType.php +++ b/src/Bundle/Form/Type/ResourceAutocompleteChoiceType.php @@ -40,8 +40,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $builder->addModelTransformer( new ResourceToIdentifierTransformer( $options['repository'], - $options['choice_value'] - ) + $options['choice_value'], + ), ); } @@ -51,9 +51,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void new RecursiveTransformer( new ResourceToIdentifierTransformer( $options['repository'], - $options['choice_value'] - ) - ) + $options['choice_value'], + ), + ), ) ->addViewTransformer(new CollectionToStringTransformer(',')) ; diff --git a/src/Bundle/Form/Type/ResourceToIdentifierType.php b/src/Bundle/Form/Type/ResourceToIdentifierType.php index c16aad663..01dba37fb 100644 --- a/src/Bundle/Form/Type/ResourceToIdentifierType.php +++ b/src/Bundle/Form/Type/ResourceToIdentifierType.php @@ -36,7 +36,7 @@ public function __construct(RepositoryInterface $repository, MetadataInterface $ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addModelTransformer( - new ResourceToIdentifierTransformer($this->repository, $options['identifier']) + new ResourceToIdentifierTransformer($this->repository, $options['identifier']), ); } diff --git a/src/Bundle/Grid/Controller/ResourcesResolver.php b/src/Bundle/Grid/Controller/ResourcesResolver.php index 2a7a556c6..5bd78e3f6 100644 --- a/src/Bundle/Grid/Controller/ResourcesResolver.php +++ b/src/Bundle/Grid/Controller/ResourcesResolver.php @@ -31,7 +31,7 @@ final class ResourcesResolver implements ResourcesResolverInterface public function __construct( ResourcesResolverInterface $decoratedResolver, GridProviderInterface $gridProvider, - ResourceGridViewFactoryInterface $gridViewFactory + ResourceGridViewFactoryInterface $gridViewFactory, ) { $this->decoratedResolver = $decoratedResolver; $this->gridProvider = $gridProvider; diff --git a/src/Bundle/Grid/Parser/OptionsParser.php b/src/Bundle/Grid/Parser/OptionsParser.php index d6b2d7d76..b92b8d6cf 100644 --- a/src/Bundle/Grid/Parser/OptionsParser.php +++ b/src/Bundle/Grid/Parser/OptionsParser.php @@ -29,7 +29,7 @@ final class OptionsParser implements OptionsParserInterface public function __construct( ContainerInterface $container, ExpressionLanguage $expression, - PropertyAccessorInterface $propertyAccessor + PropertyAccessorInterface $propertyAccessor, ) { $this->container = $container; $this->expression = $expression; @@ -51,7 +51,7 @@ function ($parameter) use ($request, $data) { return $this->parseOption($parameter, $request, $data); }, - $parameters + $parameters, ); } @@ -101,7 +101,7 @@ function (array $matches) use ($request) { return is_string($variable) ? sprintf('"%s"', addslashes($variable)) : $variable; }, - $expression + $expression, ); return $this->expression->evaluate($expression, ['container' => $this->container]); diff --git a/src/Bundle/Grid/Renderer/TwigBulkActionGridRenderer.php b/src/Bundle/Grid/Renderer/TwigBulkActionGridRenderer.php index 63d7388b2..ab236a618 100644 --- a/src/Bundle/Grid/Renderer/TwigBulkActionGridRenderer.php +++ b/src/Bundle/Grid/Renderer/TwigBulkActionGridRenderer.php @@ -32,7 +32,7 @@ final class TwigBulkActionGridRenderer implements BulkActionGridRendererInterfac public function __construct( Environment $twig, OptionsParserInterface $optionsParser, - array $bulkActionTemplates = [] + array $bulkActionTemplates = [], ) { $this->twig = $twig; $this->optionsParser = $optionsParser; @@ -51,7 +51,7 @@ public function renderBulkAction(GridViewInterface $gridView, Action $bulkAction $options = $this->optionsParser->parseOptions( $bulkAction->getOptions(), $gridView->getRequestConfiguration()->getRequest(), - $data + $data, ); return $this->twig->render($this->bulkActionTemplates[$type], [ diff --git a/src/Bundle/Grid/Renderer/TwigGridRenderer.php b/src/Bundle/Grid/Renderer/TwigGridRenderer.php index 392108ea0..75193ea11 100644 --- a/src/Bundle/Grid/Renderer/TwigGridRenderer.php +++ b/src/Bundle/Grid/Renderer/TwigGridRenderer.php @@ -37,7 +37,7 @@ public function __construct( GridRendererInterface $gridRenderer, Environment $twig, OptionsParserInterface $optionsParser, - array $actionTemplates = [] + array $actionTemplates = [], ) { $this->gridRenderer = $gridRenderer; $this->twig = $twig; @@ -73,7 +73,7 @@ public function renderAction(GridViewInterface $gridView, Action $action, $data $options = $this->optionsParser->parseOptions( $action->getOptions(), $gridView->getRequestConfiguration()->getRequest(), - $data + $data, ); return $this->twig->render($this->actionTemplates[$type], [ diff --git a/src/Bundle/Grid/View/ResourceGridView.php b/src/Bundle/Grid/View/ResourceGridView.php index 70e6b2cd0..308b86fa3 100644 --- a/src/Bundle/Grid/View/ResourceGridView.php +++ b/src/Bundle/Grid/View/ResourceGridView.php @@ -33,7 +33,7 @@ public function __construct( Grid $gridDefinition, Parameters $parameters, MetadataInterface $resourceMetadata, - RequestConfiguration $requestConfiguration + RequestConfiguration $requestConfiguration, ) { parent::__construct($data, $gridDefinition, $parameters); diff --git a/src/Bundle/Grid/View/ResourceGridViewFactory.php b/src/Bundle/Grid/View/ResourceGridViewFactory.php index 91c120cdf..c8eccbdd2 100644 --- a/src/Bundle/Grid/View/ResourceGridViewFactory.php +++ b/src/Bundle/Grid/View/ResourceGridViewFactory.php @@ -36,7 +36,7 @@ public function create( Grid $grid, Parameters $parameters, MetadataInterface $metadata, - RequestConfiguration $requestConfiguration + RequestConfiguration $requestConfiguration, ): ResourceGridView { $driverConfiguration = $grid->getDriverConfiguration(); $request = $requestConfiguration->getRequest(); diff --git a/src/Bundle/Grid/View/ResourceGridViewFactoryInterface.php b/src/Bundle/Grid/View/ResourceGridViewFactoryInterface.php index ed2320a8e..0c2d552f5 100644 --- a/src/Bundle/Grid/View/ResourceGridViewFactoryInterface.php +++ b/src/Bundle/Grid/View/ResourceGridViewFactoryInterface.php @@ -24,6 +24,6 @@ public function create( Grid $grid, Parameters $parameters, MetadataInterface $metadata, - RequestConfiguration $requestConfiguration + RequestConfiguration $requestConfiguration, ): ResourceGridView; } diff --git a/src/Bundle/Routing/CrudRoutesAttributesLoader.php b/src/Bundle/Routing/CrudRoutesAttributesLoader.php index e3d1537b4..ab390331a 100644 --- a/src/Bundle/Routing/CrudRoutesAttributesLoader.php +++ b/src/Bundle/Routing/CrudRoutesAttributesLoader.php @@ -27,7 +27,7 @@ final class CrudRoutesAttributesLoader implements RouteLoaderInterface public function __construct( array $mapping, - ResourceLoader $resourceLoader + ResourceLoader $resourceLoader, ) { $this->mapping = $mapping; $this->resourceLoader = $resourceLoader; diff --git a/src/Bundle/Routing/ResourceLoader.php b/src/Bundle/Routing/ResourceLoader.php index c20983759..a7a85fe86 100644 --- a/src/Bundle/Routing/ResourceLoader.php +++ b/src/Bundle/Routing/ResourceLoader.php @@ -124,7 +124,7 @@ private function createRoute( string $path, string $actionName, array $methods, - bool $isApi = false + bool $isApi = false, ): Route { $defaults = [ '_controller' => $metadata->getServiceId('controller') . sprintf('::%sAction', $actionName), @@ -161,7 +161,7 @@ private function createRoute( $defaults['_sylius']['template'] = sprintf( false === strpos($configuration['templates'], ':') ? '%s/%s.html.twig' : '%s:%s.html.twig', $configuration['templates'], - $actionName + $actionName, ); } if (isset($configuration['redirect']) && in_array($actionName, ['create', 'update'], true)) { diff --git a/src/Bundle/Routing/RouteAttributesFactory.php b/src/Bundle/Routing/RouteAttributesFactory.php index cf37b8b39..144f0ae41 100644 --- a/src/Bundle/Routing/RouteAttributesFactory.php +++ b/src/Bundle/Routing/RouteAttributesFactory.php @@ -70,7 +70,7 @@ public function createRouteForClass(RouteCollection $routeCollection, string $cl $arguments['options'] ?? [], $arguments['host'] ?? '', $arguments['schemes'] ?? [], - $arguments['methods'] ?? [] + $arguments['methods'] ?? [], ); $routeCollection->add($arguments['name'], $route, $arguments['priority'] ?? 0); diff --git a/src/Bundle/Routing/RouteFactory.php b/src/Bundle/Routing/RouteFactory.php index d22ba880a..e47f49a52 100644 --- a/src/Bundle/Routing/RouteFactory.php +++ b/src/Bundle/Routing/RouteFactory.php @@ -31,7 +31,7 @@ public function createRoute( string $host = '', array $schemes = [], array $methods = [], - string $condition = '' + string $condition = '', ): Route { return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); } diff --git a/src/Bundle/Routing/RouteFactoryInterface.php b/src/Bundle/Routing/RouteFactoryInterface.php index eb0f77dd1..812c58be6 100644 --- a/src/Bundle/Routing/RouteFactoryInterface.php +++ b/src/Bundle/Routing/RouteFactoryInterface.php @@ -41,6 +41,6 @@ public function createRoute( string $host = '', array $schemes = [], array $methods = [], - string $condition = '' + string $condition = '', ): Route; } diff --git a/src/Bundle/Tests/Configuration/ConfigurationTest.php b/src/Bundle/Tests/Configuration/ConfigurationTest.php index 4b32a5d85..720c40526 100644 --- a/src/Bundle/Tests/Configuration/ConfigurationTest.php +++ b/src/Bundle/Tests/Configuration/ConfigurationTest.php @@ -29,7 +29,7 @@ public function it_does_not_break_if_not_customized() $this->assertConfigurationIsValid( [ [], - ] + ], ); } @@ -49,7 +49,7 @@ public function it_has_default_mapping_paths() ], ], ], - 'mapping' + 'mapping', ); } @@ -71,7 +71,7 @@ public function its_mapping_paths_can_be_customized() ], ], ], - 'mapping' + 'mapping', ); } @@ -85,7 +85,7 @@ public function it_has_default_authorization_checker() [], ], ['authorization_checker' => 'sylius.resource_controller.authorization_checker.disabled'], - 'authorization_checker' + 'authorization_checker', ); } @@ -99,7 +99,7 @@ public function its_authorization_checker_can_be_customized() ['authorization_checker' => 'custom_service'], ], ['authorization_checker' => 'custom_service'], - 'authorization_checker' + 'authorization_checker', ); } @@ -112,7 +112,7 @@ public function its_authorization_checker_cannot_be_empty() [ ['authorization_checker' => ''], ], - 'authorization_checker' + 'authorization_checker', ); } diff --git a/src/Bundle/Tests/DependencyInjection/Compiler/DoctrineTargetEntitiesResolverPassTest.php b/src/Bundle/Tests/DependencyInjection/Compiler/DoctrineTargetEntitiesResolverPassTest.php index 83b26c491..84d6b2ef6 100644 --- a/src/Bundle/Tests/DependencyInjection/Compiler/DoctrineTargetEntitiesResolverPassTest.php +++ b/src/Bundle/Tests/DependencyInjection/Compiler/DoctrineTargetEntitiesResolverPassTest.php @@ -30,7 +30,7 @@ public function it_adds_method_call_to_resolve_doctrine_target_entities(): void $this->setParameter( 'sylius.resources', - ['app.loremipsum' => ['classes' => ['model' => \stdClass::class, 'interface' => \Countable::class]]] + ['app.loremipsum' => ['classes' => ['model' => \stdClass::class, 'interface' => \Countable::class]]], ); $this->compile(); @@ -38,7 +38,7 @@ public function it_adds_method_call_to_resolve_doctrine_target_entities(): void $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( 'doctrine.orm.listeners.resolve_target_entity', 'addResolveTargetEntity', - [\Countable::class, \stdClass::class, []] + [\Countable::class, \stdClass::class, []], ); } @@ -55,7 +55,7 @@ public function it_adds_doctrine_event_listener_tag_to_target_entities_resolver_ $this->assertContainerBuilderHasServiceDefinitionWithTag( 'doctrine.orm.listeners.resolve_target_entity', 'doctrine.event_listener', - ['event' => 'loadClassMetadata'] + ['event' => 'loadClassMetadata'], ); } diff --git a/src/Bundle/Tests/DependencyInjection/Compiler/RegisterFormBuilderPassTest.php b/src/Bundle/Tests/DependencyInjection/Compiler/RegisterFormBuilderPassTest.php index f17f13154..d8b143176 100644 --- a/src/Bundle/Tests/DependencyInjection/Compiler/RegisterFormBuilderPassTest.php +++ b/src/Bundle/Tests/DependencyInjection/Compiler/RegisterFormBuilderPassTest.php @@ -30,7 +30,7 @@ public function it_registers_default_form_builder(): void 'default_form_builder', (new Definition()) ->addTag('sylius.default_resource_form.builder', ['type' => 'foo']) - ->addTag('sylius.default_resource_form.builder', ['type' => 'bar']) + ->addTag('sylius.default_resource_form.builder', ['type' => 'bar']), ); $this->compile(); @@ -38,13 +38,13 @@ public function it_registers_default_form_builder(): void $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( 'sylius.registry.form_builder', 'register', - ['foo', new Reference('default_form_builder')] + ['foo', new Reference('default_form_builder')], ); $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( 'sylius.registry.form_builder', 'register', - ['bar', new Reference('default_form_builder')] + ['bar', new Reference('default_form_builder')], ); } diff --git a/src/Bundle/Tests/DependencyInjection/Compiler/RegisterFqcnControllersPassTest.php b/src/Bundle/Tests/DependencyInjection/Compiler/RegisterFqcnControllersPassTest.php index ef11b3631..72dc9bd35 100644 --- a/src/Bundle/Tests/DependencyInjection/Compiler/RegisterFqcnControllersPassTest.php +++ b/src/Bundle/Tests/DependencyInjection/Compiler/RegisterFqcnControllersPassTest.php @@ -36,7 +36,7 @@ public function it_registers_alias_for_resource_controller_as_a_FQCN(): void 'driver' => 'doctrine/orm', 'classes' => ['model' => BookTestClass::class, 'controller' => BookTestController::class], ], - ] + ], ); $this->compile(); @@ -57,7 +57,7 @@ public function it_skips_the_alias_if_controller_class_is_not_defined(): void 'driver' => 'doctrine/orm', 'classes' => ['model' => BookTestClass::class], ], - ] + ], ); $this->compile(); @@ -77,7 +77,7 @@ public function it_throws_exception_if_class_does_not_implement_resource_interfa 'driver' => 'doctrine/orm', 'classes' => ['model' => NormalClass::class, 'controller' => BookTestController::class], ], - ] + ], ); $this->compile(); diff --git a/src/Bundle/Tests/DependencyInjection/Compiler/RegisterResourceRepositoryPassTest.php b/src/Bundle/Tests/DependencyInjection/Compiler/RegisterResourceRepositoryPassTest.php index 1210ae66a..44edcfa72 100644 --- a/src/Bundle/Tests/DependencyInjection/Compiler/RegisterResourceRepositoryPassTest.php +++ b/src/Bundle/Tests/DependencyInjection/Compiler/RegisterResourceRepositoryPassTest.php @@ -33,7 +33,7 @@ public function it_adds_resource_repository_to_resource_repository_registry(): v $this->setParameter( 'sylius.resources', - ['sylius.product' => []] + ['sylius.product' => []], ); $this->compile(); @@ -41,7 +41,7 @@ public function it_adds_resource_repository_to_resource_repository_registry(): v $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( 'sylius.registry.resource_repository', 'register', - ['sylius.product', new Reference('sylius.repository.product')] + ['sylius.product', new Reference('sylius.repository.product')], ); } @@ -55,7 +55,7 @@ public function it_does_not_add_resource_repository_to_resource_repository_regis $this->setParameter( 'sylius.resources', - ['sylius.product' => []] + ['sylius.product' => []], ); $this->compile(); @@ -74,7 +74,7 @@ public function it_does_not_add_resource_repository_to_resource_repository_regis $this->assertContainerBuilderNotHasServiceDefinitionWithMethodCall( 'sylius.registry.resource_repository', 'register', - ['sylius.product', new Reference('sylius.repository.product')] + ['sylius.product', new Reference('sylius.repository.product')], ); } @@ -87,7 +87,7 @@ public function it_does_not_add_resource_repository_to_resource_repository_regis $this->setParameter( 'sylius.resources', - ['sylius.product' => []] + ['sylius.product' => []], ); $this->compile(); @@ -95,7 +95,7 @@ public function it_does_not_add_resource_repository_to_resource_repository_regis $this->assertContainerBuilderNotHasServiceDefinitionWithMethodCall( 'sylius.registry.resource_repository', 'register', - ['sylius.product', new Reference('sylius.repository.product')] + ['sylius.product', new Reference('sylius.repository.product')], ); } @@ -107,13 +107,13 @@ protected function registerCompilerPass(ContainerBuilder $container): void private function assertContainerBuilderNotHasServiceDefinitionWithMethodCall( string $serviceId, string $method, - array $arguments + array $arguments, ): void { $definition = $this->container->findDefinition($serviceId); self::assertThat( $definition, - new LogicalNot(new DefinitionHasMethodCallConstraint($method, $arguments)) + new LogicalNot(new DefinitionHasMethodCallConstraint($method, $arguments)), ); } } diff --git a/src/Bundle/Tests/DependencyInjection/Compiler/RegisterResourcesPassTest.php b/src/Bundle/Tests/DependencyInjection/Compiler/RegisterResourcesPassTest.php index 3beb5388b..325fa6696 100644 --- a/src/Bundle/Tests/DependencyInjection/Compiler/RegisterResourcesPassTest.php +++ b/src/Bundle/Tests/DependencyInjection/Compiler/RegisterResourcesPassTest.php @@ -33,7 +33,7 @@ public function it_adds_method_call_to_resource_registry_if_resources_exist() [ 'app.book' => ['classes' => ['model' => BookClass::class]], 'app.author' => ['classes' => ['model' => AuthorClass::class]], - ] + ], ); $this->compile(); @@ -41,13 +41,13 @@ public function it_adds_method_call_to_resource_registry_if_resources_exist() $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( 'sylius.resource_registry', 'addFromAliasAndConfiguration', - ['app.book', ['classes' => ['model' => BookClass::class]]] + ['app.book', ['classes' => ['model' => BookClass::class]]], ); $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( 'sylius.resource_registry', 'addFromAliasAndConfiguration', - ['app.author', ['classes' => ['model' => AuthorClass::class]]] + ['app.author', ['classes' => ['model' => AuthorClass::class]]], ); } diff --git a/src/Bundle/Tests/DependencyInjection/Compiler/WinzouStateMachinePassTest.php b/src/Bundle/Tests/DependencyInjection/Compiler/WinzouStateMachinePassTest.php index b2be530df..f6ffd025e 100644 --- a/src/Bundle/Tests/DependencyInjection/Compiler/WinzouStateMachinePassTest.php +++ b/src/Bundle/Tests/DependencyInjection/Compiler/WinzouStateMachinePassTest.php @@ -45,7 +45,7 @@ public function all_winzou_services_are_public(): void foreach ($services as $id) { Assert::assertNotNull( $container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE), - sprintf('Service "%s" could not be found', $id) + sprintf('Service "%s" could not be found', $id), ); } } diff --git a/src/Bundle/Tests/DependencyInjection/PagerfantaExtensionTest.php b/src/Bundle/Tests/DependencyInjection/PagerfantaExtensionTest.php index 17d61f9e8..d5eb8b959 100644 --- a/src/Bundle/Tests/DependencyInjection/PagerfantaExtensionTest.php +++ b/src/Bundle/Tests/DependencyInjection/PagerfantaExtensionTest.php @@ -31,7 +31,7 @@ public function it_prepends_the_white_october_bundle_configuration_to_the_babdev [ 'BabDevPagerfantaBundle' => BabDevPagerfantaBundle::class, 'TwigBundle' => TwigBundle::class, - ] + ], ); $bundleConfig = [ diff --git a/src/Bundle/Tests/Form/Type/ResourceAutocompleteChoiceTypeTest.php b/src/Bundle/Tests/Form/Type/ResourceAutocompleteChoiceTypeTest.php index a0225880b..03dff31f2 100644 --- a/src/Bundle/Tests/Form/Type/ResourceAutocompleteChoiceTypeTest.php +++ b/src/Bundle/Tests/Form/Type/ResourceAutocompleteChoiceTypeTest.php @@ -62,7 +62,7 @@ public function it_returns_resource_from_its_code(): void $form = $this->factory->create( ResourceAutocompleteChoiceType::class, null, - ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code'] + ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code'], ); $form->submit('mug'); @@ -85,7 +85,7 @@ public function it_returns_resource_from_its_id(): void $form = $this->factory->create( ResourceAutocompleteChoiceType::class, null, - ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'id'] + ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'id'], ); $form->submit('1'); @@ -108,7 +108,7 @@ public function it_returns_different_resource_from_its_identifier(): void $form = $this->factory->create( ResourceAutocompleteChoiceType::class, null, - ['resource' => 'sylius.zone', 'choice_name' => 'name', 'choice_value' => 'code'] + ['resource' => 'sylius.zone', 'choice_name' => 'name', 'choice_value' => 'code'], ); $form->submit('eu'); @@ -131,7 +131,7 @@ public function it_has_identifier_as_view_value(): void $form = $this->factory->create( ResourceAutocompleteChoiceType::class, null, - ['resource' => 'sylius.zone', 'choice_name' => 'name', 'choice_value' => 'code'] + ['resource' => 'sylius.zone', 'choice_name' => 'name', 'choice_value' => 'code'], ); $form->submit('eu'); @@ -154,7 +154,7 @@ public function it_has_different_view_based_on_passed_configuration(): void $form = $this->factory->create( ResourceAutocompleteChoiceType::class, null, - ['resource' => 'sylius.zone', 'choice_name' => 'name', 'choice_value' => 'code'] + ['resource' => 'sylius.zone', 'choice_name' => 'name', 'choice_value' => 'code'], ); $formViewVars = $form->createView()->vars; @@ -184,14 +184,14 @@ public function it_returns_collection_of_resources_from_identifiers(): void $form = $this->factory->create( ResourceAutocompleteChoiceType::class, new ArrayCollection(), - ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code', 'multiple' => true] + ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code', 'multiple' => true], ); $form->submit('mug,book,sticker'); $this->assertEquals( new ArrayCollection([$mug->reveal(), $book->reveal(), $sticker->reveal()]), - $form->getData() + $form->getData(), ); } @@ -205,7 +205,7 @@ public function its_resource_option_should_be_string(): void $this->factory->create( ResourceAutocompleteChoiceType::class, new ArrayCollection(), - ['resource' => 1, 'choice_name' => 'name', 'choice_value' => 'code', 'multiple' => true] + ['resource' => 1, 'choice_name' => 'name', 'choice_value' => 'code', 'multiple' => true], ); } @@ -219,7 +219,7 @@ public function its_choice_name_option_should_be_string(): void $this->factory->create( ResourceAutocompleteChoiceType::class, new ArrayCollection(), - ['resource' => 1, 'choice_name' => 1, 'choice_value' => 'code', 'multiple' => true] + ['resource' => 1, 'choice_name' => 1, 'choice_value' => 'code', 'multiple' => true], ); } @@ -233,7 +233,7 @@ public function its_choice_value_option_should_be_string(): void $this->factory->create( ResourceAutocompleteChoiceType::class, new ArrayCollection(), - ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 1, 'multiple' => true] + ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 1, 'multiple' => true], ); } @@ -247,7 +247,7 @@ public function its_multiple_option_should_be_boolean(): void $this->factory->create( ResourceAutocompleteChoiceType::class, new ArrayCollection(), - ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code', 'multiple' => 'yes'] + ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code', 'multiple' => 'yes'], ); } @@ -261,7 +261,7 @@ public function its_placeholder_option_should_be_string(): void $this->factory->create( ResourceAutocompleteChoiceType::class, new ArrayCollection(), - ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code', 'placeholder' => 1] + ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code', 'placeholder' => 1], ); } @@ -275,7 +275,7 @@ public function it_cannot_be_created_without_resource_option(): void $this->factory->create( ResourceAutocompleteChoiceType::class, new ArrayCollection(), - ['choice_name' => 'name', 'choice_value' => 'code'] + ['choice_name' => 'name', 'choice_value' => 'code'], ); } @@ -289,7 +289,7 @@ public function it_cannot_be_created_without_choice_name_option(): void $this->factory->create( ResourceAutocompleteChoiceType::class, new ArrayCollection(), - ['resource' => 'sylius.resource', 'choice_value' => 'code'] + ['resource' => 'sylius.resource', 'choice_value' => 'code'], ); } @@ -303,7 +303,7 @@ public function it_cannot_be_created_without_choice_value_option(): void $this->factory->create( ResourceAutocompleteChoiceType::class, new ArrayCollection(), - ['resource' => 'sylius.resource', 'choice_name' => 'name'] + ['resource' => 'sylius.resource', 'choice_name' => 'name'], ); } } diff --git a/src/Bundle/Tests/Form/Type/ResourceTranslationsTypeTest.php b/src/Bundle/Tests/Form/Type/ResourceTranslationsTypeTest.php index d75fe9774..5e720f350 100644 --- a/src/Bundle/Tests/Form/Type/ResourceTranslationsTypeTest.php +++ b/src/Bundle/Tests/Form/Type/ResourceTranslationsTypeTest.php @@ -47,7 +47,7 @@ public function it_respects_entry_options(): void $form = $this->factory->create( ResourceTranslationsType::class, null, - ['entry_type' => TextType::class, 'entry_options' => ['empty_data' => 'Default']] + ['entry_type' => TextType::class, 'entry_options' => ['empty_data' => 'Default']], ); // Testing child type because of `$event->getForm()->getParent()->getData()` inside ResourceTranslationsType::submit() diff --git a/src/Bundle/Validator/DisabledValidator.php b/src/Bundle/Validator/DisabledValidator.php index eb275a896..0df60eab7 100644 --- a/src/Bundle/Validator/DisabledValidator.php +++ b/src/Bundle/Validator/DisabledValidator.php @@ -33,7 +33,7 @@ public function validate($value, Constraint $constraint): void throw new \InvalidArgumentException(sprintf( '"%s" validates "%s" instances only', __CLASS__, - ToggleableInterface::class + ToggleableInterface::class, )); } diff --git a/src/Bundle/Validator/EnabledValidator.php b/src/Bundle/Validator/EnabledValidator.php index a9049ea08..2f676bad0 100644 --- a/src/Bundle/Validator/EnabledValidator.php +++ b/src/Bundle/Validator/EnabledValidator.php @@ -33,7 +33,7 @@ public function validate($value, Constraint $constraint): void throw new \InvalidArgumentException(sprintf( '"%s" validates "%s" instances only', __CLASS__, - ToggleableInterface::class + ToggleableInterface::class, )); } diff --git a/src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php b/src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php index 766a3cf56..339690235 100644 --- a/src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php +++ b/src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php @@ -44,13 +44,15 @@ public function validate($value, Constraint $constraint): void $this->context ->buildViolation($constraint->message) ->atPath(sprintf('[%d].%s', $key, $constraint->attributePath)) - ->addViolation(); + ->addViolation() + ; if (false !== $collectionOfEntitiesCodes[$checkingAttribute]) { $this->context ->buildViolation($constraint->message) ->atPath(sprintf('[%d].%s', $collectionOfEntitiesCodes[$checkingAttribute], $constraint->attributePath)) - ->addViolation(); + ->addViolation() + ; $collectionOfEntitiesCodes[$checkingAttribute] = false; } diff --git a/src/Bundle/spec/Controller/EventDispatcherSpec.php b/src/Bundle/spec/Controller/EventDispatcherSpec.php index e8e161a74..e4375820b 100644 --- a/src/Bundle/spec/Controller/EventDispatcherSpec.php +++ b/src/Bundle/spec/Controller/EventDispatcherSpec.php @@ -40,7 +40,7 @@ function it_dispatches_appropriate_event_for_a_resource( RequestConfiguration $requestConfiguration, MetadataInterface $metadata, EventDispatcherInterface $eventDispatcher, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getEvent()->willReturn(null); $requestConfiguration->getMetadata()->willReturn($metadata); @@ -56,7 +56,7 @@ function it_dispatches_appropriate_custom_event_for_a_resource( RequestConfiguration $requestConfiguration, MetadataInterface $metadata, EventDispatcherInterface $eventDispatcher, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getEvent()->willReturn('register'); $requestConfiguration->getMetadata()->willReturn($metadata); @@ -72,7 +72,7 @@ function it_dispatches_event_for_a_collection_of_resources( RequestConfiguration $requestConfiguration, MetadataInterface $metadata, EventDispatcherInterface $eventDispatcher, - Collection $resources + Collection $resources, ): void { $requestConfiguration->getEvent()->willReturn('register'); $requestConfiguration->getMetadata()->willReturn($metadata); @@ -88,7 +88,7 @@ function it_dispatches_appropriate_pre_event_for_a_resource( RequestConfiguration $requestConfiguration, MetadataInterface $metadata, EventDispatcherInterface $eventDispatcher, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getEvent()->willReturn(null); $requestConfiguration->getMetadata()->willReturn($metadata); @@ -104,7 +104,7 @@ function it_dispatches_appropriate_custom_pre_event_for_a_resource( RequestConfiguration $requestConfiguration, MetadataInterface $metadata, EventDispatcherInterface $eventDispatcher, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getEvent()->willReturn('register'); $requestConfiguration->getMetadata()->willReturn($metadata); @@ -120,7 +120,7 @@ function it_dispatches_appropriate_post_event_for_a_resource( RequestConfiguration $requestConfiguration, MetadataInterface $metadata, EventDispatcherInterface $eventDispatcher, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getEvent()->willReturn(null); $requestConfiguration->getMetadata()->willReturn($metadata); @@ -136,7 +136,7 @@ function it_dispatches_appropriate_custom_post_event_for_a_resource( RequestConfiguration $requestConfiguration, MetadataInterface $metadata, EventDispatcherInterface $eventDispatcher, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getEvent()->willReturn('register'); $requestConfiguration->getMetadata()->willReturn($metadata); diff --git a/src/Bundle/spec/Controller/FlashHelperSpec.php b/src/Bundle/spec/Controller/FlashHelperSpec.php index 1a1c87dc9..68e98d777 100644 --- a/src/Bundle/spec/Controller/FlashHelperSpec.php +++ b/src/Bundle/spec/Controller/FlashHelperSpec.php @@ -45,7 +45,7 @@ function it_adds_resource_message_by_default( FlashBagInterface $flashBag, MetadataInterface $metadata, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getHumanizedName()->willReturn('product'); @@ -62,7 +62,7 @@ function it_adds_resource_message_by_default( [ 'message' => 'sylius.resource.create', 'parameters' => ['%resource%' => 'Product'], - ] + ], )->shouldBeCalled(); $this->addSuccessFlash($requestConfiguration, ResourceActions::CREATE, $resource); @@ -74,7 +74,7 @@ function it_adds_resource_message_when_catalogue_is_unavailable_and_given_messag FlashBagInterface $flashBag, MetadataInterface $metadata, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): void { $parameters = ['%resource%' => 'Product']; @@ -92,7 +92,7 @@ function it_adds_resource_message_when_catalogue_is_unavailable_and_given_messag [ 'message' => 'sylius.resource.create', 'parameters' => $parameters, - ] + ], )->shouldBeCalled(); $this->addSuccessFlash($requestConfiguration, ResourceActions::CREATE, $resource); @@ -104,7 +104,7 @@ function it_adds_resource_message_when_catalogue_is_unavailable_and_given_messag FlashBagInterface $flashBag, MetadataInterface $metadata, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): void { $parameters = ['%resource%' => 'Spoon']; @@ -126,7 +126,7 @@ function it_adds_resource_message_when_catalogue_is_unavailable_and_given_messag [ 'message' => '%resource% is the best cutlery of them all!', 'parameters' => $parameters, - ] + ], )->shouldBeCalled(); $this->addSuccessFlash($requestConfiguration, ResourceActions::CREATE, $resource); @@ -139,7 +139,7 @@ function it_adds_resource_message_if_message_was_not_found_in_the_catalogue( FlashBagInterface $flashBag, MetadataInterface $metadata, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getHumanizedName()->willReturn('product'); @@ -157,7 +157,7 @@ function it_adds_resource_message_if_message_was_not_found_in_the_catalogue( [ 'message' => 'sylius.resource.create', 'parameters' => ['%resource%' => 'Product'], - ] + ], )->shouldBeCalled(); $this->addSuccessFlash($requestConfiguration, ResourceActions::CREATE, $resource); @@ -170,7 +170,7 @@ function it_adds_overwritten_message( FlashBagInterface $flashBag, MetadataInterface $metadata, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getHumanizedName()->willReturn('product'); @@ -195,7 +195,7 @@ function it_adds_custom_message( FlashBagInterface $flashBag, MetadataInterface $metadata, RequestConfiguration $requestConfiguration, - ResourceInterface $resource + ResourceInterface $resource, ): void { $metadata->getApplicationName()->willReturn('app'); $metadata->getHumanizedName()->willReturn('book'); @@ -217,7 +217,7 @@ function it_adds_message_from_event( SessionInterface $session, FlashBagInterface $flashBag, RequestConfiguration $requestConfiguration, - ResourceControllerEvent $event + ResourceControllerEvent $event, ): void { $event->getMessage()->willReturn('sylius.channel.cannot_be_deleted'); $event->getMessageType()->willReturn(ResourceControllerEvent::TYPE_WARNING); @@ -230,7 +230,7 @@ function it_adds_message_from_event( [ 'message' => 'sylius.channel.cannot_be_deleted', 'parameters' => ['%name%' => 'Germany Sylius Webshop'], - ] + ], )->shouldBeCalled(); $this->addFlashFromEvent($requestConfiguration, $event); diff --git a/src/Bundle/spec/Controller/NewResourceFactorySpec.php b/src/Bundle/spec/Controller/NewResourceFactorySpec.php index 7b7fa56af..278e84ef5 100644 --- a/src/Bundle/spec/Controller/NewResourceFactorySpec.php +++ b/src/Bundle/spec/Controller/NewResourceFactorySpec.php @@ -29,7 +29,7 @@ function it_implements_new_resource_factory_interface(): void function it_calls_create_new_by_default_if_no_custom_method_configured( RequestConfiguration $requestConfiguration, FactoryInterface $factory, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getFactoryMethod()->willReturn(null); @@ -41,7 +41,7 @@ function it_calls_create_new_by_default_if_no_custom_method_configured( function it_calls_proper_factory_methods_based_on_configuration( RequestConfiguration $requestConfiguration, FactoryInterface $factory, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getFactoryMethod()->willReturn('createNew'); $requestConfiguration->getFactoryArguments()->willReturn(['00032']); @@ -55,7 +55,7 @@ function it_calls_proper_service_based_on_configuration( RequestConfiguration $requestConfiguration, FactoryInterface $factory, FactoryInterface $customFactory, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getFactoryMethod()->willReturn([$customFactory, 'createNew']); $requestConfiguration->getFactoryArguments()->willReturn(['foo', 'bar']); diff --git a/src/Bundle/spec/Controller/RedirectHandlerSpec.php b/src/Bundle/spec/Controller/RedirectHandlerSpec.php index 61eb5a0d8..e45d75b0c 100644 --- a/src/Bundle/spec/Controller/RedirectHandlerSpec.php +++ b/src/Bundle/spec/Controller/RedirectHandlerSpec.php @@ -39,7 +39,7 @@ function it_implements_redirect_handler_interface(): void function it_redirects_to_resource( RouterInterface $router, RequestConfiguration $configuration, - ResourceInterface $resource + ResourceInterface $resource, ): void { $configuration->getRedirectParameters($resource)->willReturn([]); $configuration->getRedirectRoute('show')->willReturn('my_route'); @@ -55,7 +55,7 @@ function it_redirects_to_resource( function it_fallbacks_to_index_route_if_show_does_not_exist( RouterInterface $router, RequestConfiguration $configuration, - ResourceInterface $resource + ResourceInterface $resource, ): void { $configuration->getRedirectParameters($resource)->willReturn([]); $configuration->getRedirectRoute('show')->willReturn('app_resource_show'); @@ -73,7 +73,7 @@ function it_fallbacks_to_index_route_if_show_does_not_exist( function it_redirects_to_index( RouterInterface $router, RequestConfiguration $configuration, - ResourceInterface $resource + ResourceInterface $resource, ): void { $configuration->getRedirectRoute('index')->willReturn('my_route'); $configuration->getRedirectParameters($resource)->willReturn([]); diff --git a/src/Bundle/spec/Controller/RequestConfigurationFactorySpec.php b/src/Bundle/spec/Controller/RequestConfigurationFactorySpec.php index 49106eaa1..0f8e2e705 100644 --- a/src/Bundle/spec/Controller/RequestConfigurationFactorySpec.php +++ b/src/Bundle/spec/Controller/RequestConfigurationFactorySpec.php @@ -39,7 +39,7 @@ function it_creates_configuration_from_resource_metadata_and_request( MetadataInterface $metadata, Request $request, HeaderBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $request->headers = $headersBag; $request->attributes = $attributesBag; @@ -60,7 +60,7 @@ function it_creates_configuration_without_default_settings( MetadataInterface $metadata, Request $request, HeaderBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $request->headers = $headersBag; $request->attributes = $attributesBag; @@ -81,7 +81,7 @@ function it_creates_configuration_for_serialization_group_from_single_header( MetadataInterface $metadata, Request $request, HeaderBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $request->headers = $headersBag; $request->attributes = $attributesBag; @@ -97,7 +97,7 @@ function it_creates_configuration_for_serialization_group_from_single_header( 'allowed_serialization_groups' => ['Default', 'Detailed', 'Other'], 'serialization_groups' => ['Default', 'Detailed'], ], - $request + $request, ) ->willReturn(['serialization_groups' => ['Default', 'Detailed']]) ; @@ -110,7 +110,7 @@ function it_creates_configuration_for_serialization_group_from_multiple_headers( MetadataInterface $metadata, Request $request, HeaderBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $request->headers = $headersBag; $request->attributes = $attributesBag; @@ -126,7 +126,7 @@ function it_creates_configuration_for_serialization_group_from_multiple_headers( 'allowed_serialization_groups' => ['Default', 'Detailed', 'Other'], 'serialization_groups' => ['Default', 'Detailed'], ], - $request + $request, ) ->willReturn(['serialization_groups' => ['Default', 'Detailed']]) ; @@ -139,7 +139,7 @@ function it_creates_configuration_using_only_those_serialization_groups_that_are MetadataInterface $metadata, Request $request, ParameterBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $request->headers = $headersBag; $request->attributes = $attributesBag; @@ -155,7 +155,7 @@ function it_creates_configuration_using_only_those_serialization_groups_that_are 'allowed_serialization_groups' => ['Default'], 'serialization_groups' => ['Default'], ], - $request + $request, ) ->willReturn(['serialization_groups' => ['Default']]) ; @@ -168,7 +168,7 @@ function it_creates_configuration_using_only_those_serialization_groups_that_are MetadataInterface $metadata, Request $request, ParameterBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $request->headers = $headersBag; $request->attributes = $attributesBag; @@ -185,7 +185,7 @@ function it_creates_configuration_using_only_those_serialization_groups_that_are 'allowed_serialization_groups' => ['Default'], 'serialization_groups' => ['Default', 'Detailed'], ], - $request + $request, ) ->willReturn(['serialization_groups' => ['Default', 'Detailed']]) ; @@ -198,7 +198,7 @@ function it_creates_configuration_using_only_those_serialization_groups_that_are MetadataInterface $metadata, Request $request, ParameterBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $request->headers = $headersBag; $request->attributes = $attributesBag; @@ -221,7 +221,7 @@ function it_creates_configuration_for_serialization_version_from_single_header( MetadataInterface $metadata, Request $request, HeaderBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $request->headers = $headersBag; $request->attributes = $attributesBag; @@ -243,7 +243,7 @@ function it_creates_configuration_for_serialization_version_from_multiple_header MetadataInterface $metadata, Request $request, HeaderBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $request->headers = $headersBag; $request->attributes = $attributesBag; @@ -265,7 +265,7 @@ function it_creates_configuration_with_default_settings( MetadataInterface $metadata, Request $request, HeaderBag $headersBag, - ParameterBag $attributesBag + ParameterBag $attributesBag, ): void { $this->beConstructedWith($parametersParser, RequestConfiguration::class, ['sortable' => true]); diff --git a/src/Bundle/spec/Controller/ResourceControllerSpec.php b/src/Bundle/spec/Controller/ResourceControllerSpec.php index 33a02a182..168ba58a4 100644 --- a/src/Bundle/spec/Controller/ResourceControllerSpec.php +++ b/src/Bundle/spec/Controller/ResourceControllerSpec.php @@ -74,7 +74,7 @@ function let( StateMachineInterface $stateMachine, ResourceUpdateHandlerInterface $resourceUpdateHandler, ResourceDeleteHandlerInterface $resourceDeleteHandler, - ContainerInterface $container + ContainerInterface $container, ): void { $this->beConstructedWith( $metadata, @@ -93,7 +93,7 @@ function let( $eventDispatcher, $stateMachine, $resourceUpdateHandler, - $resourceDeleteHandler + $resourceDeleteHandler, ); $this->setContainer($container); @@ -104,7 +104,7 @@ function it_throws_a_403_exception_if_user_is_unauthorized_to_view_a_single_reso RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, Request $request, - AuthorizationCheckerInterface $authorizationChecker + AuthorizationCheckerInterface $authorizationChecker, ): void { $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); $configuration->hasPermission()->willReturn(true); @@ -125,7 +125,7 @@ function it_throws_a_404_exception_if_resource_is_not_found_based_on_configurati Request $request, AuthorizationCheckerInterface $authorizationChecker, RepositoryInterface $repository, - SingleResourceProviderInterface $singleResourceProvider + SingleResourceProviderInterface $singleResourceProvider, ): void { $metadata->getHumanizedName()->willReturn('product'); $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); @@ -152,7 +152,7 @@ function it_returns_a_response_for_html_view_of_a_single_resource( EventDispatcherInterface $eventDispatcher, ContainerInterface $container, Environment $twig, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -199,7 +199,7 @@ function it_returns_event_response_if_exists_during_show( ResourceControllerEvent $event, ResourceInterface $resource, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -232,7 +232,7 @@ function it_returns_a_response_for_non_html_view_of_single_resource( ViewHandlerInterface $viewHandler, EventDispatcherInterface $eventDispatcher, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -260,7 +260,7 @@ function it_throws_a_403_exception_if_user_is_unauthorized_to_view_an_index_of_r RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, Request $request, - AuthorizationCheckerInterface $authorizationChecker + AuthorizationCheckerInterface $authorizationChecker, ): void { $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); $configuration->hasPermission()->willReturn(true); @@ -286,7 +286,7 @@ function it_returns_a_response_for_html_view_of_paginated_resources( ResourceInterface $resource2, ContainerInterface $container, Environment $twig, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -335,7 +335,7 @@ function it_returns_event_response_if_exists_during_index( ResourceInterface $resource1, ResourceInterface $resource2, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -364,7 +364,7 @@ function it_throws_a_403_exception_if_user_is_unauthorized_to_create_a_new_resou RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, Request $request, - AuthorizationCheckerInterface $authorizationChecker + AuthorizationCheckerInterface $authorizationChecker, ): void { $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); $configuration->hasPermission()->willReturn(true); @@ -394,7 +394,7 @@ function it_returns_a_html_response_for_creating_new_resource_form( FormView $formView, ContainerInterface $container, Environment $twig, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -453,7 +453,7 @@ function it_returns_a_html_response_for_invalid_form_during_resource_creation( FormView $formView, ContainerInterface $container, Environment $twig, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -514,7 +514,7 @@ function it_returns_a_html_response_for_not_submitted_form_during_resource_creat FormView $formView, ContainerInterface $container, Environment $twig, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -571,7 +571,7 @@ function it_returns_a_non_html_response_for_invalid_form_during_resource_creatio ResourceFormFactoryInterface $resourceFormFactory, Form $form, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -612,7 +612,7 @@ function it_returns_a_non_html_response_for_not_submitted_form_during_resource_c ResourceFormFactoryInterface $resourceFormFactory, Form $form, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -657,7 +657,7 @@ function it_does_not_create_the_resource_and_redirects_to_index_for_html_request EventDispatcherInterface $eventDispatcher, ResourceControllerEvent $event, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -711,7 +711,7 @@ function it_does_not_create_the_resource_and_return_response_for_html_requests_s EventDispatcherInterface $eventDispatcher, ResourceControllerEvent $event, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -768,7 +768,7 @@ function it_redirects_to_newly_created_resource( ResourceControllerEvent $event, ResourceControllerEvent $postEvent, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -825,7 +825,7 @@ function it_uses_response_from_post_create_event_if_defined( ResourceControllerEvent $event, ResourceControllerEvent $postEvent, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -881,7 +881,7 @@ function it_returns_a_non_html_response_for_correctly_created_resources( StateMachineInterface $stateMachine, Form $form, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -936,7 +936,7 @@ function it_does_not_create_the_resource_and_throws_http_exception_for_non_html_ EventDispatcherInterface $eventDispatcher, Form $form, Request $request, - ResourceControllerEvent $event + ResourceControllerEvent $event, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -979,7 +979,7 @@ function it_throws_a_403_exception_if_user_is_unauthorized_to_edit_a_single_reso RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, Request $request, - AuthorizationCheckerInterface $authorizationChecker + AuthorizationCheckerInterface $authorizationChecker, ): void { $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); $configuration->hasPermission()->willReturn(true); @@ -1000,7 +1000,7 @@ function it_throws_a_404_exception_if_resource_to_update_is_not_found_based_on_c Request $request, AuthorizationCheckerInterface $authorizationChecker, RepositoryInterface $repository, - SingleResourceProviderInterface $singleResourceProvider + SingleResourceProviderInterface $singleResourceProvider, ): void { $metadata->getHumanizedName()->willReturn('product'); $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); @@ -1031,7 +1031,7 @@ function it_returns_a_html_response_for_updating_resource_form( FormView $formView, ContainerInterface $container, Environment $twig, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1094,7 +1094,7 @@ function it_returns_a_html_response_for_invalid_form_during_resource_update( FormView $formView, ContainerInterface $container, Environment $twig, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1158,7 +1158,7 @@ function it_returns_a_html_response_for_not_submitted_form_during_resource_updat FormView $formView, ContainerInterface $container, Environment $twig, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1218,7 +1218,7 @@ function it_returns_a_non_html_response_for_invalid_form_during_resource_update( ResourceFormFactoryInterface $resourceFormFactory, Form $form, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1258,7 +1258,7 @@ function it_returns_a_non_html_response_for_not_submitted_form_during_resource_u ResourceFormFactoryInterface $resourceFormFactory, Form $form, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1301,7 +1301,7 @@ function it_does_not_update_the_resource_and_redirects_to_resource_for_html_requ FlashHelperInterface $flashHelper, ResourceControllerEvent $event, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1358,7 +1358,7 @@ function it_redirects_to_updated_resource( ResourceControllerEvent $preEvent, ResourceControllerEvent $postEvent, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1417,7 +1417,7 @@ function it_uses_response_from_post_update_event_if_defined( ResourceControllerEvent $preEvent, ResourceControllerEvent $postEvent, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1476,7 +1476,7 @@ function it_uses_response_from_initialize_create_event_if_defined( ContainerInterface $container, Environment $twig, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1533,7 +1533,7 @@ function it_uses_response_from_initialize_update_event_if_defined( Form $form, ResourceControllerEvent $initializeEvent, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1587,7 +1587,7 @@ function it_returns_a_non_html_response_for_correctly_updated_resource( ResourceControllerEvent $event, Form $form, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1639,7 +1639,7 @@ function it_does_not_update_the_resource_throws_a_http_exception_for_non_html_re EventDispatcherInterface $eventDispatcher, ResourceControllerEvent $event, Form $form, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1694,7 +1694,7 @@ function it_applies_state_machine_transition_to_updated_resource_if_configured( ResourceControllerEvent $preEvent, ResourceControllerEvent $postEvent, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1740,7 +1740,7 @@ function it_throws_a_403_exception_if_user_is_unauthorized_to_delete_multiple_re RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, Request $request, - AuthorizationCheckerInterface $authorizationChecker + AuthorizationCheckerInterface $authorizationChecker, ): void { $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); $configuration->hasPermission()->willReturn(true); @@ -1774,7 +1774,7 @@ function it_deletes_multiple_resources_and_redirects_to_index_for_html_request( ResourceControllerEvent $secondPostEvent, ResourceDeleteHandlerInterface $resourceDeleteHandler, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1839,7 +1839,7 @@ function it_throws_a_403_exception_if_user_is_unauthorized_to_delete_a_single_re RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, Request $request, - AuthorizationCheckerInterface $authorizationChecker + AuthorizationCheckerInterface $authorizationChecker, ): void { $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); $configuration->hasPermission()->willReturn(true); @@ -1860,7 +1860,7 @@ function it_throws_a_404_exception_if_resource_for_deletion_is_not_found_based_o Request $request, AuthorizationCheckerInterface $authorizationChecker, RepositoryInterface $repository, - SingleResourceProviderInterface $singleResourceProvider + SingleResourceProviderInterface $singleResourceProvider, ): void { $metadata->getHumanizedName()->willReturn('product'); $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); @@ -1893,7 +1893,7 @@ function it_deletes_a_resource_and_redirects_to_index_by_for_html_request( ResourceControllerEvent $postEvent, ResourceDeleteHandlerInterface $resourceDeleteHandler, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1944,7 +1944,7 @@ function it_uses_response_from_post_delete_event_if_defined( ResourceControllerEvent $postEvent, ResourceDeleteHandlerInterface $resourceDeleteHandler, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -1995,7 +1995,7 @@ function it_does_not_delete_a_resource_and_redirects_to_index_for_html_requests_ ResourceControllerEvent $event, ResourceDeleteHandlerInterface $resourceDeleteHandler, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2046,7 +2046,7 @@ function it_does_not_delete_a_resource_and_uses_response_from_event_if_defined( ResourceControllerEvent $event, ResourceDeleteHandlerInterface $resourceDeleteHandler, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2099,7 +2099,7 @@ function it_does_not_correctly_delete_a_resource_and_returns_500_for_not_html_re ResourceControllerEvent $event, ResourceDeleteHandlerInterface $resourceDeleteHandler, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2149,7 +2149,7 @@ function it_deletes_a_resource_and_returns_204_for_non_html_requests( ResourceControllerEvent $event, ResourceDeleteHandlerInterface $resourceDeleteHandler, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2197,7 +2197,7 @@ function it_does_not_delete_a_resource_and_throws_http_exception_for_non_html_re ContainerInterface $container, ResourceControllerEvent $event, ResourceDeleteHandlerInterface $resourceDeleteHandler, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2249,7 +2249,7 @@ function it_throws_a_403_exception_if_csrf_token_is_invalid_during_delete_action ContainerInterface $container, ResourceControllerEvent $event, ResourceDeleteHandlerInterface $resourceDeleteHandler, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2290,7 +2290,7 @@ function it_throws_a_403_exception_if_user_is_unauthorized_to_apply_state_machin RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, Request $request, - AuthorizationCheckerInterface $authorizationChecker + AuthorizationCheckerInterface $authorizationChecker, ): void { $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); $configuration->hasPermission()->willReturn(true); @@ -2311,7 +2311,7 @@ function it_throws_a_404_exception_if_resource_is_not_found_when_trying_to_apply Request $request, AuthorizationCheckerInterface $authorizationChecker, RepositoryInterface $repository, - SingleResourceProviderInterface $singleResourceProvider + SingleResourceProviderInterface $singleResourceProvider, ): void { $metadata->getHumanizedName()->willReturn('product'); $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration); @@ -2342,7 +2342,7 @@ function it_does_not_apply_state_machine_transition_on_resource_if_not_applicabl CsrfTokenManagerInterface $csrfTokenManager, ContainerInterface $container, ResourceControllerEvent $event, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2401,7 +2401,7 @@ function it_applies_state_machine_transition_to_resource_and_redirects_for_html_ ResourceControllerEvent $event, ResourceControllerEvent $postEvent, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2458,7 +2458,7 @@ function it_uses_response_from_post_apply_state_machine_transition_event_if_defi ResourceControllerEvent $event, ResourceControllerEvent $postEvent, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2513,7 +2513,7 @@ function it_does_not_apply_state_machine_transition_on_resource_and_redirects_fo ContainerInterface $container, ResourceControllerEvent $event, Request $request, - Response $redirectResponse + Response $redirectResponse, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2568,7 +2568,7 @@ function it_does_not_apply_state_machine_transition_on_resource_and_return_event ContainerInterface $container, ResourceControllerEvent $event, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2623,7 +2623,7 @@ function it_applies_state_machine_transition_on_resource_and_returns_200_for_non ResourceInterface $resource, ResourceControllerEvent $event, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2672,7 +2672,7 @@ function it_applies_state_machine_transition_on_resource_and_returns_204_for_non ResourceInterface $resource, ResourceControllerEvent $event, Request $request, - Response $response + Response $response, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); @@ -2718,7 +2718,7 @@ function it_does_not_apply_state_machine_transition_resource_and_throws_http_exc FlashHelperInterface $flashHelper, EventDispatcherInterface $eventDispatcher, ResourceControllerEvent $event, - Request $request + Request $request, ): void { $metadata->getApplicationName()->willReturn('sylius'); $metadata->getName()->willReturn('product'); diff --git a/src/Bundle/spec/Controller/ResourceFormFactorySpec.php b/src/Bundle/spec/Controller/ResourceFormFactorySpec.php index 5aa912b67..d55cd889a 100644 --- a/src/Bundle/spec/Controller/ResourceFormFactorySpec.php +++ b/src/Bundle/spec/Controller/ResourceFormFactorySpec.php @@ -37,7 +37,7 @@ function it_creates_appropriate_form_based_on_configuration( RequestConfiguration $requestConfiguration, ResourceInterface $resource, FormFactoryInterface $formFactory, - FormInterface $form + FormInterface $form, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $requestConfiguration->getFormType()->willReturn('sylius_product_pricing'); @@ -51,7 +51,7 @@ function it_creates_form_without_root_name_and_disables_csrf_protection_for_non_ RequestConfiguration $requestConfiguration, ResourceInterface $resource, FormFactoryInterface $formFactory, - FormInterface $form + FormInterface $form, ): void { $requestConfiguration->isHtmlRequest()->willReturn(false); $requestConfiguration->getFormType()->willReturn('sylius_product_api'); diff --git a/src/Bundle/spec/Controller/ResourceUpdateHandlerSpec.php b/src/Bundle/spec/Controller/ResourceUpdateHandlerSpec.php index 03d50b865..129b7d10b 100644 --- a/src/Bundle/spec/Controller/ResourceUpdateHandlerSpec.php +++ b/src/Bundle/spec/Controller/ResourceUpdateHandlerSpec.php @@ -36,7 +36,7 @@ function it_applies_a_state_machine_transition( StateMachineInterface $stateMachine, ResourceInterface $resource, RequestConfiguration $configuration, - ObjectManager $manager + ObjectManager $manager, ): void { $configuration->hasStateMachine()->willReturn(true); $stateMachine->apply($configuration, $resource)->shouldBeCalled(); @@ -50,7 +50,7 @@ function it_does_not_apply_a_state_machine_transition( StateMachineInterface $stateMachine, ResourceInterface $resource, RequestConfiguration $configuration, - ObjectManager $manager + ObjectManager $manager, ): void { $configuration->hasStateMachine()->willReturn(false); $stateMachine->apply($configuration, $resource)->shouldNotBeCalled(); diff --git a/src/Bundle/spec/Controller/ResourcesCollectionProviderSpec.php b/src/Bundle/spec/Controller/ResourcesCollectionProviderSpec.php index e4baf04a0..861aaa335 100644 --- a/src/Bundle/spec/Controller/ResourcesCollectionProviderSpec.php +++ b/src/Bundle/spec/Controller/ResourcesCollectionProviderSpec.php @@ -46,7 +46,7 @@ function it_returns_resources_resolved_from_repository( RequestConfiguration $requestConfiguration, RepositoryInterface $repository, ResourceInterface $firstResource, - ResourceInterface $secondResource + ResourceInterface $secondResource, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); @@ -61,7 +61,7 @@ function it_handles_Pagerfanta( RepositoryInterface $repository, Pagerfanta $paginator, Request $request, - ParameterBag $queryParameters + ParameterBag $queryParameters, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $requestConfiguration->getPaginationMaxPerPage()->willReturn(5); @@ -89,7 +89,7 @@ function it_restricts_max_pagination_limit_based_on_grid_configuration( Grid $grid, Pagerfanta $paginator, Request $request, - ParameterBag $queryParameters + ParameterBag $queryParameters, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $requestConfiguration->getPaginationMaxPerPage()->willReturn(1000); @@ -123,7 +123,7 @@ function it_creates_a_paginated_representation_for_pagerfanta_for_non_html_reque ParameterBag $queryParameters, ParameterBag $requestAttributes, PagerfantaFactory $pagerfantaRepresentationFactory, - PaginatedRepresentation $paginatedRepresentation + PaginatedRepresentation $paginatedRepresentation, ): void { $requestConfiguration->isHtmlRequest()->willReturn(false); $requestConfiguration->getPaginationMaxPerPage()->willReturn(8); @@ -158,7 +158,7 @@ function it_handles_resource_grid_view( Grid $grid, Pagerfanta $paginator, Request $request, - ParameterBag $queryParameters + ParameterBag $queryParameters, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $requestConfiguration->getPaginationMaxPerPage()->willReturn(5); diff --git a/src/Bundle/spec/Controller/ResourcesResolverSpec.php b/src/Bundle/spec/Controller/ResourcesResolverSpec.php index 1f396e8fb..6f8e4aaf1 100644 --- a/src/Bundle/spec/Controller/ResourcesResolverSpec.php +++ b/src/Bundle/spec/Controller/ResourcesResolverSpec.php @@ -31,7 +31,7 @@ function it_gets_all_resources_if_has_no_criteria( RequestConfiguration $requestConfiguration, RepositoryInterface $repository, ResourceInterface $firstResource, - ResourceInterface $secondResource + ResourceInterface $secondResource, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $requestConfiguration->getRepositoryMethod(null)->willReturn(null); @@ -51,7 +51,7 @@ function it_finds_resources_by_criteria_if_not_paginated( RepositoryInterface $repository, ResourceInterface $firstResource, ResourceInterface $secondResource, - ResourceInterface $thirdResource + ResourceInterface $thirdResource, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $requestConfiguration->getRepositoryMethod(null)->willReturn(null); @@ -73,7 +73,7 @@ function it_finds_resources_by_criteria_if_not_paginated( function it_uses_custom_method_and_arguments_if_specified( RequestConfiguration $requestConfiguration, RepositoryInterface $repository, - ResourceInterface $firstResource + ResourceInterface $firstResource, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $requestConfiguration->getRepositoryMethod()->willReturn('findAll'); @@ -92,7 +92,7 @@ function it_uses_custom_repository_if_specified( RequestConfiguration $requestConfiguration, RepositoryInterface $repository, RepositoryInterface $customRepository, - ResourceInterface $firstResource + ResourceInterface $firstResource, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $requestConfiguration->getRepositoryMethod()->willReturn([$customRepository, 'findBy']); @@ -110,7 +110,7 @@ function it_uses_custom_repository_if_specified( function it_creates_paginator_by_default( RequestConfiguration $requestConfiguration, RepositoryInterface $repository, - Pagerfanta $paginator + Pagerfanta $paginator, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $requestConfiguration->getRepositoryMethod()->willReturn(null); diff --git a/src/Bundle/spec/Controller/SingleResourceProviderSpec.php b/src/Bundle/spec/Controller/SingleResourceProviderSpec.php index 9e75ba87c..e006dd52c 100644 --- a/src/Bundle/spec/Controller/SingleResourceProviderSpec.php +++ b/src/Bundle/spec/Controller/SingleResourceProviderSpec.php @@ -32,7 +32,7 @@ function it_looks_for_specific_resource_with_id_by_default( RequestConfiguration $requestConfiguration, Request $request, ParameterBag $requestAttributes, - RepositoryInterface $repository + RepositoryInterface $repository, ): void { $requestConfiguration->getCriteria()->willReturn([]); $requestConfiguration->getRepositoryMethod()->willReturn(null); @@ -52,7 +52,7 @@ function it_can_find_specific_resource_with_id_by_default( Request $request, ParameterBag $requestAttributes, RepositoryInterface $repository, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getCriteria()->willReturn([]); $requestConfiguration->getRepositoryMethod()->willReturn(null); @@ -72,7 +72,7 @@ function it_can_find_specific_resource_with_slug_by_default( Request $request, ParameterBag $requestAttributes, RepositoryInterface $repository, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getCriteria()->willReturn([]); $requestConfiguration->getRepositoryMethod()->willReturn(null); @@ -92,7 +92,7 @@ function it_can_find_specific_resource_with_custom_criteria( Request $request, ParameterBag $requestAttributes, RepositoryInterface $repository, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getCriteria()->willReturn(['request-configuration-criteria' => '1']); $requestConfiguration->getRepositoryMethod()->willReturn(null); @@ -111,7 +111,7 @@ function it_can_find_specific_resource_with_merged_custom_criteria( Request $request, ParameterBag $requestAttributes, RepositoryInterface $repository, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getCriteria()->willReturn(['request-configuration-criteria' => '1']); $requestConfiguration->getRepositoryMethod()->willReturn(null); @@ -131,7 +131,7 @@ function it_can_find_specific_resource_with_merged_custom_criteria_overwriting_t Request $request, ParameterBag $requestAttributes, RepositoryInterface $repository, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getCriteria()->willReturn(['id' => 5]); $requestConfiguration->getRepositoryMethod()->willReturn(null); @@ -148,7 +148,7 @@ function it_can_find_specific_resource_with_merged_custom_criteria_overwriting_t function it_uses_a_custom_method_if_configured( RequestConfiguration $requestConfiguration, RepositoryInterface $repository, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getRepositoryMethod()->willReturn('findAll'); $requestConfiguration->getRepositoryArguments()->willReturn(['foo']); @@ -162,7 +162,7 @@ function it_uses_a_custom_repository_if_configured( RequestConfiguration $requestConfiguration, RepositoryInterface $repository, RepositoryInterface $customRepository, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->getRepositoryMethod()->willReturn([$customRepository, 'findAll']); $requestConfiguration->getRepositoryArguments()->willReturn(['foo']); diff --git a/src/Bundle/spec/Controller/StateMachineSpec.php b/src/Bundle/spec/Controller/StateMachineSpec.php index 115b57dbe..00c186328 100644 --- a/src/Bundle/spec/Controller/StateMachineSpec.php +++ b/src/Bundle/spec/Controller/StateMachineSpec.php @@ -56,7 +56,7 @@ function it_returns_if_configured_state_machine_can_transition( RequestConfiguration $requestConfiguration, ResourceInterface $resource, FactoryInterface $stateMachineFactory, - StateMachineInterface $stateMachine + StateMachineInterface $stateMachine, ): void { $requestConfiguration->hasStateMachine()->willReturn(true); $requestConfiguration->getStateMachineGraph()->willReturn('sylius_product_review_state'); @@ -72,7 +72,7 @@ function it_applies_configured_state_machine_transition_without_graph_configurat RequestConfiguration $requestConfiguration, ResourceInterface $resource, FactoryInterface $stateMachineFactory, - StateMachineInterface $stateMachine + StateMachineInterface $stateMachine, ): void { $requestConfiguration->hasStateMachine()->willReturn(true); $requestConfiguration->getStateMachineGraph()->willReturn(null); @@ -89,7 +89,7 @@ function it_applies_configured_state_machine_transition_with_graph_configuration RequestConfiguration $requestConfiguration, ResourceInterface $resource, FactoryInterface $stateMachineFactory, - StateMachineInterface $stateMachine + StateMachineInterface $stateMachine, ): void { $requestConfiguration->hasStateMachine()->willReturn(true); $requestConfiguration->getStateMachineGraph()->willReturn('sylius_product_review_state'); diff --git a/src/Bundle/spec/Controller/ViewHandlerSpec.php b/src/Bundle/spec/Controller/ViewHandlerSpec.php index 2f4035e67..a1474ae81 100644 --- a/src/Bundle/spec/Controller/ViewHandlerSpec.php +++ b/src/Bundle/spec/Controller/ViewHandlerSpec.php @@ -36,7 +36,7 @@ function it_implements_view_handler_interface(): void function it_handles_view_normally_for_html_requests( RequestConfiguration $requestConfiguration, ConfigurableViewHandlerInterface $restViewHandler, - Response $response + Response $response, ): void { $requestConfiguration->isHtmlRequest()->willReturn(true); $view = View::create(); @@ -49,7 +49,7 @@ function it_handles_view_normally_for_html_requests( function it_sets_proper_values_for_non_html_requests( RequestConfiguration $requestConfiguration, ConfigurableViewHandlerInterface $restViewHandler, - Response $response + Response $response, ): void { $requestConfiguration->isHtmlRequest()->willReturn(false); $view = View::create(); diff --git a/src/Bundle/spec/Controller/WorkflowSpec.php b/src/Bundle/spec/Controller/WorkflowSpec.php index 91d8007d6..65f0ba611 100644 --- a/src/Bundle/spec/Controller/WorkflowSpec.php +++ b/src/Bundle/spec/Controller/WorkflowSpec.php @@ -63,7 +63,7 @@ function it_returns_if_configured_state_machine_can_transition( RequestConfiguration $requestConfiguration, Registry $registry, ResourceInterface $resource, - SymfonyWorkflow $workflow + SymfonyWorkflow $workflow, ): void { $requestConfiguration->getStateMachineGraph()->willReturn(null); $requestConfiguration->hasStateMachine()->willReturn(true); @@ -79,7 +79,7 @@ function it_applies_configured_state_machine_transition_without_graph_configurat Registry $registry, ResourceInterface $resource, SymfonyWorkflow $workflow, - Marking $marking + Marking $marking, ): void { $requestConfiguration->getStateMachineGraph()->willReturn(null); $requestConfiguration->hasStateMachine()->willReturn(true); @@ -97,7 +97,7 @@ function it_applies_configured_state_machine_transition_with_graph_configuration Registry $registry, ResourceInterface $resource, SymfonyWorkflow $workflow, - Marking $marking + Marking $marking, ): void { $requestConfiguration->getStateMachineGraph()->willReturn('pull_request'); $requestConfiguration->hasStateMachine()->willReturn(true); diff --git a/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/DefaultParentListenerSpec.php b/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/DefaultParentListenerSpec.php index d4604e87c..ef97c0592 100644 --- a/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/DefaultParentListenerSpec.php +++ b/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/DefaultParentListenerSpec.php @@ -34,58 +34,58 @@ function let(DocumentManagerInterface $documentManager): void function it_should_throw_an_exception_if_no_parent_mapping_exists( ResourceControllerEvent $event, ClassMetadata $documentMetadata, - DocumentManagerInterface $documentManager + DocumentManagerInterface $documentManager, ): void { $event->getSubject()->willReturn(new \stdClass()); $documentManager->getClassMetadata(\stdClass::class)->willReturn( - $documentMetadata + $documentMetadata, ); $documentMetadata->parentMapping = null; $this->shouldThrow(new \RuntimeException( - 'A default parent path has been specified, but no parent mapping has been applied to document "stdClass"' + 'A default parent path has been specified, but no parent mapping has been applied to document "stdClass"', ))->during( 'onPreCreate', - [$event] + [$event], ); } function it_should_throw_an_exception_if_the_parent_does_not_exist_and_autocreate_is_false( ResourceControllerEvent $event, ClassMetadata $documentMetadata, - DocumentManagerInterface $documentManager + DocumentManagerInterface $documentManager, ): void { $this->beConstructedWith( $documentManager, '/path/to', - false + false, ); $event->getSubject()->willReturn(new \stdClass()); $documentManager->getClassMetadata(\stdClass::class)->willReturn( - $documentMetadata + $documentMetadata, ); $documentMetadata->parentMapping = 'parent'; $documentManager->find(null, '/path/to')->willReturn(null); $this->shouldThrow(new \RuntimeException( - 'Document at default parent path "/path/to" does not exist. `autocreate` was set to "false"' + 'Document at default parent path "/path/to" does not exist. `autocreate` was set to "false"', ))->during( 'onPreCreate', - [$event] + [$event], ); } function it_should_set_the_parent_document( ResourceControllerEvent $event, ClassMetadata $documentMetadata, - DocumentManagerInterface $documentManager + DocumentManagerInterface $documentManager, ): void { $subjectDocument = new \stdClass(); $parentDocument = new \stdClass(); $event->getSubject()->willReturn($subjectDocument); $documentManager->getClassMetadata(\stdClass::class)->willReturn( - $documentMetadata + $documentMetadata, ); $documentMetadata->parentMapping = 'parent'; $documentMetadata->getFieldValue($subjectDocument, 'parent')->willReturn(null); @@ -100,12 +100,12 @@ function it_should_autocreate_and_set_the_parent_document( ClassMetadata $documentMetadata, DocumentManagerInterface $documentManager, SessionInterface $session, - NodeInterface $node + NodeInterface $node, ): void { $this->beConstructedWith( $documentManager, '/path/to', - true + true, ); $subjectDocument = new \stdClass(); @@ -113,7 +113,7 @@ function it_should_autocreate_and_set_the_parent_document( $event->getSubject()->willReturn($subjectDocument); $documentManager->getClassMetadata(\stdClass::class)->willReturn( - $documentMetadata + $documentMetadata, ); $documentMetadata->parentMapping = 'parent'; $documentManager->find(null, '/path/to')->willReturn(null, $parentDocument); @@ -125,7 +125,8 @@ function it_should_autocreate_and_set_the_parent_document( $node->hasNode(Argument::cetera())->willReturn(true); $node->getNode(Argument::cetera()) ->willReturn($node) - ->shouldBeCalledTimes(2); + ->shouldBeCalledTimes(2) + ; $documentMetadata->setFieldValue($subjectDocument, 'parent', $parentDocument); $this->onPreCreate($event); @@ -134,13 +135,13 @@ function it_should_autocreate_and_set_the_parent_document( function it_should_set_the_parent_document_if_force_is_true_and_the_parent_is_already_set( ResourceControllerEvent $event, ClassMetadata $documentMetadata, - DocumentManagerInterface $documentManager + DocumentManagerInterface $documentManager, ): void { $this->beConstructedWith( $documentManager, '/path/to', false, - true + true, ); $subjectDocument = new \stdClass(); @@ -149,7 +150,7 @@ function it_should_set_the_parent_document_if_force_is_true_and_the_parent_is_al $event->getSubject()->willReturn($subjectDocument); $documentManager->getClassMetadata(\stdClass::class)->willReturn( - $documentMetadata + $documentMetadata, ); $documentMetadata->getFieldValue($subjectDocument, 'parent')->shouldNotBeCalled(); @@ -163,18 +164,19 @@ function it_should_set_the_parent_document_if_force_is_true_and_the_parent_is_al function it_should_return_early_if_force_is_false_and_subject_already_has_a_parent( ResourceControllerEvent $event, ClassMetadata $documentMetadata, - DocumentManagerInterface $documentManager + DocumentManagerInterface $documentManager, ): void { $subjectDocument = new \stdClass(); $event->getSubject()->willReturn($subjectDocument); $documentManager->getClassMetadata(\stdClass::class)->willReturn( - $documentMetadata + $documentMetadata, ); $documentMetadata->parentMapping = 'parent'; $documentMetadata->getFieldValue($subjectDocument, 'parent') - ->willReturn(new \stdClass()); + ->willReturn(new \stdClass()) + ; $documentManager->find(null, '/path/to')->shouldNotBeCalled(); diff --git a/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/NameFilterListenerSpec.php b/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/NameFilterListenerSpec.php index d502b80d3..d9eeb939a 100644 --- a/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/NameFilterListenerSpec.php +++ b/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/NameFilterListenerSpec.php @@ -31,7 +31,7 @@ function let(DocumentManagerInterface $documentManager): void function it_throws_an_exception_if_nodename_is_not_mapped( ResourceControllerEvent $event, DocumentManagerInterface $documentManager, - ClassMetadata $metadata + ClassMetadata $metadata, ): void { $document = new \stdClass(); $event->getSubject()->willReturn($document); @@ -44,7 +44,7 @@ function it_throws_an_exception_if_nodename_is_not_mapped( function it_should_clean_the_name( ResourceControllerEvent $event, DocumentManagerInterface $documentManager, - ClassMetadata $metadata + ClassMetadata $metadata, ): void { $document = new \stdClass(); $event->getSubject()->willReturn($document); @@ -59,7 +59,7 @@ function it_should_clean_the_name( function it_should_use_the_given_replacement_char( ResourceControllerEvent $event, DocumentManagerInterface $documentManager, - ClassMetadata $metadata + ClassMetadata $metadata, ): void { $this->beConstructedWith($documentManager, '_'); diff --git a/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/NameResolverListenerSpec.php b/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/NameResolverListenerSpec.php index 5f152c21a..e093668a6 100644 --- a/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/NameResolverListenerSpec.php +++ b/src/Bundle/spec/Doctrine/ODM/PHPCR/EventListener/NameResolverListenerSpec.php @@ -32,7 +32,7 @@ function let(DocumentManagerInterface $documentManager): void function it_throws_an_exception_when_the_generator_type_is_not_parent( DocumentManagerInterface $documentManager, ResourceControllerEvent $event, - ClassMetadata $metadata + ClassMetadata $metadata, ): void { $document = new \stdClass(); $event->getSubject()->willReturn($document); @@ -41,7 +41,7 @@ function it_throws_an_exception_when_the_generator_type_is_not_parent( $this->shouldThrow(new \RuntimeException('Document of class "stdClass" must be using the GENERATOR_TYPE_PARENT identificatio strategy (value 3), it is current using "foo" (this may be an automatic configuration: be sure to map both the `nodename` and the `parentDocument`).'))->during( 'onEvent', - [$event] + [$event], ); } @@ -49,7 +49,7 @@ function it_should_retain_the_original_name_when_no_conflict_exists( DocumentManagerInterface $documentManager, ResourceControllerEvent $event, ClassMetadata $metadata, - NodeInterface $node + NodeInterface $node, ): void { $document = new \stdClass(); $parentDocument = new \stdClass(); @@ -60,7 +60,8 @@ function it_should_retain_the_original_name_when_no_conflict_exists( $metadata->parentMapping = 'parent'; $metadata->getFieldValue($document, 'parent')->willReturn($parentDocument); $documentManager->getNodeForDocument($parentDocument) - ->willReturn($node); + ->willReturn($node) + ; $node->getPath()->willReturn('/path/to'); $metadata->getFieldValue($document, 'title')->willReturn('Hello World'); @@ -74,7 +75,7 @@ function it_should_auto_increment_the_name_if_a_conflict_exists( DocumentManagerInterface $documentManager, ResourceControllerEvent $event, ClassMetadata $metadata, - NodeInterface $node + NodeInterface $node, ): void { $document = new \stdClass(); $parentDocument = new \stdClass(); @@ -87,21 +88,22 @@ function it_should_auto_increment_the_name_if_a_conflict_exists( $metadata->parentMapping = 'parent'; $metadata->getFieldValue($document, 'parent')->willReturn($parentDocument); $documentManager->getNodeForDocument($parentDocument) - ->willReturn($node); + ->willReturn($node) + ; $node->getPath()->willReturn('/path/to'); $metadata->getFieldValue($document, 'title')->willReturn('Hello World'); $documentManager->find(null, '/path/to/Hello World')->willReturn( - $existingDocument + $existingDocument, ); $documentManager->find(null, '/path/to/Hello World-1')->willReturn( - $existingDocument + $existingDocument, ); $documentManager->find(null, '/path/to/Hello World-2')->willReturn( - $existingDocument + $existingDocument, ); $documentManager->find(null, '/path/to/Hello World-3')->willReturn( - null + null, ); $metadata->setFieldValue($document, 'title', 'Hello World-3')->shouldBeCalled(); diff --git a/src/Bundle/spec/Doctrine/ORM/Form/Builder/DefaultFormBuilderSpec.php b/src/Bundle/spec/Doctrine/ORM/Form/Builder/DefaultFormBuilderSpec.php index fcbf7beca..ad6776ea5 100644 --- a/src/Bundle/spec/Doctrine/ORM/Form/Builder/DefaultFormBuilderSpec.php +++ b/src/Bundle/spec/Doctrine/ORM/Form/Builder/DefaultFormBuilderSpec.php @@ -38,7 +38,7 @@ function it_does_not_support_entities_with_multiple_primary_keys( MetadataInterface $metadata, FormBuilderInterface $formBuilder, EntityManagerInterface $entityManager, - ClassMetadataInfo $classMetadataInfo + ClassMetadataInfo $classMetadataInfo, ): void { $metadata->getClass('model')->willReturn('AppBundle\Entity\Book'); $entityManager->getClassMetadata('AppBundle\Entity\Book')->willReturn($classMetadataInfo); @@ -54,7 +54,7 @@ function it_excludes_non_natural_identifier_from_the_field_list( MetadataInterface $metadata, FormBuilderInterface $formBuilder, EntityManagerInterface $entityManager, - ClassMetadataInfo $classMetadataInfo + ClassMetadataInfo $classMetadataInfo, ): void { $metadata->getClass('model')->willReturn('AppBundle\Entity\Book'); $entityManager->getClassMetadata('AppBundle\Entity\Book')->willReturn($classMetadataInfo); @@ -79,7 +79,7 @@ function it_does_not_exclude_natural_identifier_from_the_field_list( MetadataInterface $metadata, FormBuilderInterface $formBuilder, EntityManagerInterface $entityManager, - ClassMetadataInfo $classMetadataInfo + ClassMetadataInfo $classMetadataInfo, ): void { $metadata->getClass('model')->willReturn('AppBundle\Entity\Book'); $entityManager->getClassMetadata('AppBundle\Entity\Book')->willReturn($classMetadataInfo); @@ -105,7 +105,7 @@ function it_uses_metadata_to_create_appropriate_fields( MetadataInterface $metadata, FormBuilderInterface $formBuilder, EntityManagerInterface $entityManager, - ClassMetadataInfo $classMetadataInfo + ClassMetadataInfo $classMetadataInfo, ): void { $metadata->getClass('model')->willReturn('AppBundle\Entity\Book'); $entityManager->getClassMetadata('AppBundle\Entity\Book')->willReturn($classMetadataInfo); @@ -128,7 +128,7 @@ function it_uses_single_text_widget_for_datetime_field( MetadataInterface $metadata, FormBuilderInterface $formBuilder, EntityManagerInterface $entityManager, - ClassMetadataInfo $classMetadataInfo + ClassMetadataInfo $classMetadataInfo, ): void { $metadata->getClass('model')->willReturn('AppBundle\Entity\Book'); $entityManager->getClassMetadata('AppBundle\Entity\Book')->willReturn($classMetadataInfo); @@ -153,7 +153,7 @@ function it_also_creates_fields_for_relations_other_than_one_to_many( MetadataInterface $metadata, FormBuilderInterface $formBuilder, EntityManagerInterface $entityManager, - ClassMetadataInfo $classMetadataInfo + ClassMetadataInfo $classMetadataInfo, ): void { $metadata->getClass('model')->willReturn('AppBundle\Entity\Book'); $entityManager->getClassMetadata('AppBundle\Entity\Book')->willReturn($classMetadataInfo); @@ -183,7 +183,7 @@ function it_excludes_common_fields_like_createdAt_and_updatedAt( MetadataInterface $metadata, FormBuilderInterface $formBuilder, EntityManagerInterface $entityManager, - ClassMetadataInfo $classMetadataInfo + ClassMetadataInfo $classMetadataInfo, ): void { $metadata->getClass('model')->willReturn('AppBundle\Entity\Book'); $entityManager->getClassMetadata('AppBundle\Entity\Book')->willReturn($classMetadataInfo); diff --git a/src/Bundle/spec/Form/DataTransformer/RecursiveTransformerSpec.php b/src/Bundle/spec/Form/DataTransformer/RecursiveTransformerSpec.php index 77c0f1227..001b65682 100644 --- a/src/Bundle/spec/Form/DataTransformer/RecursiveTransformerSpec.php +++ b/src/Bundle/spec/Form/DataTransformer/RecursiveTransformerSpec.php @@ -32,14 +32,14 @@ function it_is_data_transformer(): void } function it_returns_an_empty_array_collection_when_transforming_a_null( - DataTransformerInterface $decoratedTransformer + DataTransformerInterface $decoratedTransformer, ): void { $this->transform(null)->shouldBeLike(new ArrayCollection()); $decoratedTransformer->transform(Argument::any())->shouldNotBeCalled(); } function it_returns_an_empty_array_collection_when_reverse_transforming_a_null( - DataTransformerInterface $decoratedTransformer + DataTransformerInterface $decoratedTransformer, ): void { $this->reverseTransform(null)->shouldBeLike(new ArrayCollection()); $decoratedTransformer->reverseTransform(Argument::any())->shouldNotBeCalled(); diff --git a/src/Bundle/spec/Form/EventSubscriber/AddCodeFormSubscriberSpec.php b/src/Bundle/spec/Form/EventSubscriber/AddCodeFormSubscriberSpec.php index c70fc4442..ee4a6731a 100644 --- a/src/Bundle/spec/Form/EventSubscriber/AddCodeFormSubscriberSpec.php +++ b/src/Bundle/spec/Form/EventSubscriber/AddCodeFormSubscriberSpec.php @@ -54,7 +54,7 @@ function it_sets_code_as_enabled_when_resource_is_new(FormEvent $event, FormInte function it_sets_code_as_disabled_when_resource_is_not_new( FormEvent $event, FormInterface $form, - CodeAwareInterface $resource + CodeAwareInterface $resource, ): void { $event->getData()->willReturn($resource); $event->getForm()->willReturn($form); @@ -77,7 +77,7 @@ function it_throws_exception_when_resource_does_not_implement_code_aware_interfa function it_sets_code_as_enabled_when_there_is_no_resource( FormEvent $event, - FormInterface $form + FormInterface $form, ): void { $event->getData()->willReturn(null); $event->getForm()->willReturn($form); @@ -125,7 +125,7 @@ function it_adds_code_with_type_text_by_default(FormEvent $event, FormInterface function it_adds_code_with_label_sylius_ui_code_by_default( FormEvent $event, FormInterface $form, - CodeAwareInterface $resource + CodeAwareInterface $resource, ): void { $event->getData()->willReturn($resource); $event->getForm()->willReturn($form); @@ -143,7 +143,7 @@ function it_adds_code_with_label_sylius_ui_code_by_default( function it_adds_code_with_specified_type_and_label( FormEvent $event, FormInterface $form, - CodeAwareInterface $resource + CodeAwareInterface $resource, ): void { $this->beConstructedWith(FormType::class, ['label' => 'sylius.ui.name']); diff --git a/src/Bundle/spec/Grid/Controller/ResourcesResolverSpec.php b/src/Bundle/spec/Grid/Controller/ResourcesResolverSpec.php index 895a74251..25d44747d 100644 --- a/src/Bundle/spec/Grid/Controller/ResourcesResolverSpec.php +++ b/src/Bundle/spec/Grid/Controller/ResourcesResolverSpec.php @@ -34,7 +34,7 @@ final class ResourcesResolverSpec extends ObjectBehavior function let( ResourcesResolverInterface $decoratedResolver, GridProviderInterface $gridProvider, - ResourceGridViewFactoryInterface $gridViewFactory + ResourceGridViewFactoryInterface $gridViewFactory, ): void { $this->beConstructedWith($decoratedResolver, $gridProvider, $gridViewFactory); } @@ -48,7 +48,7 @@ function it_uses_decorated_resolver_when_not_using_a_grid( ResourcesResolverInterface $decoratedResolver, RequestConfiguration $requestConfiguration, RepositoryInterface $repository, - ResourceInterface $resource + ResourceInterface $resource, ): void { $requestConfiguration->hasGrid()->willReturn(false); @@ -66,7 +66,7 @@ function it_returns_grid_view( ResourceGridView $gridView, MetadataInterface $metadata, Request $request, - ParameterBag $queryParameters + ParameterBag $queryParameters, ): void { $requestConfiguration->hasGrid()->willReturn(true); $requestConfiguration->getGrid()->willReturn('sylius_admin_tax_category'); @@ -93,7 +93,7 @@ function it_returns_grid_data_for_non_html_requests( Pagerfanta $paginator, MetadataInterface $metadata, Request $request, - ParameterBag $queryParameters + ParameterBag $queryParameters, ): void { $requestConfiguration->hasGrid()->willReturn(true); $requestConfiguration->getGrid()->willReturn('sylius_admin_tax_category'); diff --git a/src/Bundle/spec/Grid/Parser/OptionsParserSpec.php b/src/Bundle/spec/Grid/Parser/OptionsParserSpec.php index c2b9ef6d8..433c29d3d 100644 --- a/src/Bundle/spec/Grid/Parser/OptionsParserSpec.php +++ b/src/Bundle/spec/Grid/Parser/OptionsParserSpec.php @@ -26,7 +26,7 @@ final class OptionsParserSpec extends ObjectBehavior function let( ContainerInterface $container, ExpressionLanguage $expression, - PropertyAccessorInterface $propertyAccessor + PropertyAccessorInterface $propertyAccessor, ): void { $this->beConstructedWith($container, $expression, $propertyAccessor); } @@ -49,7 +49,7 @@ function it_parses_options(Request $request): void function it_parses_options_with_expression( ContainerInterface $container, ExpressionLanguage $expression, - Request $request + Request $request, ): void { $expression->evaluate('service("demo_service")', ['container' => $container])->willReturn('demo_object'); @@ -63,7 +63,7 @@ function it_parses_options_with_expression( ], ], ], - $request + $request, ) ->shouldReturn( [ @@ -73,14 +73,15 @@ function it_parses_options_with_expression( 'demo_object', ], ], - ] - ); + ], + ) + ; } function it_parses_options_with_parameter_from_resource( PropertyAccessorInterface $propertyAccessor, Request $request, - ResourceInterface $data + ResourceInterface $data, ): void { $propertyAccessor->getValue($data, 'id')->willReturn(21); @@ -93,7 +94,7 @@ function it_parses_options_with_parameter_from_resource( function it_parses_options_with_array( PropertyAccessorInterface $propertyAccessor, Request $request, - ResourceInterface $data + ResourceInterface $data, ): void { $arrayData = [ 0 => $data, diff --git a/src/Bundle/spec/Grid/Renderer/TwigBulkActionGridRendererSpec.php b/src/Bundle/spec/Grid/Renderer/TwigBulkActionGridRendererSpec.php index 2bde70192..0b4292913 100644 --- a/src/Bundle/spec/Grid/Renderer/TwigBulkActionGridRendererSpec.php +++ b/src/Bundle/spec/Grid/Renderer/TwigBulkActionGridRendererSpec.php @@ -29,7 +29,7 @@ function let(Environment $twig, OptionsParserInterface $optionsParser): void $this->beConstructedWith( $twig, $optionsParser, - ['delete' => '@SyliusGrid/BulkAction/_delete.html.twig'] + ['delete' => '@SyliusGrid/BulkAction/_delete.html.twig'], ); } @@ -44,7 +44,7 @@ function it_uses_twig_to_render_the_bulk_action( ResourceGridView $gridView, Action $bulkAction, RequestConfiguration $requestConfiguration, - Request $request + Request $request, ): void { $bulkAction->getType()->willReturn('delete'); $bulkAction->getOptions()->willReturn([]); @@ -69,7 +69,7 @@ function it_uses_twig_to_render_the_bulk_action( function it_throws_an_exception_if_template_is_not_configured_for_given_bulk_action_type( ResourceGridView $gridView, - Action $bulkAction + Action $bulkAction, ): void { $bulkAction->getType()->willReturn('foo'); diff --git a/src/Bundle/spec/Grid/Renderer/TwigGridRendererSpec.php b/src/Bundle/spec/Grid/Renderer/TwigGridRendererSpec.php index 786b7118f..8bfc3656f 100644 --- a/src/Bundle/spec/Grid/Renderer/TwigGridRendererSpec.php +++ b/src/Bundle/spec/Grid/Renderer/TwigGridRendererSpec.php @@ -27,7 +27,7 @@ final class TwigGridRendererSpec extends ObjectBehavior function let( GridRendererInterface $gridRenderer, Environment $twig, - OptionsParserInterface $optionsParser + OptionsParserInterface $optionsParser, ): void { $actionTemplates = [ 'link' => '@SyliusGrid/Action/_link.html.twig', @@ -38,7 +38,7 @@ function let( $gridRenderer, $twig, $optionsParser, - $actionTemplates + $actionTemplates, ); } @@ -53,7 +53,7 @@ function it_uses_twig_to_render_the_action( ResourceGridView $gridView, Action $action, RequestConfiguration $requestConfiguration, - Request $request + Request $request, ): void { $action->getType()->willReturn('link'); $action->getOptions()->willReturn([]); @@ -78,7 +78,7 @@ function it_uses_twig_to_render_the_action( function it_throws_an_exception_if_template_is_not_configured_for_given_action_type( ResourceGridView $gridView, - Action $action + Action $action, ): void { $action->getType()->willReturn('foo'); diff --git a/src/Bundle/spec/Grid/View/ResourceGridViewFactorySpec.php b/src/Bundle/spec/Grid/View/ResourceGridViewFactorySpec.php index e7852b7e7..6557db647 100644 --- a/src/Bundle/spec/Grid/View/ResourceGridViewFactorySpec.php +++ b/src/Bundle/spec/Grid/View/ResourceGridViewFactorySpec.php @@ -42,7 +42,7 @@ function it_uses_data_provider_to_create_a_view_with_data_and_definition( Grid $grid, MetadataInterface $resourceMetadata, Request $request, - RequestConfiguration $requestConfiguration + RequestConfiguration $requestConfiguration, ): void { $parameters = new Parameters(); @@ -51,7 +51,7 @@ function it_uses_data_provider_to_create_a_view_with_data_and_definition( $grid->getWrappedObject(), $parameters, $resourceMetadata->getWrappedObject(), - $requestConfiguration->getWrappedObject() + $requestConfiguration->getWrappedObject(), ); $requestConfiguration->getRequest()->willReturn($request); diff --git a/src/Bundle/spec/Grid/View/ResourceGridViewSpec.php b/src/Bundle/spec/Grid/View/ResourceGridViewSpec.php index 3b56ff55e..176aceff7 100644 --- a/src/Bundle/spec/Grid/View/ResourceGridViewSpec.php +++ b/src/Bundle/spec/Grid/View/ResourceGridViewSpec.php @@ -25,7 +25,7 @@ final class ResourceGridViewSpec extends ObjectBehavior function let( Grid $gridDefinition, MetadataInterface $resourceMetadata, - RequestConfiguration $requestConfiguration + RequestConfiguration $requestConfiguration, ): void { $this->beConstructedWith(['foo', 'bar'], $gridDefinition, new Parameters(), $resourceMetadata, $requestConfiguration); } diff --git a/src/Bundle/spec/Routing/CrudRoutesAttributesLoaderSpec.php b/src/Bundle/spec/Routing/CrudRoutesAttributesLoaderSpec.php index 471e3290e..7cb94ca4c 100644 --- a/src/Bundle/spec/Routing/CrudRoutesAttributesLoaderSpec.php +++ b/src/Bundle/spec/Routing/CrudRoutesAttributesLoaderSpec.php @@ -31,7 +31,7 @@ function let(RegistryInterface $resourceRegistry, RouteFactoryInterface $routeFa { $this->beConstructedWith( ['paths' => [__DIR__ . '/../../test/src']], - new ResourceLoader($resourceRegistry->getWrappedObject(), $routeFactory->getWrappedObject()) + new ResourceLoader($resourceRegistry->getWrappedObject(), $routeFactory->getWrappedObject()), ); } @@ -50,7 +50,7 @@ function it_generates_routes_from_resource( MetadataInterface $metadata, RouteFactoryInterface $routeFactory, Route $route, - RouteCollection $routeCollection + RouteCollection $routeCollection, ): void { $resourceRegistry->get(Argument::cetera())->willReturn($metadata); $metadata->getPluralName()->willReturn('books'); diff --git a/src/Bundle/spec/Routing/ResourceLoaderSpec.php b/src/Bundle/spec/Routing/ResourceLoaderSpec.php index 98a7a7f44..38c3020ce 100644 --- a/src/Bundle/spec/Routing/ResourceLoaderSpec.php +++ b/src/Bundle/spec/Routing/ResourceLoaderSpec.php @@ -44,7 +44,8 @@ function it_processes_configuration_and_throws_exception_if_invalid(): void $this ->shouldThrow(InvalidConfigurationException::class) - ->during('load', [$configuration, 'sylius.resource']); + ->during('load', [$configuration, 'sylius.resource']) + ; } function it_throws_an_exception_if_invalid_resource_configured(RegistryInterface $resourceRegistry): void @@ -58,7 +59,8 @@ function it_throws_an_exception_if_invalid_resource_configured(RegistryInterface $this ->shouldThrow(\InvalidArgumentException::class) - ->during('load', [$configuration, 'sylius.resource']); + ->during('load', [$configuration, 'sylius.resource']) + ; } function it_generates_routing_based_on_resource_configuration( @@ -71,7 +73,7 @@ function it_generates_routing_based_on_resource_configuration( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -176,7 +178,7 @@ function it_generates_urlized_paths_for_resources_with_multiple_words_in_name( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product_option')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -281,7 +283,7 @@ function it_generates_urlized_paths_for_resources_with_custom_identifier( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product_option')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -414,7 +416,7 @@ function it_generates_routing_with_custom_path_if_specified( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -520,7 +522,7 @@ function it_generates_routing_with_custom_form_if_specified( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -628,7 +630,7 @@ function it_generates_routing_for_a_section( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -740,7 +742,7 @@ function it_generates_routing_with_custom_templates_namespace_in_bundle( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -850,7 +852,7 @@ function it_generates_routing_with_custom_templates_namespace_out_of_bundle( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -957,7 +959,7 @@ function it_excludes_specific_routes_if_configured( RouteCollection $routeCollection, Route $indexRoute, Route $createRoute, - Route $updateRoute + Route $updateRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -1018,7 +1020,7 @@ function it_includes_only_specific_routes_if_configured( RouteFactoryInterface $routeFactory, RouteCollection $routeCollection, Route $indexRoute, - Route $createRoute + Route $createRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -1072,7 +1074,8 @@ function it_throws_an_exception_if_both_excluded_and_includes_routes_configured( $this ->shouldThrow(\InvalidArgumentException::class) - ->during('load', [$configuration, 'sylius.resource']); + ->during('load', [$configuration, 'sylius.resource']) + ; } function it_generates_routing_with_custom_redirect_if_specified( @@ -1085,7 +1088,7 @@ function it_generates_routing_with_custom_redirect_if_specified( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -1192,7 +1195,7 @@ function it_generates_api_routing_based_on_resource_configuration( Route $indexRoute, Route $createRoute, Route $updateRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -1281,7 +1284,7 @@ function it_configures_grid_for_index_action_if_specified( RouteFactoryInterface $routeFactory, RouteCollection $routeCollection, Route $indexRoute, - Route $createRoute + Route $createRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -1336,7 +1339,7 @@ function it_generates_routing_with_custom_variables( Route $createRoute, Route $updateRoute, Route $deleteRoute, - Route $bulkDeleteRoute + Route $bulkDeleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -1468,7 +1471,7 @@ function it_generates_routing_with_custom_permission( Route $createRoute, Route $updateRoute, Route $bulkDeleteRoute, - Route $deleteRoute + Route $deleteRoute, ): void { $resourceRegistry->get('sylius.product')->willReturn($metadata); $metadata->getApplicationName()->willReturn('sylius'); @@ -1556,7 +1559,8 @@ function it_generates_routing_with_custom_permission( ], ]; $routeFactory->createRoute('/products/{id}', $deleteDefaults, [], [], '', [], ['DELETE']) - ->willReturn($deleteRoute); + ->willReturn($deleteRoute) + ; $routeCollection->add('sylius_product_delete', $deleteRoute)->shouldBeCalled(); $this->load($configuration, 'sylius.resource')->shouldReturn($routeCollection); diff --git a/src/Bundle/spec/Validator/DisabledValidatorSpec.php b/src/Bundle/spec/Validator/DisabledValidatorSpec.php index 63e6aece1..1eee959ca 100644 --- a/src/Bundle/spec/Validator/DisabledValidatorSpec.php +++ b/src/Bundle/spec/Validator/DisabledValidatorSpec.php @@ -48,7 +48,7 @@ function it_throws_an_exception_if_subject_does_not_implement_toggleable_interfa function it_adds_violation_if_subject_is_enabled( ExecutionContextInterface $context, - ToggleableInterface $subject + ToggleableInterface $subject, ): void { $subject->isEnabled()->shouldBeCalled()->willReturn(true); @@ -59,7 +59,7 @@ function it_adds_violation_if_subject_is_enabled( function it_does_not_add_violation_if_subject_is_disabled( ExecutionContextInterface $context, - ToggleableInterface $subject + ToggleableInterface $subject, ): void { $subject->isEnabled()->shouldBeCalled()->willReturn(false); diff --git a/src/Bundle/spec/Validator/EnabledValidatorSpec.php b/src/Bundle/spec/Validator/EnabledValidatorSpec.php index bebcb2b30..70ffa26f8 100644 --- a/src/Bundle/spec/Validator/EnabledValidatorSpec.php +++ b/src/Bundle/spec/Validator/EnabledValidatorSpec.php @@ -48,7 +48,7 @@ function it_throws_an_exception_if_subject_does_not_implement_toggleable_interfa function it_adds_violation_if_subject_is_disabled( ExecutionContextInterface $context, - ToggleableInterface $subject + ToggleableInterface $subject, ): void { $subject->isEnabled()->shouldBeCalled()->willReturn(false); @@ -59,7 +59,7 @@ function it_adds_violation_if_subject_is_disabled( function it_does_not_add_violation_if_subject_is_enabled( ExecutionContextInterface $context, - ToggleableInterface $subject + ToggleableInterface $subject, ): void { $subject->isEnabled()->shouldBeCalled()->willReturn(true); diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithAlias.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithAlias.php index 66e21e5f6..ffcfd059d 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithAlias.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithAlias.php @@ -21,7 +21,7 @@ * @Serializer\ExclusionPolicy("all") */ #[SyliusCrudRoutes( - alias: 'app.book' + alias: 'app.book', )] class BookWithAlias extends Book { diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithCriteria.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithCriteria.php index 3d57ee306..f8d734e6d 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithCriteria.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithCriteria.php @@ -23,7 +23,7 @@ #[SyliusCrudRoutes( alias: 'app.book', section: 'criteria', - criteria: ['library' => '$libraryId'] + criteria: ['library' => '$libraryId'], )] class BookWithCriteria extends Book { diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithExcept.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithExcept.php index a7600cb0f..9e800f828 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithExcept.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithExcept.php @@ -23,7 +23,7 @@ #[SyliusCrudRoutes( alias: 'app.book', section: 'except', - except: ['show', 'create'] + except: ['show', 'create'], )] class BookWithExcept extends Book { diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithGrid.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithGrid.php index 3ded51014..9429fa4cf 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithGrid.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithGrid.php @@ -23,7 +23,7 @@ #[SyliusCrudRoutes( alias: 'app.book', section: 'grid', - grid: 'app_book' + grid: 'app_book', )] class BookWithGrid extends Book { diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithOnly.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithOnly.php index 5c6a04cf6..fcfcfd5f7 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithOnly.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithOnly.php @@ -23,7 +23,7 @@ #[SyliusCrudRoutes( alias: 'app.book', section: 'only', - only: ['index', 'update'] + only: ['index', 'update'], )] class BookWithOnly extends Book { diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithPermission.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithPermission.php index 804cc59bb..0ba2ca8bd 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithPermission.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithPermission.php @@ -23,7 +23,7 @@ #[SyliusCrudRoutes( alias: 'app.book', section: 'permission', - permission: true + permission: true, )] class BookWithPermission extends Book { diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithRedirect.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithRedirect.php index 1acf12cf8..868e44f3e 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithRedirect.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithRedirect.php @@ -23,7 +23,7 @@ #[SyliusCrudRoutes( alias: 'app.book', section: 'redirect', - redirect: 'update' + redirect: 'update', )] class BookWithRedirect extends Book { diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithSection.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithSection.php index f61f8d8a2..a283947b0 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithSection.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithSection.php @@ -22,7 +22,7 @@ */ #[SyliusCrudRoutes( alias: 'app.book', - section: 'admin' + section: 'admin', )] class BookWithSection extends Book { diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithTemplate.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithTemplate.php index 644154080..27f48cb4a 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithTemplate.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithTemplate.php @@ -23,7 +23,7 @@ #[SyliusCrudRoutes( alias: 'app.book', section: 'template', - templates: 'backend/crud' + templates: 'backend/crud', )] class BookWithTemplate extends Book { diff --git a/src/Bundle/test/src/Entity/CrudRoutes/BookWithVars.php b/src/Bundle/test/src/Entity/CrudRoutes/BookWithVars.php index bd431b0d5..7c2056f68 100644 --- a/src/Bundle/test/src/Entity/CrudRoutes/BookWithVars.php +++ b/src/Bundle/test/src/Entity/CrudRoutes/BookWithVars.php @@ -30,7 +30,7 @@ 'index' => [ 'icon' => 'book', ], - ] + ], )] class BookWithVars extends Book { diff --git a/src/Bundle/test/src/Entity/Route/RegisterUserWithForm.php b/src/Bundle/test/src/Entity/Route/RegisterUserWithForm.php index f18468735..9875b57a1 100644 --- a/src/Bundle/test/src/Entity/Route/RegisterUserWithForm.php +++ b/src/Bundle/test/src/Entity/Route/RegisterUserWithForm.php @@ -22,7 +22,7 @@ path: '/users/register', methods: ['GET', 'POST'], controller: 'app.controller.user:createAction', - form: RegisterType::class + form: RegisterType::class, )] final class RegisterUserWithForm extends User { diff --git a/src/Bundle/test/src/Entity/Route/ShowBook.php b/src/Bundle/test/src/Entity/Route/ShowBook.php index 54bbc9bf0..682c81c44 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBook.php +++ b/src/Bundle/test/src/Entity/Route/ShowBook.php @@ -23,7 +23,7 @@ #[SyliusRoute( name: 'show_book', path: '/book/{id}', - controller: 'app.controller.book:showAction' + controller: 'app.controller.book:showAction', )] class ShowBook extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithCriteria.php b/src/Bundle/test/src/Entity/Route/ShowBookWithCriteria.php index afdb67f39..586b2c1ee 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithCriteria.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithCriteria.php @@ -24,7 +24,7 @@ name: 'show_book_with_criteria', path: '/library/{libraryId}/book/{id}', controller: 'app.controller.book:showAction', - criteria: ['library' => '$libraryId'] + criteria: ['library' => '$libraryId'], )] class ShowBookWithCriteria extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithHost.php b/src/Bundle/test/src/Entity/Route/ShowBookWithHost.php index 7deb28970..a69699cc3 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithHost.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithHost.php @@ -24,7 +24,7 @@ name: 'show_book_with_host', path: '/book/{id}', controller: 'app.controller.book:showAction', - host: 'm.example.com' + host: 'm.example.com', )] class ShowBookWithHost extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithMethods.php b/src/Bundle/test/src/Entity/Route/ShowBookWithMethods.php index c6ac53f5e..14ae509d5 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithMethods.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithMethods.php @@ -24,7 +24,7 @@ name: 'show_book_with_methods', path: '/book/{id}', controller: 'app.controller.book:showAction', - methods: ['GET'] + methods: ['GET'], )] class ShowBookWithMethods extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithOptions.php b/src/Bundle/test/src/Entity/Route/ShowBookWithOptions.php index 28d72ca2b..8fdde2d5c 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithOptions.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithOptions.php @@ -24,7 +24,7 @@ name: 'show_book_with_options', path: '/book/{id}', controller: 'app.controller.book:showAction', - options: ['utf8' => true] + options: ['utf8' => true], )] class ShowBookWithOptions extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithPriority.php b/src/Bundle/test/src/Entity/Route/ShowBookWithPriority.php index e71e4e8a2..81ab6cea0 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithPriority.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithPriority.php @@ -29,7 +29,7 @@ name: 'show_book_with_priority', path: '/book/{id}', controller: 'app.controller.book:showAction', - priority: 2 + priority: 2, )] class ShowBookWithPriority extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithRepository.php b/src/Bundle/test/src/Entity/Route/ShowBookWithRepository.php index d516761e3..475e70ca5 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithRepository.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithRepository.php @@ -27,7 +27,7 @@ repository: [ 'method' => 'findOneNewestByAuthor', 'arguments' => '[$author]', - ] + ], )] class ShowBookWithRepository extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithRequirements.php b/src/Bundle/test/src/Entity/Route/ShowBookWithRequirements.php index 85865c5c2..d242b02ef 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithRequirements.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithRequirements.php @@ -24,7 +24,7 @@ name: 'show_book_with_requirements', path: '/book/{id}', controller: 'app.controller.book:showAction', - requirements: ['id' => '\d+'] + requirements: ['id' => '\d+'], )] class ShowBookWithRequirements extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithSchemes.php b/src/Bundle/test/src/Entity/Route/ShowBookWithSchemes.php index 22b857ca6..c9dd6d546 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithSchemes.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithSchemes.php @@ -24,7 +24,7 @@ name: 'show_book_with_schemes', path: '/book/{id}', controller: 'app.controller.book:showAction', - schemes: ['https'] + schemes: ['https'], )] class ShowBookWithSchemes extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithSerializationGroups.php b/src/Bundle/test/src/Entity/Route/ShowBookWithSerializationGroups.php index aacde72ee..45b9bb9c6 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithSerializationGroups.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithSerializationGroups.php @@ -24,7 +24,7 @@ name: 'show_book_with_serialization_groups', path: '/book/{id}', controller: 'app.controller.book:showAction', - serializationGroups: ['sylius'] + serializationGroups: ['sylius'], )] class ShowBookWithSerializationGroups extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithSerializationVersion.php b/src/Bundle/test/src/Entity/Route/ShowBookWithSerializationVersion.php index b8cb29c24..2b50c80ed 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithSerializationVersion.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithSerializationVersion.php @@ -24,7 +24,7 @@ name: 'show_book_with_serialization_version', path: '/book/{id}', controller: 'app.controller.book:showAction', - serializationVersion: '1.0' + serializationVersion: '1.0', )] class ShowBookWithSerializationVersion extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithTemplate.php b/src/Bundle/test/src/Entity/Route/ShowBookWithTemplate.php index 57d444525..68816bec9 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithTemplate.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithTemplate.php @@ -24,7 +24,7 @@ name: 'show_book_with_template', path: '/book/{id}', controller: 'app.controller.book:showAction', - template: 'book/show.html.twig' + template: 'book/show.html.twig', )] class ShowBookWithTemplate extends Book { diff --git a/src/Bundle/test/src/Entity/Route/ShowBookWithVars.php b/src/Bundle/test/src/Entity/Route/ShowBookWithVars.php index f0f8fdd03..337561e99 100644 --- a/src/Bundle/test/src/Entity/Route/ShowBookWithVars.php +++ b/src/Bundle/test/src/Entity/Route/ShowBookWithVars.php @@ -24,7 +24,7 @@ name: 'show_book_with_vars', path: '/book/{id}', controller: 'app.controller.book:showAction', - vars: ['foo' => 'bar'] + vars: ['foo' => 'bar'], )] class ShowBookWithVars extends Book { diff --git a/src/Bundle/test/src/Service/FirstAutowiredService.php b/src/Bundle/test/src/Service/FirstAutowiredService.php index 796c6d20d..6342794a9 100644 --- a/src/Bundle/test/src/Service/FirstAutowiredService.php +++ b/src/Bundle/test/src/Service/FirstAutowiredService.php @@ -28,7 +28,7 @@ final class FirstAutowiredService public function __construct( FactoryInterface $bookFactory, RepositoryInterface $bookRepository, - ObjectManager $bookManager + ObjectManager $bookManager, ) { $this->bookFactory = $bookFactory; $this->bookRepository = $bookRepository; diff --git a/src/Bundle/test/src/Service/NoInterfaceAutowiredService.php b/src/Bundle/test/src/Service/NoInterfaceAutowiredService.php index 28a878e4a..50fa624d1 100644 --- a/src/Bundle/test/src/Service/NoInterfaceAutowiredService.php +++ b/src/Bundle/test/src/Service/NoInterfaceAutowiredService.php @@ -32,7 +32,7 @@ public function __construct( BookFactory $bookFactory, BookRepository $bookRepository, Factory $comicBookFactory, - EntityRepository $comicBookRepository + EntityRepository $comicBookRepository, ) { $this->bookFactory = $bookFactory; $this->bookRepository = $bookRepository; diff --git a/src/Bundle/test/src/Service/SecondAutowiredService.php b/src/Bundle/test/src/Service/SecondAutowiredService.php index fae90c0c4..072da510d 100644 --- a/src/Bundle/test/src/Service/SecondAutowiredService.php +++ b/src/Bundle/test/src/Service/SecondAutowiredService.php @@ -28,7 +28,7 @@ final class SecondAutowiredService public function __construct( BookFactoryInterface $bookFactory, BookRepositoryInterface $bookRepository, - EntityManagerInterface $bookManager + EntityManagerInterface $bookManager, ) { $this->bookFactory = $bookFactory; $this->bookRepository = $bookRepository; diff --git a/src/Bundle/test/src/Tests/Controller/ScienceBookUiTest.php b/src/Bundle/test/src/Tests/Controller/ScienceBookUiTest.php index 4a94629bf..319aa1b45 100644 --- a/src/Bundle/test/src/Tests/Controller/ScienceBookUiTest.php +++ b/src/Bundle/test/src/Tests/Controller/ScienceBookUiTest.php @@ -48,11 +48,11 @@ public function it_allows_indexing_books(): void $this->assertStringContainsString('

Books

', $content); $this->assertStringContainsString( sprintf('%dA Brief History of TimeStephen Hawking', $scienceBooks['science-book1']->getId()), - $content + $content, ); $this->assertStringContainsString( sprintf('%dThe Future of HumanityMichio Kaku', $scienceBooks['science-book2']->getId()), - $content + $content, ); } diff --git a/src/Component/Annotation/SyliusCrudRoutes.php b/src/Component/Annotation/SyliusCrudRoutes.php index e36cfdd4c..f0bcda0f0 100644 --- a/src/Component/Annotation/SyliusCrudRoutes.php +++ b/src/Component/Annotation/SyliusCrudRoutes.php @@ -61,7 +61,7 @@ public function __construct( ?bool $permission = null, ?array $except = null, ?array $only = null, - ?array $vars = null + ?array $vars = null, ) { $this->alias = $alias; $this->path = $path; diff --git a/src/Component/Annotation/SyliusRoute.php b/src/Component/Annotation/SyliusRoute.php index 3809fc386..c12148842 100644 --- a/src/Component/Annotation/SyliusRoute.php +++ b/src/Component/Annotation/SyliusRoute.php @@ -64,7 +64,7 @@ public function __construct( ?array $schemes = null, ?int $priority = null, ?array $vars = null, - ?string $form = null + ?string $form = null, ) { $this->name = $name; $this->path = $path; diff --git a/src/Component/Exception/DeleteHandlingException.php b/src/Component/Exception/DeleteHandlingException.php index bd0a34edf..aec074c59 100644 --- a/src/Component/Exception/DeleteHandlingException.php +++ b/src/Component/Exception/DeleteHandlingException.php @@ -24,7 +24,7 @@ public function __construct( string $flash = 'something_went_wrong_error', int $apiResponseCode = 500, int $code = 0, - ?\Exception $previous = null + ?\Exception $previous = null, ) { parent::__construct($message, $code, $previous); diff --git a/src/Component/Exception/RaceConditionException.php b/src/Component/Exception/RaceConditionException.php index 11a992590..5b1554937 100644 --- a/src/Component/Exception/RaceConditionException.php +++ b/src/Component/Exception/RaceConditionException.php @@ -22,7 +22,7 @@ public function __construct(?\Exception $previous = null) 'race_condition_error', 409, null !== $previous ? (int) $previous->getCode() : 0, - $previous + $previous, ); } } diff --git a/src/Component/Exception/UnexpectedTypeException.php b/src/Component/Exception/UnexpectedTypeException.php index 4e7f455b6..17d3e3187 100644 --- a/src/Component/Exception/UnexpectedTypeException.php +++ b/src/Component/Exception/UnexpectedTypeException.php @@ -23,7 +23,7 @@ public function __construct($value, string $expectedType) parent::__construct(sprintf( 'Expected argument of type "%s", "%s" given.', $expectedType, - is_object($value) ? get_class($value) : gettype($value) + is_object($value) ? get_class($value) : gettype($value), )); } } diff --git a/src/Component/Exception/UnsupportedMethodException.php b/src/Component/Exception/UnsupportedMethodException.php index 59138482f..c91c5a8ba 100644 --- a/src/Component/Exception/UnsupportedMethodException.php +++ b/src/Component/Exception/UnsupportedMethodException.php @@ -19,7 +19,7 @@ public function __construct(string $methodName) { parent::__construct(sprintf( 'The method "%s" is not supported.', - $methodName + $methodName, )); } } diff --git a/src/Component/Exception/UpdateHandlingException.php b/src/Component/Exception/UpdateHandlingException.php index 695dc040b..e9f137d08 100644 --- a/src/Component/Exception/UpdateHandlingException.php +++ b/src/Component/Exception/UpdateHandlingException.php @@ -24,7 +24,7 @@ public function __construct( string $flash = 'something_went_wrong_error', int $apiResponseCode = 400, int $code = 0, - ?\Exception $previous = null + ?\Exception $previous = null, ) { parent::__construct($message, $code, $previous); diff --git a/src/Component/Tests/Metadata/MetadataTest.php b/src/Component/Tests/Metadata/MetadataTest.php index d9d24c7fa..e826fd637 100644 --- a/src/Component/Tests/Metadata/MetadataTest.php +++ b/src/Component/Tests/Metadata/MetadataTest.php @@ -40,7 +40,7 @@ public function it_uses_a_custom_inflector(): void $factory->withPluralRules(new Ruleset( new Transformations(), new Patterns(), - new Substitutions(new Substitution(new Word('taxon'), new Word('taxons'))) + new Substitutions(new Substitution(new Word('taxon'), new Word('taxons'))), )); $inflector = $factory->build(); diff --git a/src/Component/spec/Factory/TranslatableFactorySpec.php b/src/Component/spec/Factory/TranslatableFactorySpec.php index a885a22a8..3b19a88ed 100644 --- a/src/Component/spec/Factory/TranslatableFactorySpec.php +++ b/src/Component/spec/Factory/TranslatableFactorySpec.php @@ -45,7 +45,7 @@ function it_throws_an_exception_if_resource_is_not_translatable(FactoryInterface function it_creates_translatable_and_sets_locales( FactoryInterface $factory, TranslationLocaleProviderInterface $localeProvider, - TranslatableInterface $resource + TranslatableInterface $resource, ): void { $localeProvider->getDefaultLocaleCode()->willReturn('pl_PL'); diff --git a/src/Component/spec/Model/AbstractTranslationSpec.php b/src/Component/spec/Model/AbstractTranslationSpec.php index 693dca07c..cf74d5618 100644 --- a/src/Component/spec/Model/AbstractTranslationSpec.php +++ b/src/Component/spec/Model/AbstractTranslationSpec.php @@ -39,7 +39,7 @@ function its_translatable_is_mutable(TranslatableInterface $translatable): void function its_detaches_from_its_translatable_correctly( TranslatableInterface $translatable1, - TranslatableInterface $translatable2 + TranslatableInterface $translatable2, ): void { $translatable1->addTranslation(Argument::type(AbstractTranslation::class)); $this->setTranslatable($translatable1); diff --git a/src/Component/spec/Repository/InMemoryRepositorySpec.php b/src/Component/spec/Repository/InMemoryRepositorySpec.php index cd2210f33..1ff461393 100644 --- a/src/Component/spec/Repository/InMemoryRepositorySpec.php +++ b/src/Component/spec/Repository/InMemoryRepositorySpec.php @@ -86,7 +86,7 @@ function it_returns_null_if_cannot_find_object_by_id(): void function it_returns_all_objects_when_finding_by_an_empty_parameter_array( SampleBookResourceInterface $book, - SampleBookResourceInterface $shirt + SampleBookResourceInterface $shirt, ): void { $book->getId()->willReturn(10); $book->getName()->willReturn('Book'); @@ -106,7 +106,7 @@ function it_finds_many_objects_by_multiple_criteria_orders_a_limit_and_an_offset SampleBookResourceInterface $thirdBook, SampleBookResourceInterface $fourthBook, SampleBookResourceInterface $wrongIdBook, - SampleBookResourceInterface $wrongNameBook + SampleBookResourceInterface $wrongNameBook, ): void { $id = 80; $name = 'Book'; @@ -152,7 +152,7 @@ function it_finds_many_objects_by_multiple_criteria_orders_a_limit_and_an_offset 'title' => RepositoryInterface::ORDER_DESCENDING, ], $limit = 2, - $offset = 1 + $offset = 1, )->shouldReturn([$thirdBook, $firstBook]); } @@ -174,7 +174,7 @@ function it_finds_one_object_by_parameter(SampleBookResourceInterface $book, Sam function it_returns_first_result_while_finding_one_by_parameters( SampleBookResourceInterface $book, - SampleBookResourceInterface $secondBook + SampleBookResourceInterface $secondBook, ): void { $book->getName()->willReturn('Book'); $secondBook->getName()->willReturn('Book'); diff --git a/src/Component/spec/Translation/TranslatableEntityLocaleAssignerSpec.php b/src/Component/spec/Translation/TranslatableEntityLocaleAssignerSpec.php index 0ef12c192..119520e6d 100644 --- a/src/Component/spec/Translation/TranslatableEntityLocaleAssignerSpec.php +++ b/src/Component/spec/Translation/TranslatableEntityLocaleAssignerSpec.php @@ -32,7 +32,7 @@ function it_implements_traslatable_entity_locale_assigner_interface(): void function it_should_assign_current_and_default_locale_to_given_translatable_entity( TranslationLocaleProviderInterface $translationLocaleProvider, - TranslatableInterface $translatableEntity + TranslatableInterface $translatableEntity, ): void { $translationLocaleProvider->getDefaultLocaleCode()->willReturn('en_US'); From a1a14b23ffa951f2023b184c06c5aa24323271d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Chru=C5=9Bciel?= Date: Tue, 5 Jul 2022 12:22:23 +0200 Subject: [PATCH 3/4] [Conflict] Add note about phpstan/phpdoc-parser --- CONFLICTS.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 CONFLICTS.md diff --git a/CONFLICTS.md b/CONFLICTS.md new file mode 100644 index 000000000..aeee2e6f8 --- /dev/null +++ b/CONFLICTS.md @@ -0,0 +1,9 @@ +# CONFLICTS + +This document explains why certain conflicts were added to `composer.json` and +references related issues. + +- `"phpstan/phpdoc-parser": "^1.6.0"`: + + Usage of ^1.6 versions leads to following error: https://issuehint.com/issue/slevomat/coding-standard/1379. To remove it, Sylius-Labs/ECS + requires bump of Slevomat lib - "slevomat/coding-standard" From f5195bbee9c0433666b6035b6b437864cb944bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Chru=C5=9Bciel?= Date: Tue, 5 Jul 2022 13:31:09 +0200 Subject: [PATCH 4/4] [Maintenance] Bump PHPStan and solve newly found issues --- composer.json | 9 +++-- phpstan.neon | 10 +++++ .../ORM/Form/Builder/DefaultFormBuilder.php | 3 ++ src/Bundle/Event/ResourceControllerEvent.php | 4 +- .../ORMMappedSuperClassSubscriber.php | 4 ++ .../DataTransformer/RecursiveTransformer.php | 38 +++++++++---------- .../HttpFoundationRequestHandler.php | 10 ++++- src/Bundle/Form/Type/DefaultResourceType.php | 3 ++ src/Bundle/Form/Type/FixedCollectionType.php | 7 ++++ .../Type/ResourceAutocompleteChoiceType.php | 7 ++++ .../Form/Type/ResourceToIdentifierType.php | 7 +++- .../Form/Type/ResourceTranslationsType.php | 3 ++ src/Bundle/Routing/RoutesAttributesLoader.php | 13 ------- src/Bundle/Storage/CookieStorage.php | 3 ++ ...queWithinCollectionConstraintValidator.php | 11 ++++++ .../Generator/RandomnessGenerator.php | 5 +++ .../Repository/InMemoryRepository.php | 7 +++- 17 files changed, 103 insertions(+), 41 deletions(-) diff --git a/composer.json b/composer.json index 0d0ba7619..930649e06 100644 --- a/composer.json +++ b/composer.json @@ -65,9 +65,10 @@ "pamil/phpspec-skip-example-extension": "^4.2", "phpspec/phpspec": "^7.2", "phpspec/prophecy-phpunit": "^2.0", - "phpstan/phpstan": "0.12.99", - "phpstan/phpstan-phpunit": "0.12.22", - "phpstan/phpstan-webmozart-assert": "0.12.16", + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-doctrine": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-webmozart-assert": "^1.0", "phpunit/phpunit": "^9.5", "sylius-labs/coding-standard": "^4.0", "sylius/grid-bundle": "^1.7", @@ -77,7 +78,7 @@ "symplify/easy-coding-standard": "^9.4", "twig/twig": "^2.12 || ^3.0", "vimeo/psalm": "4.7.0", - "rector/rector": "^0.11.47" + "rector/rector": "^0.12.20" }, "suggest": { "doctrine/orm": "^2.5", diff --git a/phpstan.neon b/phpstan.neon index d579a1864..4d00ae7eb 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -54,3 +54,13 @@ parameters: - '/Return typehint of method Sylius\\Bundle\\ResourceBundle\\Routing\\RoutesAttributesLoader::getClassAttributes\(\) has invalid type ReflectionAttribute./' - '/Unable to resolve the template type ExpectedType in call to method static method Webmozart\\Assert\\Assert::isInstanceOf\(\)/' - '/is deprecated since Sylius 1\.8/' + - '/Method Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent::stop\(\) has no return type specified./' + - '/Method Sylius\\Bundle\\ResourceBundle\\Form\\Extension\\HttpFoundation\\HttpFoundationRequestHandler::handleRequest\(\) has no return type specified./' + - '/Method Sylius\\Bundle\\ResourceBundle\\Grid\\Controller\\ResourcesResolver::getResources\(\) has no return type specified./' + - '/Method Sylius\\Component\\Resource\\Model\\ResourceInterface::getId\(\) has no return type specified./' + - '/Method Sylius\\Component\\Resource\\Model\\TimestampableInterface::set(Created|Updated)At\(\) has no return type specified./' + - '/Parameter #1 \$objectOrArray of method Symfony\\Component\\PropertyAccess\\PropertyAccessor::getValue\(\) expects array\|object, mixed given\./' + - '/Parameter #1 \$objectOrArray of method Symfony\\Component\\PropertyAccess\\PropertyAccessorInterface::getValue\(\) expects array\|object, mixed given\./' + - '/Parameter #4 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\./' + - '/Parameter #1 \$submittedData of method Symfony\\Component\\Form\\FormInterface::submit\(\) expects array\|string\|null, mixed given\./' + - '/Parameter #2 \$callback of function preg_replace_callback expects callable\(array\): string, Closure\(array\): mixed given\./' diff --git a/src/Bundle/Doctrine/ORM/Form/Builder/DefaultFormBuilder.php b/src/Bundle/Doctrine/ORM/Form/Builder/DefaultFormBuilder.php index 3233d43d5..72a725457 100644 --- a/src/Bundle/Doctrine/ORM/Form/Builder/DefaultFormBuilder.php +++ b/src/Bundle/Doctrine/ORM/Form/Builder/DefaultFormBuilder.php @@ -19,6 +19,7 @@ use Sylius\Bundle\ResourceBundle\Form\Builder\DefaultFormBuilderInterface; use Sylius\Component\Resource\Metadata\MetadataInterface; use Symfony\Component\Form\FormBuilderInterface; +use Webmozart\Assert\Assert; class DefaultFormBuilder implements DefaultFormBuilderInterface { @@ -70,6 +71,8 @@ private function doBuild(ClassMetadataInfo $classMetadata, FormBuilderInterface foreach ($classMetadata->embeddedClasses as $fieldName => $embeddedMapping) { $nestedFormBuilder = $formBuilder->create($fieldName, null, ['data_class' => $embeddedMapping['class'], 'compound' => true]); + Assert::stringNotEmpty($embeddedMapping['class']); + $this->doBuild($this->entityManager->getClassMetadata($embeddedMapping['class']), $nestedFormBuilder); $formBuilder->add($nestedFormBuilder); diff --git a/src/Bundle/Event/ResourceControllerEvent.php b/src/Bundle/Event/ResourceControllerEvent.php index 93b8cfed7..2e77a036f 100644 --- a/src/Bundle/Event/ResourceControllerEvent.php +++ b/src/Bundle/Event/ResourceControllerEvent.php @@ -37,7 +37,9 @@ class ResourceControllerEvent extends GenericEvent private ?Response $response = null; - /** @psalm-suppress MissingReturnType */ + /** + * @psalm-suppress MissingReturnType + */ public function stop(string $message, string $type = self::TYPE_ERROR, array $parameters = [], int $errorCode = 500) { $this->messageType = $type; diff --git a/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php b/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php index 51666c6c0..8b7247ba7 100644 --- a/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php +++ b/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php @@ -78,6 +78,8 @@ private function setAssociationMappings(ClassMetadataInfo $metadata, Configurati if ($parentMetadata->isMappedSuperclass) { foreach ($parentMetadata->getAssociationMappings() as $key => $value) { + Assert::integer($value['type']); + if ($this->isRelation($value['type']) && !isset($metadata->associationMappings[$key])) { $metadata->associationMappings[$key] = $value; } @@ -94,6 +96,8 @@ private function unsetAssociationMappings(ClassMetadataInfo $metadata): void } foreach ($metadata->getAssociationMappings() as $key => $value) { + Assert::integer($value['type']); + if ($this->isRelation($value['type'])) { unset($metadata->associationMappings[$key]); } diff --git a/src/Bundle/Form/DataTransformer/RecursiveTransformer.php b/src/Bundle/Form/DataTransformer/RecursiveTransformer.php index b5dcb8a9b..49df17830 100644 --- a/src/Bundle/Form/DataTransformer/RecursiveTransformer.php +++ b/src/Bundle/Form/DataTransformer/RecursiveTransformer.php @@ -33,7 +33,15 @@ public function transform($value): Collection return new ArrayCollection(); } - $this->assertTransformationValueType($value, Collection::class); + if (!$value instanceof Collection) { + throw new TransformationFailedException( + sprintf( + 'Expected "%s", but got "%s"', + Collection::class, + is_object($value) ? get_class($value) : gettype($value), + ), + ); + } return $value->map( /** @@ -53,7 +61,15 @@ public function reverseTransform($value): Collection return new ArrayCollection(); } - $this->assertTransformationValueType($value, Collection::class); + if (!$value instanceof Collection) { + throw new TransformationFailedException( + sprintf( + 'Expected "%s", but got "%s"', + Collection::class, + is_object($value) ? get_class($value) : gettype($value), + ), + ); + } return $value->map( /** @@ -66,22 +82,4 @@ function ($currentValue) { }, ); } - - /** - * @param mixed $value - * - * @throws TransformationFailedException - */ - private function assertTransformationValueType($value, string $expectedType): void - { - if (!($value instanceof $expectedType)) { - throw new TransformationFailedException( - sprintf( - 'Expected "%s", but got "%s"', - $expectedType, - is_object($value) ? get_class($value) : gettype($value), - ), - ); - } - } } diff --git a/src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php b/src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php index 0c31b35c9..1f60459c1 100644 --- a/src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php +++ b/src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php @@ -20,6 +20,7 @@ use Symfony\Component\Form\Util\ServerParams; use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\Request; +use Webmozart\Assert\Assert; /** * Does not compare the form's method with the request's method. @@ -69,8 +70,15 @@ public function handleRequest(FormInterface $form, $request = null) // Submit the form, but don't clear the default values $form->submit(null, false); + $uploadMaxSizeMessageCallable = $form->getConfig()->getOption('upload_max_size_message'); + + Assert::isCallable($uploadMaxSizeMessageCallable); + + $uploadMaxSizeMessage = call_user_func($uploadMaxSizeMessageCallable); + Assert::string($uploadMaxSizeMessage); + $form->addError(new FormError( - call_user_func($form->getConfig()->getOption('upload_max_size_message')), + $uploadMaxSizeMessage, null, ['{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()], )); diff --git a/src/Bundle/Form/Type/DefaultResourceType.php b/src/Bundle/Form/Type/DefaultResourceType.php index 2de02d5e9..42d218c8e 100644 --- a/src/Bundle/Form/Type/DefaultResourceType.php +++ b/src/Bundle/Form/Type/DefaultResourceType.php @@ -18,6 +18,7 @@ use Sylius\Component\Resource\Metadata\RegistryInterface; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; +use Webmozart\Assert\Assert; final class DefaultResourceType extends AbstractType { @@ -33,6 +34,8 @@ public function __construct(RegistryInterface $metadataRegistry, ServiceRegistry public function buildForm(FormBuilderInterface $builder, array $options): void { + Assert::string($options['data_class']); + $metadata = $this->metadataRegistry->getByClass($options['data_class']); /** @var DefaultFormBuilderInterface $formBuilder */ diff --git a/src/Bundle/Form/Type/FixedCollectionType.php b/src/Bundle/Form/Type/FixedCollectionType.php index bde9580cf..9b6e8a7aa 100644 --- a/src/Bundle/Form/Type/FixedCollectionType.php +++ b/src/Bundle/Form/Type/FixedCollectionType.php @@ -17,12 +17,19 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; +use Webmozart\Assert\Assert; final class FixedCollectionType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { + Assert::isIterable($options['entries']); + foreach ($options['entries'] as $entry) { + Assert::isCallable($options['entry_type']); + Assert::isCallable($options['entry_name']); + Assert::isCallable($options['entry_options']); + $entryType = $options['entry_type']($entry); $entryName = $options['entry_name']($entry); $entryOptions = $options['entry_options']($entry); diff --git a/src/Bundle/Form/Type/ResourceAutocompleteChoiceType.php b/src/Bundle/Form/Type/ResourceAutocompleteChoiceType.php index 2b1c3669d..f307c2d28 100644 --- a/src/Bundle/Form/Type/ResourceAutocompleteChoiceType.php +++ b/src/Bundle/Form/Type/ResourceAutocompleteChoiceType.php @@ -17,6 +17,7 @@ use Sylius\Bundle\ResourceBundle\Form\DataTransformer\RecursiveTransformer; use Sylius\Bundle\ResourceBundle\Form\DataTransformer\ResourceToIdentifierTransformer; use Sylius\Component\Registry\ServiceRegistryInterface; +use Sylius\Component\Resource\Repository\RepositoryInterface; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; @@ -24,6 +25,7 @@ use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; +use Webmozart\Assert\Assert; class ResourceAutocompleteChoiceType extends AbstractType { @@ -36,6 +38,9 @@ public function __construct(ServiceRegistryInterface $resourceRepositoryRegistry public function buildForm(FormBuilderInterface $builder, array $options): void { + Assert::isInstanceOf($options['repository'], RepositoryInterface::class); + Assert::nullOrString($options['choice_value']); + if (!$options['multiple']) { $builder->addModelTransformer( new ResourceToIdentifierTransformer( @@ -84,6 +89,8 @@ public function configureOptions(OptionsResolver $resolver): void 'error_bubbling' => false, 'placeholder' => '', 'repository' => function (Options $options) { + Assert::string($options['resource']); + return $this->resourceRepositoryRegistry->get($options['resource']); }, ]) diff --git a/src/Bundle/Form/Type/ResourceToIdentifierType.php b/src/Bundle/Form/Type/ResourceToIdentifierType.php index 01dba37fb..501aaa2ba 100644 --- a/src/Bundle/Form/Type/ResourceToIdentifierType.php +++ b/src/Bundle/Form/Type/ResourceToIdentifierType.php @@ -20,6 +20,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Webmozart\Assert\Assert; final class ResourceToIdentifierType extends AbstractType { @@ -35,8 +36,12 @@ public function __construct(RepositoryInterface $repository, MetadataInterface $ public function buildForm(FormBuilderInterface $builder, array $options): void { + $identifier = $options['identifier']; + + Assert::nullOrString($identifier); + $builder->addModelTransformer( - new ResourceToIdentifierTransformer($this->repository, $options['identifier']), + new ResourceToIdentifierTransformer($this->repository, $identifier), ); } diff --git a/src/Bundle/Form/Type/ResourceTranslationsType.php b/src/Bundle/Form/Type/ResourceTranslationsType.php index c57f739cd..28946f1ca 100644 --- a/src/Bundle/Form/Type/ResourceTranslationsType.php +++ b/src/Bundle/Form/Type/ResourceTranslationsType.php @@ -13,6 +13,7 @@ namespace Sylius\Bundle\ResourceBundle\Form\Type; +use Sylius\Component\Resource\Model\TranslatableInterface; use Sylius\Component\Resource\Model\TranslationInterface; use Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface; use Symfony\Component\Form\AbstractType; @@ -46,6 +47,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $translatable = $parentForm->getData(); + Assert::nullOrIsInstanceOf($translatable, TranslatableInterface::class); + foreach ($translations as $localeCode => $translation) { if (null === $translation) { unset($translations[$localeCode]); diff --git a/src/Bundle/Routing/RoutesAttributesLoader.php b/src/Bundle/Routing/RoutesAttributesLoader.php index cfa2b8937..14538e0a1 100644 --- a/src/Bundle/Routing/RoutesAttributesLoader.php +++ b/src/Bundle/Routing/RoutesAttributesLoader.php @@ -41,17 +41,4 @@ public function __invoke(): RouteCollection return $routeCollection; } - - private function getClasses(): iterable - { - $paths = $this->mapping['paths'] ?? []; - - foreach ($paths as $resourceDirectory) { - $resources = ClassReflection::getResourcesByPath($resourceDirectory); - - foreach ($resources as $className) { - yield $className; - } - } - } } diff --git a/src/Bundle/Storage/CookieStorage.php b/src/Bundle/Storage/CookieStorage.php index a91fdc3b2..f259b8e30 100644 --- a/src/Bundle/Storage/CookieStorage.php +++ b/src/Bundle/Storage/CookieStorage.php @@ -20,6 +20,7 @@ use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; +use Webmozart\Assert\Assert; final class CookieStorage implements StorageInterface, EventSubscriberInterface { @@ -71,6 +72,8 @@ public function onKernelResponse(ResponseEvent $event): void $response = $event->getResponse(); foreach ($this->responseCookies as $name => $value) { + Assert::nullOrString($value); + $response->headers->setCookie(new Cookie($name, $value)); } diff --git a/src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php b/src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php index 339690235..746270ad2 100644 --- a/src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php +++ b/src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php @@ -28,6 +28,8 @@ public function validate($value, Constraint $constraint): void $propertyAccessor = PropertyAccess::createPropertyAccessor(); $collectionOfEntitiesCodes = []; + Assert::isIterable($value); + foreach ($value as $key => $entity) { $checkingAttribute = $propertyAccessor->getValue($entity, $constraint->attributePath); @@ -35,6 +37,15 @@ public function validate($value, Constraint $constraint): void continue; } + if (!is_string($checkingAttribute) && !is_int($checkingAttribute)) { + throw new \InvalidArgumentException( + \sprintf( + 'Expected a string or integer. Got: %s', + \is_object($checkingAttribute) ? \get_class($checkingAttribute) : \gettype($checkingAttribute), + ), + ); + } + if (!array_key_exists($checkingAttribute, $collectionOfEntitiesCodes)) { $collectionOfEntitiesCodes[$checkingAttribute] = $key; diff --git a/src/Component/Generator/RandomnessGenerator.php b/src/Component/Generator/RandomnessGenerator.php index 0a28e737f..46414244f 100644 --- a/src/Component/Generator/RandomnessGenerator.php +++ b/src/Component/Generator/RandomnessGenerator.php @@ -13,6 +13,8 @@ namespace Sylius\Component\Resource\Generator; +use Webmozart\Assert\Assert; + final class RandomnessGenerator implements RandomnessGeneratorInterface { private string $uriSafeAlphabet; @@ -49,6 +51,9 @@ public function generateInt(int $min, int $max): int private function generateStringOfLength(int $length, string $alphabet): string { $alphabetMaxIndex = strlen($alphabet) - 1; + + Assert::greaterThanEq($alphabetMaxIndex, 1); + $randomString = ''; for ($i = 0; $i < $length; ++$i) { diff --git a/src/Component/Repository/InMemoryRepository.php b/src/Component/Repository/InMemoryRepository.php index 91225c8b6..8d29c1b69 100644 --- a/src/Component/Repository/InMemoryRepository.php +++ b/src/Component/Repository/InMemoryRepository.php @@ -21,6 +21,7 @@ use Sylius\Component\Resource\Repository\Exception\ExistingResourceException; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessor; +use Webmozart\Assert\Assert; class InMemoryRepository implements RepositoryInterface { @@ -84,7 +85,11 @@ public function find($id): ?object public function findAll(): array { - return $this->arrayObject->getArrayCopy(); + $arrayCopy = $this->arrayObject->getArrayCopy(); + + Assert::allObject($arrayCopy); + + return $arrayCopy; } public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array