Skip to content

Commit 8a570b8

Browse files
committed
Add deprecated support to properties
Fixed some phpdocs code style
1 parent 6559640 commit 8a570b8

28 files changed

Lines changed: 131 additions & 366 deletions

src/Components/Contact.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ class Contact implements JsonSerializable
1010

1111
private $name, $url, $email;
1212

13-
/**
14-
* Contact constructor.
15-
*
16-
* @param string $name
17-
* @param string $url
18-
* @param string $email
19-
*/
2013
public function __construct(string $name, string $url, string $email)
2114
{
2215

@@ -25,16 +18,7 @@ public function __construct(string $name, string $url, string $email)
2518
$this->email = $email;
2619
}
2720

28-
29-
/**
30-
* Specify data which should be serialized to JSON
31-
*
32-
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
33-
* @return mixed data which can be serialized by <b>json_encode</b>,
34-
* which is a value of any type other than a resource.
35-
* @since 5.4.0
36-
*/
37-
public function jsonSerialize()
21+
public function jsonSerialize(): array
3822
{
3923

4024
return [

src/Components/Endpoint.php

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ class Endpoint implements JsonSerializable
4747
/**
4848
* Endpoint constructor.
4949
*
50-
* @param string $httpMethod
51-
* @param string $summary
52-
* @param string $description
53-
* @param Response[] $responses
50+
* @param string $httpMethod
51+
* @param string $summary
52+
* @param string $description
53+
* @param Response[] $responses
5454
* @param Parameter[]|null $parameters
5555
*/
5656
private function __construct(string $httpMethod, string $summary, string $description, array $responses,
57-
?array $parameters = null
57+
?array $parameters = null
5858
)
5959
{
6060

@@ -198,38 +198,27 @@ public function withRequestBodyFromEntity(string $class, string $contentType = s
198198

199199
}
200200

201-
/**
202-
* @return string
203-
*/
204201
final public function getHttpMethod(): string
205202
{
206203

207204
return $this->httpMethod;
208205
}
209206

210207
/**
211-
* @return array|Response[]
208+
* @return Response[]
212209
*/
213-
final public function getResponses()
210+
final public function getResponses(): array
214211
{
215212

216213
return $this->responses;
217214
}
218215

219-
/**
220-
* Specify data which should be serialized to JSON
221-
*
222-
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
223-
* @return mixed data which can be serialized by <b>json_encode</b>,
224-
* which is a value of any type other than a resource.
225-
* @since 5.4.0
226-
*/
227-
public function jsonSerialize()
216+
public function jsonSerialize(): array
228217
{
229218

230219
$return = [
231-
'tags' => [$this->tag],
232-
'summary' => $this->summary,
220+
'tags' => [$this->tag],
221+
'summary' => $this->summary,
233222
'operationId' => strtolower(
234223
str_replace(
235224
' ',
@@ -356,7 +345,7 @@ public function jsonSerialize()
356345

357346
$return['requestBody'] = [
358347
'required' => true,
359-
'content' => []
348+
'content' => []
360349
];
361350

362351
$contentTypes = [];

src/Components/ExternalDocs.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,14 @@ class ExternalDocs implements JsonSerializable
1010

1111
private $url, $description;
1212

13-
/**
14-
* ExternalDocs constructor.
15-
*
16-
* @param string $url
17-
* @param string|null $description
18-
*/
1913
public function __construct(string $url, ?string $description)
2014
{
2115

2216
$this->url = $url;
2317
$this->description = $description;
2418
}
2519

26-
27-
/**
28-
* Specify data which should be serialized to JSON
29-
*
30-
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
31-
* @return mixed data which can be serialized by <b>json_encode</b>,
32-
* which is a value of any type other than a resource.
33-
* @since 5.4.0
34-
*/
35-
public function jsonSerialize()
20+
public function jsonSerialize(): array
3621
{
3722

3823
$return = [

src/Components/Header.php

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,8 @@ class Header implements JsonSerializable
1111

1212
const LOCATION = 'Location';
1313

14-
private $header, $value;
15-
/**
16-
* @var string
17-
*/
18-
private $description;
19-
20-
/**
21-
* Header constructor.
22-
*
23-
* @param string $header
24-
* @param string $description
25-
* @param Base $value
26-
*/
14+
private $header, $value, $description;
15+
2716
public function __construct(string $header, string $description, Base $value)
2817
{
2918

@@ -32,24 +21,13 @@ public function __construct(string $header, string $description, Base $value)
3221
$this->description = $description;
3322
}
3423

35-
/**
36-
* @return string
37-
*/
3824
public function getHeader(): string
3925
{
4026

4127
return $this->header;
4228
}
4329

44-
/**
45-
* Specify data which should be serialized to JSON
46-
*
47-
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
48-
* @return mixed data which can be serialized by <b>json_encode</b>,
49-
* which is a value of any type other than a resource.
50-
* @since 5.4.0
51-
*/
52-
public function jsonSerialize()
30+
public function jsonSerialize(): array
5331
{
5432

5533
return [

src/Components/Info.php

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,8 @@ class Info implements JsonSerializable
1010

1111
private $title, $description, $termsOfService, $contact, $license, $version, $logo;
1212

13-
/**
14-
* Info constructor.
15-
*
16-
* @param string $title
17-
* @param string $version
18-
* @param string|null $description
19-
* @param string|null $termsOfService
20-
* @param Contact|null $contact
21-
* @param License|null $license
22-
* @param string|null $logo
23-
*/
2413
public function __construct(string $title, string $version, ?string $description = null,
25-
?string $termsOfService = null, ?Contact $contact = null, ?License $license = null, ?string $logo = null
14+
?string $termsOfService = null, ?Contact $contact = null, ?License $license = null, ?string $logo = null
2615
)
2716
{
2817

@@ -35,79 +24,49 @@ public function __construct(string $title, string $version, ?string $description
3524
$this->logo = $logo;
3625
}
3726

38-
/**
39-
* @return string
40-
*/
4127
final public function getTitle(): string
4228
{
4329

4430
return $this->title;
4531
}
4632

47-
/**
48-
* @return string|null
49-
*/
5033
final public function getDescription(): ?string
5134
{
5235

5336
return $this->description;
5437
}
5538

56-
/**
57-
* @return string|null
58-
*/
5939
final public function getTermsOfService(): ?string
6040
{
6141

6242
return $this->termsOfService;
6343
}
6444

65-
/**
66-
* @return Contact|null
67-
*/
6845
final public function getContact(): ?Contact
6946
{
7047

7148
return $this->contact;
7249
}
7350

74-
/**
75-
* @return License|null
76-
*/
7751
final public function getLicense(): ?License
7852
{
7953

8054
return $this->license;
8155
}
8256

83-
/**
84-
* @return string
85-
*/
8657
final public function getVersion(): string
8758
{
8859

8960
return $this->version;
9061
}
9162

92-
/**
93-
* @return string|null
94-
*/
9563
final public function getLogo(): ?string
9664
{
9765

9866
return $this->logo;
9967
}
10068

101-
102-
/**
103-
* Specify data which should be serialized to JSON
104-
*
105-
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
106-
* @return mixed data which can be serialized by <b>json_encode</b>,
107-
* which is a value of any type other than a resource.
108-
* @since 5.4.0
109-
*/
110-
public function jsonSerialize()
69+
public function jsonSerialize(): array
11170
{
11271

11372
$return = [

src/Components/License.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,14 @@ class License implements JsonSerializable
1010

1111
private $name, $url;
1212

13-
/**
14-
* License constructor.
15-
*
16-
* @param string $name
17-
* @param string|null $url
18-
*/
1913
public function __construct(string $name, ?string $url)
2014
{
2115

2216
$this->name = $name;
2317
$this->url = $url;
2418
}
2519

26-
27-
/**
28-
* Specify data which should be serialized to JSON
29-
*
30-
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
31-
* @return mixed data which can be serialized by <b>json_encode</b>,
32-
* which is a value of any type other than a resource.
33-
* @since 5.4.0
34-
*/
35-
public function jsonSerialize()
20+
public function jsonSerialize(): array
3621
{
3722

3823
$return = [

src/Components/OpenAPI.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class OpenAPI implements JsonSerializable
3737
/**
3838
* Root constructor.
3939
*
40-
* @param string $openApi
41-
* @param Info $info
42-
* @param Server[] $servers
40+
* @param string $openApi
41+
* @param Info $info
42+
* @param Server[] $servers
4343
* @param SecurityScheme[]|null $security
4444
*/
4545
public function __construct(string $openApi, Info $info, array $servers, ?array $security)
@@ -83,7 +83,7 @@ final public function addSection(Section $section)
8383
*
8484
* @param RequiredSecurityScheme|RequiredSecurityScheme[]
8585
*/
86-
final public function addRequiredSecuritySchemes($securitySchemes)
86+
final public function addRequiredSecuritySchemes($securitySchemes): void
8787
{
8888

8989
if (is_array($securitySchemes)) {
@@ -109,19 +109,11 @@ final public function addRequiredSecuritySchemes($securitySchemes)
109109
$this->requiredSecuritySchemes[] = $securitySchemes;
110110
}
111111

112-
/**
113-
* Specify data which should be serialized to JSON
114-
*
115-
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
116-
* @return mixed data which can be serialized by <b>json_encode</b>,
117-
* which is a value of any type other than a resource.
118-
* @since 5.4.0
119-
*/
120-
public function jsonSerialize()
112+
public function jsonSerialize(): array
121113
{
122114

123115
$return = [
124-
'openapi' => '3.0.0',
116+
'openapi' => $this->openApi,
125117
'servers' => $this->servers,
126118
'info' => $this->info,
127119
'tags' => [],

src/Components/Parameter.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ class Parameter implements JsonSerializable
1414

1515
private $name, $type, $description, $isRequired, $schema;
1616

17-
/**
18-
* Parameter constructor.
19-
*
20-
* @param $name
21-
* @param $type
22-
* @param $description
23-
* @param $isRequired
24-
* @param $schema
25-
*/
2617
private function __construct(string $name, string $type, string $description, bool $isRequired, Base $schema)
2718
{
2819

@@ -50,15 +41,7 @@ final public static function path(string $name, string $description, Base $schem
5041
);
5142
}
5243

53-
/**
54-
* Specify data which should be serialized to JSON
55-
*
56-
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
57-
* @return mixed data which can be serialized by <b>json_encode</b>,
58-
* which is a value of any type other than a resource.
59-
* @since 5.4.0
60-
*/
61-
public function jsonSerialize()
44+
public function jsonSerialize(): array
6245
{
6346

6447
$return = [

0 commit comments

Comments
 (0)