Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6 from core23/develop
Browse files Browse the repository at this point in the history
[BUILD] Added more phpstan checks
  • Loading branch information
core23 committed Jul 25, 2019
2 parents 2c79078 + dd07c1a commit f497b6a
Show file tree
Hide file tree
Showing 21 changed files with 2 additions and 161 deletions.
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
includes:
- vendor-bin/phpstan/vendor/jangregor/phpstan-prophecy/src/extension.neon
- vendor-bin/phpstan/vendor/phpstan/phpstan-phpunit/extension.neon
- vendor-bin/phpstan/vendor/phpstan/phpstan-phpunit/rules.neon

parameters:
autoload_files:
Expand Down
6 changes: 0 additions & 6 deletions src/Action/SitemapXMLAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,11 @@ final class SitemapXMLAction
*/
private $generator;

/**
* @param SitemapGeneratorInterface $generator
*/
public function __construct(SitemapGeneratorInterface $generator)
{
$this->generator = $generator;
}

/**
* @return Response
*/
public function __invoke(): Response
{
$response = new Response($this->generator->toXML());
Expand Down
6 changes: 0 additions & 6 deletions src/Definition/DefintionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ public function getAll(): array
return $this->sitemaps;
}

/**
* @param string $code
* @param SitemapDefinitionInterface $sitemap
*
* @return DefintionManagerInterface
*/
private function add(string $code, SitemapDefinitionInterface $sitemap): DefintionManagerInterface
{
$this->sitemaps[$code] = $sitemap;
Expand Down
5 changes: 0 additions & 5 deletions src/Definition/DefintionManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ public function getAll(): array;

/**
* Adds a sitemap definition.
*
* @param string $id
* @param array $configuration
*
* @return self
*/
public function addDefinition(string $id, array $configuration = []): self;
}
7 changes: 0 additions & 7 deletions src/Definition/SitemapDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ final class SitemapDefinition implements SitemapDefinitionInterface
*/
private $type;

/**
* @param string $type
* @param array $settings
*/
public function __construct(string $type, array $settings = [])
{
$this->settings = $settings;
Expand All @@ -41,9 +37,6 @@ public function __toString()
return $this->toString();
}

/**
* @return string
*/
public function toString(): string
{
return $this->getType() ?: 'n/a';
Expand Down
4 changes: 0 additions & 4 deletions src/Definition/SitemapDefinitionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public function getType(): string;

/**
* Returns the block cache TTL.
*
* @return int
*/
public function getTtl(): int;

Expand All @@ -46,8 +44,6 @@ public function getSettings(): array;
*
* @param string $name Key name
* @param mixed|null $default Default value
*
* @return mixed
*/
public function getSetting(string $name, $default = null);
}
4 changes: 0 additions & 4 deletions src/DependencyInjection/Compiler/SitemapCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ public function process(ContainerBuilder $container): void
$this->addStaticUrls($container, $definitionManager);
}

