Skip to content

Commit aae76e1

Browse files
committed
Upgrade to hyperf 3.0.0
1 parent 19dc775 commit aae76e1

7 files changed

Lines changed: 12 additions & 13 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"support": {
1212
},
1313
"require": {
14-
"php": ">=7.3",
15-
"hyperf-plus/route": "^2.1.0"
14+
"php": ">=8.0",
15+
"hyperf-plus/route": "^3.0.0"
1616
},
1717
"require-dev": {
1818
},

src/Annotation/ApiDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
namespace HPlus\Swagger\Annotation;
55

66
use Hyperf\Di\Annotation\AbstractAnnotation;
7-
87
/**
98
* @Annotation
109
* @Target({"ALL"})
1110
*/
11+
#[Attribute(Attribute::TARGET_ALL)]
1212
class ApiDefinition extends AbstractAnnotation
1313
{
1414
public $name;

src/Annotation/ApiDefinitions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
namespace HPlus\Swagger\Annotation;
55

66
use Hyperf\Di\Annotation\AbstractAnnotation;
7-
87
/**
98
* @Annotation
109
* @Target({"CLASS"})
1110
*/
11+
#[Attribute(Attribute::TARGET_CLASS)]
1212
class ApiDefinitions extends AbstractAnnotation
1313
{
1414
/**

src/Annotation/ApiServer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
namespace HPlus\Swagger\Annotation;
44

55
use Hyperf\Di\Annotation\AbstractAnnotation;
6-
76
/**
87
* @Annotation
98
* @Target({"CLASS"})
109
*/
10+
#[Attribute(Attribute::TARGET_CLASS)]
1111
class ApiServer extends AbstractAnnotation
1212
{
1313
public $name;

src/Annotation/ApiVersion.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @Annotation
99
* @Target({"CLASS"})
1010
*/
11+
#[Attribute(Attribute::TARGET_CLASS)]
1112
class ApiVersion extends AbstractAnnotation
1213
{
1314
public $version;

src/Swagger.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22

3-
declare(strict_types=1);
4-
3+
declare (strict_types=1);
54
namespace HPlus\Swagger;
65

76
use GuzzleHttp\Psr7\Stream;
@@ -10,24 +9,23 @@
109
use Hyperf\HttpServer\Contract\ResponseInterface;
1110
use Hyperf\Utils\ApplicationContext;
1211
use Psr\Http\Message\StreamInterface;
13-
14-
1512
/**
1613
* @\Hyperf\HttpServer\Annotation\AutoController(prefix="/swagger")
1714
* Class SwaggerController
1815
*/
16+
#[\Hyperf\HttpServer\Annotation\AutoController(prefix: '/swagger')]
1917
class Swagger
2018
{
2119
/**
2220
* @var ConfigInterface $config
2321
*/
2422
protected $config;
25-
23+
2624
public function __construct()
2725
{
2826
$this->config = ApplicationContext::getContainer()->get(ConfigInterface::class);
2927
}
30-
28+
3129
public function index()
3230
{
3331
if (!$this->config->get('swagger.enable', false)) {
@@ -98,7 +96,7 @@ public function index()
9896
';
9997
return $res->withBody(new SwooleStream($html))->withHeader('content-type', 'text/html; charset=utf8');
10098
}
101-
99+
102100
public function api()
103101
{
104102
if (!$this->config->get('swagger.enable', false)) {

src/Swagger/SwaggerJson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function addPath($className, $methodName, $path)
8686
}
8787
if ($option->dateType == 'form') {
8888
foreach ($this->getValidateRule($option) as $key => $item) {
89-
$param = new FormData();
89+
$param = new FormData("");
9090
list($key, $name) = explode('|', $key);
9191
$param->key = $key;
9292
$param->name = $name;

0 commit comments

Comments
 (0)