Skip to content

Commit baf4007

Browse files
committed
fix phpstan RC2
1 parent 71a0e29 commit baf4007

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

src/OpenApi/OpenApi.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ public function buildByClass(string $className): void
4545
continue;
4646
}
4747

48-
$routeDoc = $summaryDoc = $requestBodyDoc = $responseDoc = $headersDoc = null;
4948
$instances = [
50-
Route::class => &$routeDoc,
51-
Summary::class => &$summaryDoc,
52-
RequestBody::class => &$requestBodyDoc,
53-
Response::class => &$responseDoc,
54-
Headers::class => &$headersDoc,
49+
Route::class => null,
50+
Summary::class => null,
51+
RequestBody::class => null,
52+
Response::class => null,
53+
Headers::class => null,
5554
];
5655

5756
foreach ($methodAttributes as $methodAttribute) {
@@ -61,7 +60,7 @@ public function buildByClass(string $className): void
6160
}
6261
}
6362

64-
if (! $routeDoc || ! $summaryDoc) {
63+
if ($instances[Route::class] === null || $instances[Summary::class] === null) {
6564
continue;
6665
}
6766

@@ -70,20 +69,15 @@ public function buildByClass(string $className): void
7069
methodName: $item->getName(),
7170
reflectionMethod: $item,
7271
tag: $tagDoc,
73-
summary: $summaryDoc,
74-
route: $routeDoc,
75-
headers: $headersDoc,
72+
summary: $instances[Summary::class],
73+
route: $instances[Route::class],
74+
headers: $instances[Headers::class],
7675
attributes: $methodAttributes,
77-
requestBody: $requestBodyDoc,
78-
response: $responseDoc,
76+
requestBody: $instances[RequestBody::class],
77+
response: $instances[Response::class],
7978
);
8079

81-
8280
self::$OpenAPI->addPath($openApiCollection);
8381
}
8482
}
85-
86-
87-
88-
8983
}

src/OpenApi/Storage/OpenAPI/SchemaStorage.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function getData(): array
3535
*
3636
* @param array<ParameterCollection> $parameterTree 参数集合树
3737
* @param array|null $currentNode 当前构建节点的引用
38+
* @param-out array $currentNode 当前构建节点的引用
3839
* @return static
3940
*/
4041
public function build(array $parameterTree, array &$currentNode = null): static

0 commit comments

Comments
 (0)