/**
* @param ContainerBuilder $container
* @param Definition $definitionManager
*/
private function addStaticUrls(ContainerBuilder $container, Definition $definitionManager): void
{
foreach ($container->getParameter('core23_sitemap.static_urls') as $options) {
Expand Down
6 changes: 0 additions & 6 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public function getConfigTreeBuilder()
return $treeBuilder;
}

/**
* @param ArrayNodeDefinition $node
*/
private function addCacheSection(ArrayNodeDefinition $node): void
{
$node
Expand All @@ -55,9 +52,6 @@ private function addCacheSection(ArrayNodeDefinition $node): void
;
}

/**
* @param ArrayNodeDefinition $node
*/
private function addStaticUrlsSection(ArrayNodeDefinition $node): void
{
$node
Expand Down
8 changes: 0 additions & 8 deletions src/DependencyInjection/Core23SitemapExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ public function load(array $configs, ContainerBuilder $container): void
$this->configureStaticUrls($container, $config);
}

/**
* @param ContainerBuilder $container
* @param array $config
*/
private function configureCache(ContainerBuilder $container, array $config): void
{
if (null === $config['cache']['service']) {
Expand All @@ -52,10 +48,6 @@ private function configureCache(ContainerBuilder $container, array $config): voi
;
}

/**
* @param ContainerBuilder $container
* @param array $config
*/
private function configureStaticUrls(ContainerBuilder $container, array $config): void
{
$container->setParameter('core23_sitemap.static_urls', $config['static']);
Expand Down
14 changes: 0 additions & 14 deletions src/Generator/SitemapGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ final class SitemapGenerator implements SitemapGeneratorInterface
*/
private $defintionManager;

/**
* @param SitemapServiceManagerInterface $sitemapServiceManager
* @param DefintionManagerInterface $defintionManager
* @param CacheInterface|null $cache
*/
public function __construct(SitemapServiceManagerInterface $sitemapServiceManager, DefintionManagerInterface $defintionManager, CacheInterface $cache = null)
{
$this->sitemapServiceManager = $sitemapServiceManager;
Expand Down Expand Up @@ -78,11 +73,7 @@ public function toXML(): string
/**
* Get eventual cached data or generate whole sitemap.
*
* @param SitemapDefinitionInterface $definition
*
* @throws InvalidArgumentException
*
* @return string
*/
private function fetch(SitemapDefinitionInterface $definition): string
{
Expand Down Expand Up @@ -110,11 +101,6 @@ private function fetch(SitemapDefinitionInterface $definition): string
return $xml;
}

/**
* @param UrlInterface $url
*
* @return string
*/
private function getLocEntry(UrlInterface $url): string
{
return '<url>'.
Expand Down
3 changes: 0 additions & 3 deletions src/Generator/SitemapGeneratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@

interface SitemapGeneratorInterface
{
/**
* @return string
*/
public function toXML(): string;
}
6 changes: 0 additions & 6 deletions src/Model/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ final class Url implements UrlInterface
*/
private $priority;

/**
* @param string $loc
* @param int|null $priority
* @param string|null $changeFreq
* @param \DateTime|null $lastMod
*/
public function __construct(string $loc, ?int $priority = null, ?string $changeFreq = null, ?\DateTime $lastMod = null)
{
$this->loc = $loc;
Expand Down
9 changes: 0 additions & 9 deletions src/Model/UrlInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,14 @@

interface UrlInterface
{
/**
* @return string|null
*/
public function getChangeFreq(): ?string;

/**
* @return \DateTime|null
*/
public function getLastMod(): ?\DateTime;

/**
* @return string
*/
public function getLoc(): ?string;

/**
* @return int|null
*/
public function getPriority(): ?int;
}
14 changes: 0 additions & 14 deletions src/Sitemap/AbstractSitemapService.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ abstract class AbstractSitemapService implements SitemapServiceInterface
*/
private $router;

/**
* @param RouterInterface $router
*/
public function __construct(RouterInterface $router)
{
$this->router = $router;
Expand All @@ -44,24 +41,13 @@ public function configureSettings(OptionsResolver $resolver): void

/**
* @param string $name
* @param array $parameters
* @param int $absolute
*
* @return string
*/
final protected function generate($name, array $parameters = [], $absolute = UrlGeneratorInterface::ABSOLUTE_URL): string
{
return $this->router->generate($name, $parameters, $absolute);
}

/**
* @param string $location
* @param int|null $priority
* @param string|null $changeFreq
* @param \DateTime|null $lastMod
*
* @return UrlInterface
*/
final protected function createEntry(string $location, ?int $priority, ?string $changeFreq = null, ?\DateTime $lastMod = null): UrlInterface
{
return new Url($location, $priority, $changeFreq, $lastMod);
Expand Down
5 changes: 0 additions & 5 deletions src/Sitemap/SitemapServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@

interface SitemapServiceInterface
{
/**
* @param OptionsResolver $resolver
*/
public function configureSettings(OptionsResolver $resolver): void;

/**
* @param SitemapDefinitionInterface $sitemap
*
* @return UrlInterface[]
*/
public function execute(SitemapDefinitionInterface $sitemap): array;
Expand Down
14 changes: 0 additions & 14 deletions src/Sitemap/SitemapServiceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,11 @@ public function addSitemap(string $id, SitemapServiceInterface $service): void
$this->services[$id] = $service;
}

/**
* @param string $id
*
* @return bool
*/
private function has(string $id): bool
{
return isset($this->services[$id]) ? true : false;
}

/**
* @param string $id
*
* @return SitemapServiceInterface
*/
private function getService(string $id): SitemapServiceInterface
{
if (!$this->has($id)) {
Expand All @@ -87,10 +77,6 @@ private function getService(string $id): SitemapServiceInterface
return $this->services[$id];
}

/**
* @param OptionsResolver $resolver
* @param SitemapServiceInterface $sitemap
*/
private function configureSettings(OptionsResolver $resolver, SitemapServiceInterface $sitemap): void
{
$resolver
Expand Down
7 changes: 0 additions & 7 deletions src/Sitemap/SitemapServiceManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@ interface SitemapServiceManagerInterface
{
/**
* Return the block service linked to the link.
*
* @param SitemapDefinitionInterface $definition
*
* @return SitemapServiceInterface|null
*/
public function get(SitemapDefinitionInterface $definition): ?SitemapServiceInterface;

/**
* Adds a new sitemap service.
*
* @param string $id
* @param SitemapServiceInterface $service
*/
public function addSitemap(string $id, SitemapServiceInterface $service): void;
}

0 comments on commit f497b6a

Please sign in to comment.