From 9ac5f6c5918a11f2f44ec7cc2603a616a6117a55 Mon Sep 17 00:00:00 2001 From: W0rma Date: Fri, 4 Oct 2024 19:43:54 +0200 Subject: [PATCH 1/3] Ignore array_syntax cs rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 183dc0c4..58b54aab 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -6,6 +6,7 @@ ->setRiskyAllowed(false) ->setRules([ '@PER-CS' => true, + 'array_syntax' => false, 'braces_position' => [ 'control_structures_opening_brace' => 'same_line', ], From 302a85bfac77c9114757a27b3153b751a13557d4 Mon Sep 17 00:00:00 2001 From: W0rma Date: Fri, 4 Oct 2024 19:44:02 +0200 Subject: [PATCH 2/3] Apply cs fixer --- spec/Prophecy/Prediction/CallbackPredictionSpec.php | 1 - src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php | 4 ++-- src/Prophecy/Doubler/Generator/ClassMirror.php | 2 +- src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php | 2 +- src/Prophecy/Prophecy/MethodProphecy.php | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/spec/Prophecy/Prediction/CallbackPredictionSpec.php b/spec/Prophecy/Prediction/CallbackPredictionSpec.php index c234f43b..2742789a 100644 --- a/spec/Prophecy/Prediction/CallbackPredictionSpec.php +++ b/spec/Prophecy/Prediction/CallbackPredictionSpec.php @@ -3,7 +3,6 @@ namespace spec\Prophecy\Prediction; use PhpSpec\ObjectBehavior; - use Prophecy\Call\Call; use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; diff --git a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php index 50299e7d..98b2f496 100644 --- a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php +++ b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php @@ -79,13 +79,13 @@ public function apply(ClassNode $node) if (in_array($methodName, self::MAGIC_METHODS_WITH_ARGUMENTS)) { if (method_exists($tag, 'getParameters')) { // Reflection Docblock 5.4.0+. - foreach($tag->getParameters() as $argument) { + foreach ($tag->getParameters() as $argument) { $argumentNode = new ArgumentNode($argument->getName()); $methodNode->addArgument($argumentNode); } } else { // Reflection Docblock < 5.4.0. - foreach($tag->getArguments() as $argument) { + foreach ($tag->getArguments() as $argument) { $argumentNode = new ArgumentNode($argument['name']); $methodNode->addArgument($argumentNode); } diff --git a/src/Prophecy/Doubler/Generator/ClassMirror.php b/src/Prophecy/Doubler/Generator/ClassMirror.php index 5a6f0d0e..94b2a830 100644 --- a/src/Prophecy/Doubler/Generator/ClassMirror.php +++ b/src/Prophecy/Doubler/Generator/ClassMirror.php @@ -255,7 +255,7 @@ private function getTypeHints(?ReflectionType $type, ReflectionClass $class, boo } } elseif ($type instanceof ReflectionIntersectionType) { throw new ClassMirrorException('Doubling intersection types is not supported', $class); - } elseif(is_object($type)) { + } elseif (is_object($type)) { throw new ClassMirrorException('Unknown reflection type '.get_class($type), $class); } diff --git a/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php index 7b615352..211dc1b2 100644 --- a/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php +++ b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php @@ -54,7 +54,7 @@ private function getInterfacesTagList(\ReflectionClass $reflectionClass) $interfaces = $reflectionClass->getInterfaces(); $tagList = array(); - foreach($interfaces as $interface) { + foreach ($interfaces as $interface) { $tagList = array_merge($tagList, $this->classRetriever->getTagList($interface)); } diff --git a/src/Prophecy/Prophecy/MethodProphecy.php b/src/Prophecy/Prophecy/MethodProphecy.php index 972efb8d..cefe5e39 100644 --- a/src/Prophecy/Prophecy/MethodProphecy.php +++ b/src/Prophecy/Prophecy/MethodProphecy.php @@ -132,9 +132,9 @@ static function (string $type1, string $type2) { return class_exists($type) || interface_exists($type); }; - if($isObject($type1) && !$isObject($type2)) { + if ($isObject($type1) && !$isObject($type2)) { return -1; - } elseif(!$isObject($type1) && $isObject($type2)) { + } elseif (!$isObject($type1) && $isObject($type2)) { return 1; } From ac2a13a286d6acecd8d98fbd17d57d65071df213 Mon Sep 17 00:00:00 2001 From: W0rma Date: Fri, 4 Oct 2024 19:47:54 +0200 Subject: [PATCH 3/3] Update phpstan baseline --- phpstan-baseline.neon | 5 ----- 1 file changed, 5 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1550ef85..e1120efb 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5,11 +5,6 @@ parameters: count: 2 path: src/Prophecy/Argument/Token/ExactValueToken.php - - - message: "#^Method Prophecy\\\\Call\\\\CallCenter\\:\\:indentArguments\\(\\) should return array\\ but returns array\\\\|null\\.$#" - count: 1 - path: src/Prophecy/Call/CallCenter.php - - message: "#^Method Prophecy\\\\Doubler\\\\CachedDoubler\\:\\:createDoubleClass\\(\\) should return class\\-string\\ but returns class\\-string\\.$#" count: 1