From a1541cf97c3dbf79df7e6d77b0baf1686d56007c Mon Sep 17 00:00:00 2001 From: romalytvynenko Date: Wed, 27 Sep 2023 20:07:52 +0000 Subject: [PATCH] Fix styling --- src/Infer/Services/ReferenceTypeResolver.php | 5 ++--- .../RulesExtractor/ValidateCallExtractor.php | 6 +++--- tests/Infer/Services/ConstFetchTypeGetterTest.php | 3 ++- tests/Infer/Services/ReferenceTypeResolverTest.php | 1 - 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Infer/Services/ReferenceTypeResolver.php b/src/Infer/Services/ReferenceTypeResolver.php index de3cd8b3..0d31e67a 100644 --- a/src/Infer/Services/ReferenceTypeResolver.php +++ b/src/Infer/Services/ReferenceTypeResolver.php @@ -35,7 +35,6 @@ use Dedoc\Scramble\Support\Type\Union; use Dedoc\Scramble\Support\Type\UnknownType; use Illuminate\Support\Str; -use function Pest\Laravel\instance; class ReferenceTypeResolver { @@ -341,7 +340,7 @@ private function resolveNewCallReferenceType(Scope $scope, NewCallReferenceType } $propertyDefaultTemplateTypes = collect($classDefinition->properties) - ->filter(fn (ClassPropertyDefinition $definition) => $definition->type instanceof TemplateType && !! $definition->defaultType) + ->filter(fn (ClassPropertyDefinition $definition) => $definition->type instanceof TemplateType && (bool) $definition->defaultType) ->mapWithKeys(fn (ClassPropertyDefinition $definition) => [ $definition->type->name => $definition->defaultType, ]); @@ -549,7 +548,7 @@ private function resolveTypesTemplatesFromArguments($templates, $templatedArgume private function resolveClassName(Scope $scope, string $name): ?string { - if (!in_array($name, StaticReference::KEYWORDS)) { + if (! in_array($name, StaticReference::KEYWORDS)) { return $name; } diff --git a/src/Support/OperationExtensions/RulesExtractor/ValidateCallExtractor.php b/src/Support/OperationExtensions/RulesExtractor/ValidateCallExtractor.php index afa53296..5af14725 100644 --- a/src/Support/OperationExtensions/RulesExtractor/ValidateCallExtractor.php +++ b/src/Support/OperationExtensions/RulesExtractor/ValidateCallExtractor.php @@ -81,9 +81,9 @@ public function extract(RouteInfo $routeInfo) if ($validationRules) { $type = $routeInfo->getMethodScopeTypeResolver()->getType($validationRules); -// dump([ -// $routeInfo->className().'@'.$routeInfo->methodName() => $type->toString(), -// ]); + // dump([ + // $routeInfo->className().'@'.$routeInfo->methodName() => $type->toString(), + // ]); } if ($validationRules) { diff --git a/tests/Infer/Services/ConstFetchTypeGetterTest.php b/tests/Infer/Services/ConstFetchTypeGetterTest.php index 22b76ed8..aace32d4 100644 --- a/tests/Infer/Services/ConstFetchTypeGetterTest.php +++ b/tests/Infer/Services/ConstFetchTypeGetterTest.php @@ -8,6 +8,7 @@ expect($type->toString())->toBe('array{0: string(foo), 1: string(bar)}'); }); -class ConstFetchTypeGetterTest_Foo { +class ConstFetchTypeGetterTest_Foo +{ const ARRAY = ['foo', 'bar']; } diff --git a/tests/Infer/Services/ReferenceTypeResolverTest.php b/tests/Infer/Services/ReferenceTypeResolverTest.php index b32f1e89..97afffe9 100644 --- a/tests/Infer/Services/ReferenceTypeResolverTest.php +++ b/tests/Infer/Services/ReferenceTypeResolverTest.php @@ -88,7 +88,6 @@ ['newParentCall', 'Dedoc\Scramble\Tests\Infer\Services\StaticCallsClasses\Foo'], ]); - it('complex static call and property fetch', function () { $type = getStatementType('Dedoc\Scramble\Tests\Infer\Services\StaticCallsClasses\Bar::wow()');