Skip to content

Commit

Permalink
Fixed failing unit tests
Browse files Browse the repository at this point in the history
SwaggerBake\Test\TestCase\Lib\SwaggerEntityTest::testEntityExists
Error: Call to a member function hasTag() on null
  • Loading branch information
cnizzardini committed Apr 18, 2020
1 parent 51324f1 commit 511f5f8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Lib/Factory/PathFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function create() : ?Path
Inflector::humanize(Inflector::underscore($defaults['controller']))
])
->setParameters($this->getPathParameters())
->setDeprecated($this->dockBlock->hasTag('deprecated'))
->setDeprecated($this->isDeprecated())
;

$externalDoc = $this->getExternalDoc();
Expand Down Expand Up @@ -204,8 +204,21 @@ private function isSwaggable(string $className) : bool
return true;
}

private function isDeprecated() : bool
{
if (!$this->dockBlock || !$this->dockBlock instanceof DocBlock) {
return false;
}

return $this->dockBlock->hasTag('deprecated');
}

private function getExternalDoc() : ?OperationExternalDoc
{
if (!$this->dockBlock || !$this->dockBlock instanceof DocBlock) {
return null;
}

if (!$this->dockBlock->hasTag('see')) {
return null;
}
Expand Down

0 comments on commit 511f5f8

Please sign in to comment.