diff --git a/src/Collection.php b/src/Collection.php index e27c30e..8b41650 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -7,6 +7,7 @@ namespace ZF\Hal; use Traversable; +use Zend\Paginator\Paginator; use Zend\Stdlib\ArrayUtils; /** @@ -24,7 +25,7 @@ class Collection implements Link\LinkCollectionAwareInterface protected $attributes = []; /** - * @var array|Traversable|\Zend\Paginator\Paginator + * @var array|Traversable|Paginator */ protected $collection; @@ -99,7 +100,7 @@ class Collection implements Link\LinkCollectionAwareInterface protected $entityRouteParams = []; /** - * @param array|Traversable|\Zend\Paginator\Paginator $collection + * @param array|Traversable|Paginator $collection * @param string $entityRoute * @param array|Traversable $entityRouteParams * @param array|Traversable $entityRouteOptions @@ -491,7 +492,7 @@ public function getAttributes() /** * Collection * - * @return array|Traversable|\Zend\Paginator\Paginator + * @return array|Traversable|Paginator */ public function getCollection() { diff --git a/src/Factory/HalViewHelperFactory.php b/src/Factory/HalViewHelperFactory.php index 659d1fa..2fad790 100644 --- a/src/Factory/HalViewHelperFactory.php +++ b/src/Factory/HalViewHelperFactory.php @@ -7,6 +7,8 @@ namespace ZF\Hal\Factory; use Interop\Container\ContainerInterface; +use Zend\Hydrator\HydratorInterface; +use Zend\Hydrator\HydratorPluginManager; use Zend\ServiceManager\AbstractPluginManager; use ZF\Hal\Exception; use ZF\Hal\Extractor\LinkCollectionExtractor; @@ -28,6 +30,8 @@ public function __invoke(ContainerInterface $container) /* @var $rendererOptions \ZF\Hal\RendererOptions */ $rendererOptions = $container->get('ZF\Hal\RendererOptions'); $metadataMap = $container->get('ZF\Hal\MetadataMap'); + + /** @var HydratorPluginManager $hydrators */ $hydrators = $metadataMap->getHydratorManager(); $helper = new Plugin\Hal($hydrators); @@ -48,6 +52,7 @@ public function __invoke(ContainerInterface $container) )); } + /** @var HydratorInterface $hydrator */ $hydrator = $hydrators->get($defaultHydrator); $helper->setDefaultHydrator($hydrator); } diff --git a/src/Factory/LinkUrlBuilderFactory.php b/src/Factory/LinkUrlBuilderFactory.php index 8ae2814..20adc4c 100644 --- a/src/Factory/LinkUrlBuilderFactory.php +++ b/src/Factory/LinkUrlBuilderFactory.php @@ -6,6 +6,7 @@ namespace ZF\Hal\Factory; +use Zend\View\Helper\ServerUrl; use ZF\Hal\Link\LinkUrlBuilder; class LinkUrlBuilderFactory @@ -20,6 +21,7 @@ public function __invoke($container) $viewHelperManager = $container->get('ViewHelperManager'); + /** @var ServerUrl $serverUrlHelper */ $serverUrlHelper = $viewHelperManager->get('ServerUrl'); if (isset($halConfig['options']['use_proxy'])) { $serverUrlHelper->setUseProxy($halConfig['options']['use_proxy']); diff --git a/src/Link/PaginationInjectorInterface.php b/src/Link/PaginationInjectorInterface.php index 9ba73f0..9de0c5e 100644 --- a/src/Link/PaginationInjectorInterface.php +++ b/src/Link/PaginationInjectorInterface.php @@ -6,6 +6,7 @@ namespace ZF\Hal\Link; +use ZF\ApiProblem\ApiProblem; use ZF\Hal\Collection; interface PaginationInjectorInterface diff --git a/src/Link/SelfLinkInjector.php b/src/Link/SelfLinkInjector.php index 3dffcdd..94565cd 100644 --- a/src/Link/SelfLinkInjector.php +++ b/src/Link/SelfLinkInjector.php @@ -6,7 +6,6 @@ namespace ZF\Hal\Link; -use ZF\Hal\Link\LinkCollectionAwareInterface; use ZF\Hal\Collection; use ZF\Hal\Entity; diff --git a/src/Link/SelfLinkInjectorInterface.php b/src/Link/SelfLinkInjectorInterface.php index 5e832fb..1451969 100644 --- a/src/Link/SelfLinkInjectorInterface.php +++ b/src/Link/SelfLinkInjectorInterface.php @@ -6,8 +6,6 @@ namespace ZF\Hal\Link; -use ZF\Hal\Link\LinkCollectionAwareInterface; - interface SelfLinkInjectorInterface { /** diff --git a/src/Module.php b/src/Module.php index 01435a9..0a47c8f 100644 --- a/src/Module.php +++ b/src/Module.php @@ -6,6 +6,7 @@ namespace ZF\Hal; +use Zend\Mvc\ApplicationInterface; use Zend\Mvc\MvcEvent; use ZF\Hal\View\HalJsonStrategy; @@ -30,7 +31,9 @@ public function getConfig() */ public function onBootstrap(MvcEvent $e) { - $events = $e->getTarget()->getEventManager(); + /** @var ApplicationInterface $application */ + $application = $e->getTarget(); + $events = $application->getEventManager(); $events->attach(MvcEvent::EVENT_RENDER, [$this, 'onRender'], 100); } @@ -48,11 +51,14 @@ public function onRender(MvcEvent $e) return; } - $services = $e->getTarget()->getServiceManager(); + /** @var Application $application */ + $application = $e->getTarget(); + $services = $application->getServiceManager(); $events = $services->get('View')->getEventManager(); // register at high priority, to "beat" normal json strategy registered // via view manager + /** @var HalJsonStrategy $halStrategy */ $halStrategy = $services->get('ZF\Hal\JsonStrategy'); $halStrategy->attach($events, 200); } diff --git a/src/Plugin/Hal.php b/src/Plugin/Hal.php index ef5c69c..c4a5d21 100644 --- a/src/Plugin/Hal.php +++ b/src/Plugin/Hal.php @@ -8,6 +8,7 @@ use ArrayObject; use Countable; +use Traversable; use Zend\EventManager\Event; use Zend\EventManager\EventInterface; use Zend\EventManager\EventManagerAwareInterface; @@ -941,7 +942,7 @@ public function createCollection($collection, $route = null) } /** - * @param object $object + * @param array|Traversable|Paginator $object * @param Metadata $metadata * @return Collection */ diff --git a/src/RendererOptions.php b/src/RendererOptions.php index 96a9257..7870669 100644 --- a/src/RendererOptions.php +++ b/src/RendererOptions.php @@ -87,7 +87,7 @@ public function setHydrators(array $hydrators) } /** - * @return string + * @return array */ public function getHydrators() { diff --git a/src/ResourceFactory.php b/src/ResourceFactory.php index 5bcd2d8..55e83be 100644 --- a/src/ResourceFactory.php +++ b/src/ResourceFactory.php @@ -7,8 +7,8 @@ namespace ZF\Hal; use Closure; -use ZF\Hal\Collection; -use ZF\Hal\Entity; +use Traversable; +use Zend\Paginator\Paginator; use ZF\Hal\Extractor\EntityExtractor; use ZF\Hal\Exception; use ZF\Hal\Link\Link; @@ -40,7 +40,7 @@ public function __construct(EntityHydratorManager $entityHydratorManager, Entity /** * Create a entity and/or collection based on a metadata map * - * @param object $object + * @param object|array|Traversable|Paginator $object * @param Metadata $metadata * @param bool $renderEmbeddedEntities * @return Entity|Collection @@ -89,7 +89,7 @@ public function createEntityFromMetadata($object, Metadata $metadata, $renderEmb } /** - * @param object $object + * @param array|Traversable|Paginator $object * @param Metadata $metadata * @return Collection */