diff --git a/ruleset.xml b/ruleset.xml index 5404410..7a3462d 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -10,6 +10,8 @@ + + diff --git a/src/Generator.php b/src/Generator.php index 035eef4..b51419d 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -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; @@ -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([ @@ -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([ @@ -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([ @@ -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([ @@ -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) { @@ -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) {