Skip to content

Commit

Permalink
PHPStan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
petrparolek authored and paveljanda committed Jun 3, 2021
1 parent b688a00 commit 9dcd106
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<element key="src" value="Contributte\ApiDocu"/>
</property>
</properties>

<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable" />
</rule>

<!-- Exclude folders -->
Expand Down
11 changes: 10 additions & 1 deletion src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

use Contributte\ApiRouter\ApiRoute;
use Nette\Application\IRouter;
use Nette\Application\Routers\RouteList;
use Nette\Application\UI\ITemplateFactory;
use Nette\Bridges\ApplicationLatte\DefaultTemplate;
use Nette\Bridges\ApplicationLatte\Template;
use Nette\Http;
use Tracy\Debugger;
Expand Down Expand Up @@ -80,6 +82,7 @@ public function generateAll(IRouter $router): void

public function generateTarget(ApiRoute $route, array $parameters): void
{
/** @var DefaultTemplate $template */
$template = $this->createTemplate('api_docu_matched.latte');

$template->setParameters([
Expand All @@ -98,6 +101,7 @@ public function generateTarget(ApiRoute $route, array $parameters): void

public function generateOne(ApiRoute $route, array $sections, string $fileName): void
{
/** @var DefaultTemplate $template */
$template = $this->createTemplate('api_docu_one.latte');

$template->setParameters([
Expand All @@ -114,6 +118,7 @@ public function generateOne(ApiRoute $route, array $sections, string $fileName):

public function generateIndex(array $sections): void
{
/** @var DefaultTemplate $template */
$template = $this->createTemplate('api_docu_index.latte');

$template->setParameters([
Expand All @@ -129,6 +134,7 @@ public function generateIndex(array $sections): void

public function generateSuccess(): void
{
/** @var DefaultTemplate $template */
$template = $this->createTemplate('api_docu_success.latte');

$template->setParameters([
Expand All @@ -145,6 +151,7 @@ public function generateSuccess(): void

public function createTemplate(string $which): Template
{
/** @var DefaultTemplate|null $template */
$template = $this->templateFactory->createTemplate();

if (!$template instanceof Template) {
Expand Down Expand Up @@ -223,7 +230,9 @@ private function getApiRoutesFromIterator(\IteratorAggregate $i): array
{
$return = [];

foreach ($i->getRouters() as $router) {
/** @var RouteList $i */
$routers = $i->getRouters();
foreach ($routers as $router) {
if ($router instanceof ApiRoute) {
$return[] = $router;
} elseif ($router instanceof \IteratorAggregate) {
Expand Down

0 comments on commit 9dcd106

Please sign in to comment.