diff --git a/Command/GenerateCommand.php b/Command/GenerateCommand.php index d8ed6ae..00a5132 100644 --- a/Command/GenerateCommand.php +++ b/Command/GenerateCommand.php @@ -38,7 +38,7 @@ public function execute(InputInterface $input, OutputInterface $output) $options = require $configFile; - if (!is_array($options)) { + if (!\is_array($options)) { throw new \RuntimeException(sprintf('Invalid config file specified or invalid return type in file %s', $configFile)); } diff --git a/Generator/EndpointGenerator.php b/Generator/EndpointGenerator.php index e527db2..8cf00d1 100644 --- a/Generator/EndpointGenerator.php +++ b/Generator/EndpointGenerator.php @@ -340,7 +340,7 @@ private function getGetBody(Operation $operation, Context $context): Stmt\ClassM $isSerializableBody = false; $isFormBody = false; $hasFileInForm = false; - $consumes = is_array($operation->getOperation()->getConsumes()) ? $operation->getOperation()->getConsumes() : [$operation->getOperation()->getConsumes()]; + $consumes = \is_array($operation->getOperation()->getConsumes()) ? $operation->getOperation()->getConsumes() : [$operation->getOperation()->getConsumes()]; foreach ($operation->getParameters() as $key => $parameter) { if ($parameter instanceof BodyParameter && $parameter->getSchema() !== null) { diff --git a/Generator/Psr7HttplugClientGenerator.php b/Generator/Psr7HttplugClientGenerator.php index 4fa4fa1..ed52344 100644 --- a/Generator/Psr7HttplugClientGenerator.php +++ b/Generator/Psr7HttplugClientGenerator.php @@ -113,7 +113,7 @@ private function getHttpClientCreateExpr(Context $context) if (null !== $openApi->getHost()) { $scheme = 'https'; - if (null !== $openApi->getSchemes() && count($openApi->getSchemes()) > 0 && !in_array('https', $openApi->getSchemes())) { + if (null !== $openApi->getSchemes() && \count($openApi->getSchemes()) > 0 && !\in_array('https', $openApi->getSchemes())) { $scheme = $openApi->getSchemes()[0]; } diff --git a/Guesser/OpenApiSchema/AdditionalPropertiesGuesser.php b/Guesser/OpenApiSchema/AdditionalPropertiesGuesser.php index b17443a..aabe2b2 100644 --- a/Guesser/OpenApiSchema/AdditionalPropertiesGuesser.php +++ b/Guesser/OpenApiSchema/AdditionalPropertiesGuesser.php @@ -20,7 +20,7 @@ public function supportObject($object) return false; } - if (true !== $object->getAdditionalProperties() && !is_object($object->getAdditionalProperties())) { + if (true !== $object->getAdditionalProperties() && !\is_object($object->getAdditionalProperties())) { return false; } diff --git a/Guesser/OpenApiSchema/AllOfGuesser.php b/Guesser/OpenApiSchema/AllOfGuesser.php index fdf3006..57ea425 100644 --- a/Guesser/OpenApiSchema/AllOfGuesser.php +++ b/Guesser/OpenApiSchema/AllOfGuesser.php @@ -12,7 +12,7 @@ class AllOfGuesser extends BaseAllOfGuesser */ public function supportObject($object) { - return ($object instanceof Schema) && is_array($object->getAllOf()) && count($object->getAllOf()) > 0; + return ($object instanceof Schema) && \is_array($object->getAllOf()) && \count($object->getAllOf()) > 0; } /** diff --git a/Guesser/OpenApiSchema/ItemsGuesser.php b/Guesser/OpenApiSchema/ItemsGuesser.php index 06f7609..a39e1b7 100644 --- a/Guesser/OpenApiSchema/ItemsGuesser.php +++ b/Guesser/OpenApiSchema/ItemsGuesser.php @@ -18,9 +18,9 @@ public function supportObject($object) $object->getItems() instanceof Schema || ( - is_array($object->getItems()) + \is_array($object->getItems()) && - count($object->getItems()) > 0 + \count($object->getItems()) > 0 ) ) ; diff --git a/Guesser/OpenApiSchema/MultipleGuesser.php b/Guesser/OpenApiSchema/MultipleGuesser.php index 79d8b6b..a068f86 100644 --- a/Guesser/OpenApiSchema/MultipleGuesser.php +++ b/Guesser/OpenApiSchema/MultipleGuesser.php @@ -12,6 +12,6 @@ class MultipleGuesser extends BaseMultipleGuesser */ public function supportObject($object) { - return ($object instanceof Schema) && is_array($object->getType()); + return ($object instanceof Schema) && \is_array($object->getType()); } } diff --git a/Guesser/OpenApiSchema/SimpleTypeGuesser.php b/Guesser/OpenApiSchema/SimpleTypeGuesser.php index b9341eb..180fbe4 100644 --- a/Guesser/OpenApiSchema/SimpleTypeGuesser.php +++ b/Guesser/OpenApiSchema/SimpleTypeGuesser.php @@ -14,9 +14,9 @@ public function supportObject($object) { return ($object instanceof Schema) && - in_array($object->getType(), $this->typesSupported) + \in_array($object->getType(), $this->typesSupported) && - !in_array($object->getFormat(), $this->excludeFormat) + !\in_array($object->getFormat(), $this->excludeFormat) ; } } diff --git a/Naming/OperationUrlNaming.php b/Naming/OperationUrlNaming.php index 6bda1ea..ffaed03 100644 --- a/Naming/OperationUrlNaming.php +++ b/Naming/OperationUrlNaming.php @@ -59,11 +59,11 @@ function ($match) { } } else { $methodNameParts[] = ucfirst($part); - $lastNonParameterPartIndex = count($methodNameParts) - 1; + $lastNonParameterPartIndex = \count($methodNameParts) - 1; } } - if ($shouldSingularize && count($methodNameParts) > 0) { + if ($shouldSingularize && \count($methodNameParts) > 0) { $methodNameParts[$lastNonParameterPartIndex] = Inflector::singularize($methodNameParts[$lastNonParameterPartIndex]); } diff --git a/Tests/JaneOpenApiResourceTest.php b/Tests/JaneOpenApiResourceTest.php index d63ebe0..6b4578f 100644 --- a/Tests/JaneOpenApiResourceTest.php +++ b/Tests/JaneOpenApiResourceTest.php @@ -40,7 +40,7 @@ public function testRessources($name, SplFileInfo $testDirectory) $generatedData = []; - $this->assertEquals(count($expectedFinder), count($generatedFinder), 'Assert same files for ' . $testDirectory->getRealPath()); + $this->assertEquals(\count($expectedFinder), \count($generatedFinder), 'Assert same files for ' . $testDirectory->getRealPath()); foreach ($generatedFinder as $generatedFile) { $generatedData[$generatedFile->getRelativePathname()] = $generatedFile->getRealPath();