diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index a77e830e..eaba9ee2 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -108,10 +108,6 @@ tests/* - - tests/* - - diff --git a/Cache/CacheClearer.php b/Cache/CacheClearer.php index 4a9e5561..46207997 100644 --- a/Cache/CacheClearer.php +++ b/Cache/CacheClearer.php @@ -8,19 +8,13 @@ use Metadata\Cache\ClearableCacheInterface; use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface; -/** - * @author Alexander Strizhak - */ +/** @author Alexander Strizhak */ class CacheClearer implements CacheClearerInterface { - /** - * @var CacheInterface|ClearableCacheInterface - */ + /** @var CacheInterface|ClearableCacheInterface */ private $cache; - /** - * @param CacheInterface|ClearableCacheInterface $cache - */ + /** @param CacheInterface|ClearableCacheInterface $cache */ public function __construct(CacheInterface $cache) { $this->cache = $cache; diff --git a/Cache/CacheWarmer.php b/Cache/CacheWarmer.php index 6295a65d..218e548c 100644 --- a/Cache/CacheWarmer.php +++ b/Cache/CacheWarmer.php @@ -8,22 +8,14 @@ use Symfony\Component\Finder\Finder; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; -/** - * @author Asmir Mustafic - */ +/** @author Asmir Mustafic */ class CacheWarmer implements CacheWarmerInterface { - /** - * @var MetadataFactoryInterface - */ + /** @var MetadataFactoryInterface */ private $metadataFactory; - /** - * @var string[] - */ + /** @var string[] */ private $includePaths = []; - /** - * @var string[] - */ + /** @var string[] */ private $excludePaths = []; public function __construct(array $includePaths, MetadataFactoryInterface $metadataFactory, array $excludePaths = []) diff --git a/ContextFactory/ConfiguredContextFactory.php b/ContextFactory/ConfiguredContextFactory.php index 7f50fa8f..bafae7c4 100644 --- a/ContextFactory/ConfiguredContextFactory.php +++ b/ContextFactory/ConfiguredContextFactory.php @@ -47,17 +47,13 @@ class ConfiguredContextFactory implements SerializationContextFactoryInterface, */ private $groups = []; - /** - * @param string|null $version - */ + /** @param string|null $version */ public function setVersion($version) { $this->version = $version; } - /** - * @param bool $serializeNulls - */ + /** @param bool $serializeNulls */ public function setSerializeNulls($serializeNulls) { $this->serializeNulls = (bool) $serializeNulls; @@ -68,17 +64,13 @@ public function enableMaxDepthChecks() $this->enableMaxDepthChecks = true; } - /** - * @param array $attributes - */ + /** @param array $attributes */ public function setAttributes(array $attributes) { $this->attributes = $attributes; } - /** - * @param string[] $groups - */ + /** @param string[] $groups */ public function setGroups(array $groups) { $this->groups = $groups; diff --git a/DependencyInjection/Compiler/AssignVisitorsPass.php b/DependencyInjection/Compiler/AssignVisitorsPass.php index 553cc5be..d781a098 100644 --- a/DependencyInjection/Compiler/AssignVisitorsPass.php +++ b/DependencyInjection/Compiler/AssignVisitorsPass.php @@ -7,9 +7,7 @@ use JMS\SerializerBundle\DependencyInjection\ScopedContainer; use Symfony\Component\DependencyInjection\Reference; -/** - * @internal - */ +/** @internal */ final class AssignVisitorsPass extends PerInstancePass { protected function processInstance(ScopedContainer $container): void diff --git a/DependencyInjection/Compiler/CustomHandlersPass.php b/DependencyInjection/Compiler/CustomHandlersPass.php index 0cfd205a..1aea4dcf 100644 --- a/DependencyInjection/Compiler/CustomHandlersPass.php +++ b/DependencyInjection/Compiler/CustomHandlersPass.php @@ -11,9 +11,7 @@ use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\Reference; -/** - * @internal - */ +/** @internal */ final class CustomHandlersPass extends PerInstancePass { protected function processInstance(ScopedContainer $container): void diff --git a/DependencyInjection/Compiler/DoctrinePass.php b/DependencyInjection/Compiler/DoctrinePass.php index 5202bd43..bc07e91b 100644 --- a/DependencyInjection/Compiler/DoctrinePass.php +++ b/DependencyInjection/Compiler/DoctrinePass.php @@ -7,9 +7,7 @@ use JMS\SerializerBundle\DependencyInjection\ScopedContainer; use Symfony\Component\DependencyInjection\Reference; -/** - * @internal - */ +/** @internal */ final class DoctrinePass extends PerInstancePass { protected function processInstance(ScopedContainer $container): void diff --git a/DependencyInjection/Compiler/ExpressionFunctionProviderPass.php b/DependencyInjection/Compiler/ExpressionFunctionProviderPass.php index f6b18385..709c98e8 100644 --- a/DependencyInjection/Compiler/ExpressionFunctionProviderPass.php +++ b/DependencyInjection/Compiler/ExpressionFunctionProviderPass.php @@ -8,9 +8,7 @@ use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Reference; -/** - * @internal - */ +/** @internal */ final class ExpressionFunctionProviderPass extends PerInstancePass { protected function processInstance(ScopedContainer $container): void diff --git a/DependencyInjection/Compiler/FormErrorHandlerTranslationDomainPass.php b/DependencyInjection/Compiler/FormErrorHandlerTranslationDomainPass.php index cd5182c2..105e60f3 100644 --- a/DependencyInjection/Compiler/FormErrorHandlerTranslationDomainPass.php +++ b/DependencyInjection/Compiler/FormErrorHandlerTranslationDomainPass.php @@ -6,9 +6,7 @@ use JMS\SerializerBundle\DependencyInjection\ScopedContainer; -/** - * @internal - */ +/** @internal */ final class FormErrorHandlerTranslationDomainPass extends PerInstancePass { protected function processInstance(ScopedContainer $container): void diff --git a/DependencyInjection/Compiler/PerInstancePass.php b/DependencyInjection/Compiler/PerInstancePass.php index c9fbee06..4de7a457 100644 --- a/DependencyInjection/Compiler/PerInstancePass.php +++ b/DependencyInjection/Compiler/PerInstancePass.php @@ -8,9 +8,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; -/** - * @internal - */ +/** @internal */ abstract class PerInstancePass implements CompilerPassInterface { public function process(ContainerBuilder $container): void diff --git a/DependencyInjection/Compiler/RegisterEventListenersAndSubscribersPass.php b/DependencyInjection/Compiler/RegisterEventListenersAndSubscribersPass.php index 8d7bf554..cbddc330 100644 --- a/DependencyInjection/Compiler/RegisterEventListenersAndSubscribersPass.php +++ b/DependencyInjection/Compiler/RegisterEventListenersAndSubscribersPass.php @@ -9,9 +9,7 @@ use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\Reference; -/** - * @internal - */ +/** @internal */ final class RegisterEventListenersAndSubscribersPass extends PerInstancePass { protected function processInstance(ScopedContainer $container): void diff --git a/DependencyInjection/Compiler/TwigExtensionPass.php b/DependencyInjection/Compiler/TwigExtensionPass.php index 6eaadc1d..88647bcf 100644 --- a/DependencyInjection/Compiler/TwigExtensionPass.php +++ b/DependencyInjection/Compiler/TwigExtensionPass.php @@ -6,9 +6,7 @@ use JMS\SerializerBundle\DependencyInjection\ScopedContainer; -/** - * @internal - */ +/** @internal */ final class TwigExtensionPass extends PerInstancePass { protected function processInstance(ScopedContainer $container): void diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index b3c896c6..6bfc95fb 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -10,16 +10,12 @@ use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\Exception\InvalidTypeException; -/** - * @internal - */ +/** @internal */ final class Configuration implements ConfigurationInterface { private $debug; - /** - * @param bool $debug - */ + /** @param bool $debug */ public function __construct($debug = false) { $this->debug = $debug; diff --git a/DependencyInjection/DIUtils.php b/DependencyInjection/DIUtils.php index e9da7f85..0ffc6ac5 100644 --- a/DependencyInjection/DIUtils.php +++ b/DependencyInjection/DIUtils.php @@ -9,14 +9,10 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; -/** - * @internal - */ +/** @internal */ final class DIUtils { - /** - * @see \JMS\SerializerBundle\DependencyInjection\Compiler\AdjustDecorationPass - */ + /** @see \JMS\SerializerBundle\DependencyInjection\Compiler\AdjustDecorationPass */ public static function adjustDecorators(ContainerBuilder $container): void { foreach ($container->getDefinitions() as $definition) { diff --git a/DependencyInjection/JMSSerializerExtension.php b/DependencyInjection/JMSSerializerExtension.php index 75b72388..933fc6c4 100644 --- a/DependencyInjection/JMSSerializerExtension.php +++ b/DependencyInjection/JMSSerializerExtension.php @@ -15,7 +15,6 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; @@ -25,13 +24,11 @@ use Symfony\Component\Uid\AbstractUid; use Symfony\Component\Yaml\Yaml; -/** - * @internal - */ +/** @internal */ final class JMSSerializerExtension extends Extension { /** - * {@inheritdoc} + * {@inheritDoc} */ public function load(array $rawConfigs, ContainerBuilder $container): void { @@ -321,9 +318,7 @@ private function loadInternal(array $config, ScopedContainer $container, array $ $this->setContextFactories($container, $config); } - /** - * @return ConfigurationInterface - */ + /** @return ConfigurationInterface */ public function getConfiguration(array $config, ContainerBuilder $container) { return new Configuration($container->getParameterBag()->resolveValue('%kernel.debug%')); diff --git a/ExpressionLanguage/BasicSerializerFunctionsProvider.php b/ExpressionLanguage/BasicSerializerFunctionsProvider.php index 9b58ebf9..208944e7 100644 --- a/ExpressionLanguage/BasicSerializerFunctionsProvider.php +++ b/ExpressionLanguage/BasicSerializerFunctionsProvider.php @@ -9,9 +9,7 @@ class BasicSerializerFunctionsProvider implements ExpressionFunctionProviderInterface { - /** - * @return ExpressionFunction[] - */ + /** @return ExpressionFunction[] */ public function getFunctions(): array { return [ @@ -30,7 +28,7 @@ public function getFunctions(): array }, static function (array $variables, $attribute, $object = null) { return call_user_func_array( [$variables['container']->get('jms_serializer.authorization_checker'), 'isGranted'], - [$attribute, $object] + [$attribute, $object], ); }), ]; diff --git a/Serializer/StopwatchEventSubscriber.php b/Serializer/StopwatchEventSubscriber.php index bd0aa310..040a41b7 100644 --- a/Serializer/StopwatchEventSubscriber.php +++ b/Serializer/StopwatchEventSubscriber.php @@ -8,13 +8,11 @@ use JMS\Serializer\EventDispatcher\EventSubscriberInterface; use JMS\Serializer\EventDispatcher\ObjectEvent; -/** - * @author Adrien Brault - */ +/** @author Adrien Brault */ class StopwatchEventSubscriber implements EventSubscriberInterface { /** - * {@inheritdoc} + * {@inheritDoc} */ public static function getSubscribedEvents() { @@ -31,14 +29,10 @@ public static function getSubscribedEvents() */ private $stopwatch; - /** - * @var string - */ + /** @var string */ private $name; - /** - * @var object - */ + /** @var object */ private $rootObject; public function __construct($stopwatch, $name = 'jms_serializer') diff --git a/Templating/SerializerHelper.php b/Templating/SerializerHelper.php index fc34b3da..8f8cdb9a 100644 --- a/Templating/SerializerHelper.php +++ b/Templating/SerializerHelper.php @@ -12,9 +12,9 @@ * * Basically provides access to JMSSerializer from PHP templates * - * @author Rafał Wrzeszcz - * * @deprecated use Twig instead + * + * @author Rafał Wrzeszcz */ class SerializerHelper extends Helper { diff --git a/Tests/DependencyInjection/Fixture/AnotherSimpleObject.php b/Tests/DependencyInjection/Fixture/AnotherSimpleObject.php index ea9671a6..854a8abb 100644 --- a/Tests/DependencyInjection/Fixture/AnotherSimpleObject.php +++ b/Tests/DependencyInjection/Fixture/AnotherSimpleObject.php @@ -12,9 +12,7 @@ class AnotherSimpleObject #[Type(name: 'float')] private $num; - /** - * @Type("string") - */ + /** @Type("string") */ #[Type(name: 'string')] private $str; diff --git a/Tests/DependencyInjection/Fixture/DefaultValuePropObject.php b/Tests/DependencyInjection/Fixture/DefaultValuePropObject.php index c91783dd..a9b738a8 100644 --- a/Tests/DependencyInjection/Fixture/DefaultValuePropObject.php +++ b/Tests/DependencyInjection/Fixture/DefaultValuePropObject.php @@ -1,11 +1,14 @@ ") - */ + /** @Type("enum<'JMS\SerializerBundle\Tests\DependencyInjection\Fixture\ObjectUsingEnumDeserializeCard'>") */ #[Type(name: 'enum<"JMS\SerializerBundle\Tests\DependencyInjection\Fixture\ObjectUsingEnumDeserializeCard">')] private $two; - /** - * @Type("array>") - */ + /** @Type("array>") */ #[Type(name: 'array>')] private array $three; diff --git a/Tests/DependencyInjection/Fixture/ObjectUsingExpressionLanguage.php b/Tests/DependencyInjection/Fixture/ObjectUsingExpressionLanguage.php index 17daf187..8ab1e50d 100644 --- a/Tests/DependencyInjection/Fixture/ObjectUsingExpressionLanguage.php +++ b/Tests/DependencyInjection/Fixture/ObjectUsingExpressionLanguage.php @@ -6,21 +6,15 @@ use JMS\Serializer\Annotation as Serializer; -/** - * @Serializer\VirtualProperty(exp="parameter('foo')", name="virtual") - */ +/** @Serializer\VirtualProperty(exp="parameter('foo')", name="virtual") */ #[Serializer\VirtualProperty(name: 'virtual', exp: 'parameter("foo")')] class ObjectUsingExpressionLanguage { - /** - * @Serializer\Expose(if="object.isAllowed()") - */ + /** @Serializer\Expose(if="object.isAllowed()") */ #[Serializer\Expose(if: 'object.isAllowed()')] private $name; - /** - * @Serializer\Exclude() - */ + /** @Serializer\Exclude() */ #[Serializer\Exclude] private $isAllowed; diff --git a/Tests/DependencyInjection/Fixture/ObjectUsingExpressionProperties.php b/Tests/DependencyInjection/Fixture/ObjectUsingExpressionProperties.php index 3b0eab03..aee86845 100644 --- a/Tests/DependencyInjection/Fixture/ObjectUsingExpressionProperties.php +++ b/Tests/DependencyInjection/Fixture/ObjectUsingExpressionProperties.php @@ -6,15 +6,11 @@ use JMS\Serializer\Annotation as Serializer; -/** - * @Serializer\VirtualProperty(exp="object.getName()", name="v_prop_name") - */ +/** @Serializer\VirtualProperty(exp="object.getName()", name="v_prop_name") */ #[Serializer\VirtualProperty(name: 'v_prop_name', exp: 'object.getName()')] class ObjectUsingExpressionProperties { - /** - * @Serializer\Exclude - */ + /** @Serializer\Exclude */ #[Serializer\Exclude] private $name; diff --git a/Tests/DependencyInjection/Fixture/VersionedObject.php b/Tests/DependencyInjection/Fixture/VersionedObject.php index a1f7c0d2..cf85dc6d 100644 --- a/Tests/DependencyInjection/Fixture/VersionedObject.php +++ b/Tests/DependencyInjection/Fixture/VersionedObject.php @@ -10,9 +10,7 @@ class VersionedObject { - /** - * @Until("1.0.0") - */ + /** @Until("1.0.0") */ #[Until(version: '1.0.0')] private $name; diff --git a/Tests/DependencyInjection/JMSSerializerExtensionTest.php b/Tests/DependencyInjection/JMSSerializerExtensionTest.php index 44f510cc..ce64a2c9 100644 --- a/Tests/DependencyInjection/JMSSerializerExtensionTest.php +++ b/Tests/DependencyInjection/JMSSerializerExtensionTest.php @@ -4,7 +4,6 @@ namespace JMS\SerializerBundle\Tests\DependencyInjection; - use Doctrine\Common\Annotations\AnnotationReader; use JMS\Serializer\EventDispatcher\EventSubscriberInterface; use JMS\Serializer\Exception\ExpressionLanguageRequiredException; @@ -14,9 +13,9 @@ use JMS\Serializer\Metadata\Driver\TypedPropertiesDriver; use JMS\Serializer\SerializationContext; use JMS\SerializerBundle\JMSSerializerBundle; -use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\DefaultValuePropObject; use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\AnotherSimpleObject; use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\CastDateToIntEventSubscriber; +use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\DefaultValuePropObject; use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\IncludeInterfaces\AnInterfaceImplementation; use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\IncludeInterfaces\AnObject; use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\ObjectUsingEnum; @@ -53,7 +52,7 @@ private function clearTempDir() if (is_dir($dir)) { $files = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), - \RecursiveIteratorIterator::CHILD_FIRST + \RecursiveIteratorIterator::CHILD_FIRST, ); foreach ($files as $fileinfo) { @@ -297,9 +296,7 @@ public function testLoadWithOptions() $this->assertEquals('exception', $container->getDefinition('jms_serializer.doctrine_object_constructor')->getArgument(2)); } - /** - * @dataProvider getPossibleProfilerStates - */ + /** @dataProvider getPossibleProfilerStates */ public function testLoadWithOptionsForMultipleInstances(bool $profiler) { $container = $this->getContainerForConfig([ @@ -393,9 +390,7 @@ public function getPossibleProfilerStates(): array ]; } - /** - * @dataProvider getPossibleProfilerStates - */ + /** @dataProvider getPossibleProfilerStates */ public function testLoadExistentMetadataDir(bool $profiler) { $container = $this->getContainerForConfig([ @@ -475,9 +470,7 @@ public function testLoadNotExistentMetadataDir() ]); } - /** - * @dataProvider getJsonVisitorConfigs - */ + /** @dataProvider getJsonVisitorConfigs */ public function testJsonVisitorOptions($expectedOptions, $config) { $container = $this->getContainerForConfigLoad([$config]); @@ -545,9 +538,7 @@ public function getJsonVisitorConfigs() return $configs; } - /** - * @dataProvider getJsonVisitorOptions - */ + /** @dataProvider getJsonVisitorOptions */ public function testPassJsonVisitorOptions(string $expected, $data, $options) { $container = $this->getContainerForConfig([ @@ -683,9 +674,7 @@ public function testExpressionInvalidEvaluator() $this->getContainerForConfig([['expression_evaluator' => ['id' => 'foo']]]); } - /** - * @dataProvider getXmlVisitorWhitelists - */ + /** @dataProvider getXmlVisitorWhitelists */ public function testXmlVisitorDoctypeWhitelist($expectedOptions, $config) { $container = $this->getContainerForConfigLoad([$config]); @@ -756,7 +745,7 @@ public function testAutoconfigureSubscribers() if (!method_exists($container, 'registerForAutoconfiguration')) { $this->markTestSkipped( - 'registerForAutoconfiguration method is not available in the container' + 'registerForAutoconfiguration method is not available in the container', ); } @@ -842,9 +831,9 @@ public function testIncludeInterfaces() new AnObject( 'foo', new AnInterfaceImplementation( - 'bar' - ) - ) + 'bar', + ), + ), ); $expected = [ 'foo' => 'foo', diff --git a/Tests/DependencyInjection/TwigExtensionPassTest.php b/Tests/DependencyInjection/TwigExtensionPassTest.php index 01d1c945..f20378cb 100644 --- a/Tests/DependencyInjection/TwigExtensionPassTest.php +++ b/Tests/DependencyInjection/TwigExtensionPassTest.php @@ -12,9 +12,7 @@ class TwigExtensionPassTest extends TestCase { - /** - * @return ContainerBuilder - */ + /** @return ContainerBuilder */ private function getContainer(array $bundles = ['TwigBundle' => TwigBundle::class]) { $loader = new JMSSerializerExtension(); diff --git a/composer.json b/composer.json index 1edab190..082ab3a2 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "doctrine/coding-standard": "^8.1", + "doctrine/coding-standard": "^12.0", "doctrine/orm": "^2.14", "phpunit/phpunit": "^8.0 || ^9.0", "symfony/expression-language": "^5.4 || ^6.0 || ^7.0",