diff --git a/Controller/StreamController.php b/Controller/StreamController.php index f96e664..49940fa 100644 --- a/Controller/StreamController.php +++ b/Controller/StreamController.php @@ -1,4 +1,4 @@ -attributes->get('_route_params'); $this->setModifiedSince($request); @@ -47,7 +47,7 @@ public function indexAction(Request $request, FeedContentProviderInterface $prov * * @return \DateTime */ - protected function getModifiedSince() + protected function getModifiedSince() : \DateTime { if (is_null($this->since)) { $this->since = new \DateTime('@0'); @@ -61,7 +61,7 @@ protected function getModifiedSince() * * @return $this */ - protected function setModifiedSince(Request $request) + protected function setModifiedSince(Request $request) : self { $this->since = new \DateTime(); if ($request->headers->has('If-Modified-Since')) { @@ -88,7 +88,7 @@ protected function setModifiedSince(Request $request) * * @throws \Exception */ - protected function createStreamResponse(array $options, $format, FeedContentProviderInterface $provider, FeedIo $feedIo) + protected function createStreamResponse(array $options, string $format, FeedContentProviderInterface $provider, FeedIo $feedIo) : Response { $content = $this->getContent($options, $provider); @@ -110,7 +110,7 @@ protected function createStreamResponse(array $options, $format, FeedContentProv * @param string $format * @return $this */ - protected function setFeedHeaders(Response $response, FeedInterface $feed, $format) + protected function setFeedHeaders(Response $response, FeedInterface $feed, string $format) : self { $contentType = 'json' == $format ? @@ -140,7 +140,7 @@ protected function setFeedHeaders(Response $response, FeedInterface $feed, $form * * @throws \Exception */ - protected function getContent(array $options, $provider) + protected function getContent(array $options, FeedContentProviderInterface $provider) : FeedInterface { try { return $provider->getFeedContent($options); @@ -154,7 +154,7 @@ protected function getContent(array $options, $provider) * * @return bool */ - protected function mustForceRefresh() + protected function mustForceRefresh() : bool { return $this->container->getParameter('debril_rss_atom.force_refresh'); } @@ -162,7 +162,7 @@ protected function mustForceRefresh() /** * @return boolean true if the feed must be private */ - protected function isPrivate() + protected function isPrivate() : bool { return $this->container->getParameter('debril_rss_atom.private_feeds'); } diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 1bc7b99..4fe4f80 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -1,4 +1,4 @@ -processConfiguration($configuration, $configs); @@ -56,7 +56,7 @@ public function load(array $configs, ContainerBuilder $container) * @param array $config * @return $this */ - protected function setDateFormats(ContainerBuilder $container, array $config) + protected function setDateFormats(ContainerBuilder $container, array $config) : self { $dateFormats = isset($config['date_formats']) ? array_merge($this->defaultDateFormats, $config['date_formats']): @@ -71,20 +71,20 @@ protected function setDateFormats(ContainerBuilder $container, array $config) } /** - * @param ContainerBuilder $builder + * @param ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container) : void { $this->setDefinition($container, 'logger', 'Psr\Log\NullLogger'); } /** * @param ContainerBuilder $container - * @param $serviceName - * @param $className - * @return $this + * @param string $serviceName + * @param string $className + * @return DebrilRssAtomExtension */ - protected function setDefinition(ContainerBuilder $container, $serviceName, $className) + protected function setDefinition(ContainerBuilder $container, string $serviceName, string $className) : self { if ( ! $container->has($serviceName) ) { $container->setDefinition($serviceName, new Definition($className)); diff --git a/Provider/DoctrineFeedContentProvider.php b/Provider/DoctrineFeedContentProvider.php index a308c4f..1d0ce5b 100644 --- a/Provider/DoctrineFeedContentProvider.php +++ b/Provider/DoctrineFeedContentProvider.php @@ -1,4 +1,4 @@ -repositoryName; } @@ -54,7 +54,7 @@ public function getRepositoryName() * * @return DoctrineFeedContentProvider */ - public function setRepositoryName($repositoryName) + public function setRepositoryName(string $repositoryName) : self { $this->repositoryName = $repositoryName; @@ -68,7 +68,7 @@ public function setRepositoryName($repositoryName) * * @throws FeedNotFoundException */ - public function getFeedContent(array $options) + public function getFeedContent(array $options) : FeedInterface { // fetch feed from data repository $feed = $this->getDoctrine() @@ -96,9 +96,9 @@ public function getDoctrine() /** * @param array $options * - * @return mixed + * @return string */ - public function getIdFromOptions(array $options) + public function getIdFromOptions(array $options) : string { $optionsResolver = new OptionsResolver(); $optionsResolver->setRequired('id'); diff --git a/Provider/FeedContentProviderInterface.php b/Provider/FeedContentProviderInterface.php index 4b0bbda..b9ba3e9 100644 --- a/Provider/FeedContentProviderInterface.php +++ b/Provider/FeedContentProviderInterface.php @@ -1,4 +1,4 @@ - 1); + $options = array('id' => 'some id'); $feed = $this->object->getFeedContent($options); $this->assertInstanceOf('FeedIo\FeedInterface', $feed);