Skip to content

Commit a68e7e0

Browse files
committed
composer test
1 parent d18911a commit a68e7e0

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Swagger/SwaggerComponents.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SwaggerComponents
2626
public function __construct(
2727
protected SwaggerCommon $common,
2828
protected PropertyManager $propertyManager,
29-
protected GenerateProxyClass $generateProxyClass,
29+
protected ?GenerateProxyClass $generateProxyClass,
3030
) {
3131
}
3232

@@ -57,7 +57,7 @@ public function getProperties(string $className): array
5757
$propertyManager = $this->propertyManager->getProperty($className, $fieldName);
5858

5959
// 适配ApiVariable注解
60-
$sourceClassName = $this->generateProxyClass->getSourceClassname($className) ?? $className;
60+
$sourceClassName = $this->generateProxyClass?->getSourceClassname($className) ?? $className;
6161
$apiModelProperty = ApiAnnotation::getProperty($sourceClassName, $fieldName, ApiModelProperty::class) ?: new ApiModelProperty();
6262

6363
/** @var In $inAnnotation */

tests/SwaggerSchemasTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
use Hyperf\Di\Annotation\AnnotationCollector;
1010
use Hyperf\Di\MethodDefinitionCollector;
1111
use Hyperf\Di\MethodDefinitionCollectorInterface;
12-
use Hyperf\DTO\DtoCommon;
1312
use Hyperf\DTO\Scan\PropertyEnum;
1413
use Hyperf\DTO\Scan\PropertyManager;
15-
use Hyperf\DTO\Scan\Scan;
1614
use HyperfTest\ApiDocs\Request\Address;
1715
use HyperfTest\ApiDocs\Request\DemoBodyRequest;
1816
use Mockery as m;
@@ -39,7 +37,7 @@ public function testSchemas()
3937
// dto
4038
$container->shouldReceive('get')->with(MethodDefinitionCollectorInterface::class)->andReturn(new MethodDefinitionCollector());
4139
$swaggerCommon = new SwaggerCommon();
42-
$swaggerComponents = new SwaggerComponents($swaggerCommon,new PropertyManager($swaggerCommon,new PropertyEnum()));
40+
$swaggerComponents = new SwaggerComponents($swaggerCommon, new PropertyManager($swaggerCommon, new PropertyEnum()), null);
4341
$schemas = $swaggerComponents->generateSchemas($classname);
4442
$properties = $schemas->properties;
4543
$this->assertEquals($properties[0]->property, 'int');

0 commit comments

Comments
 (0)