Skip to content

Commit e602a78

Browse files
Consistently use Generator::isDefault() where appropriate (#1940) (#1941)
(cherry picked from commit 650fb4a) Co-authored-by: Martin Rademacher <mano@radebatz.net>
1 parent ffa4744 commit e602a78

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

docs/examples/processors/schema-query-parameter/SchemaQueryParameter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __invoke(Analysis $analysis): void
2929
$operations = $analysis->getAnnotationsOfType(Operation::class);
3030

3131
foreach ($operations as $operation) {
32-
if ($operation->x !== Generator::UNDEFINED && array_key_exists(self::REF, $operation->x)) {
32+
if (!Generator::isDefault($operation->x) && array_key_exists(self::REF, $operation->x)) {
3333
if (!is_string($operation->x[self::REF])) {
3434
throw new \InvalidArgumentException('Value of `x.' . self::REF . '` must be a string');
3535
}

src/Annotations/License.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function validate(array $stack = [], array $skip = [], string $ref = '',
9292
$valid = parent::validate($stack, $skip, $ref, $context);
9393

9494
if (!$this->_context->isVersion('3.0.x')) {
95-
if (!Generator::isDefault($this->url) && $this->identifier !== Generator::UNDEFINED) {
95+
if (!Generator::isDefault($this->url) && !Generator::isDefault($this->identifier)) {
9696
$this->_context->logger->warning($this->identity() . ' url and identifier are mutually exclusive');
9797
$valid = false;
9898
}

src/Processors/Concerns/DocblockTrait.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function parseDocblock(?string $docblock, ?array &$tags = null): string
132132
*/
133133
public function extractCommentSummary(string $content): string
134134
{
135-
if ($content === Generator::UNDEFINED) {
135+
if (Generator::isDefault($content)) {
136136
return Generator::UNDEFINED;
137137
}
138138

@@ -159,12 +159,12 @@ public function extractCommentSummary(string $content): string
159159
*/
160160
public function extractCommentDescription(string $content): string
161161
{
162-
if ($content === Generator::UNDEFINED) {
162+
if (Generator::isDefault($content)) {
163163
return Generator::UNDEFINED;
164164
}
165165

166166
$summary = $this->extractCommentSummary($content);
167-
if ($summary === Generator::UNDEFINED) {
167+
if (Generator::isDefault($summary)) {
168168
return Generator::UNDEFINED;
169169
}
170170

@@ -201,7 +201,7 @@ public function parseVarLine(?string $docblock): array
201201
*/
202202
public function extractExampleDescription(string $docblock): ?string
203203
{
204-
if (!$docblock || $docblock === Generator::UNDEFINED) {
204+
if (!$docblock || Generator::isDefault($docblock)) {
205205
return null;
206206
}
207207

@@ -215,7 +215,7 @@ public function extractExampleDescription(string $docblock): ?string
215215
*/
216216
public function isDeprecated(?string $docblock): bool
217217
{
218-
if (!$docblock || $docblock === Generator::UNDEFINED) {
218+
if (!$docblock || Generator::isDefault($docblock)) {
219219
return false;
220220
}
221221

0 commit comments

Comments
 (0)