diff --git a/Check/CustomErrorPages.php b/Check/CustomErrorPages.php index 799b102d..8ca2b5d4 100644 --- a/Check/CustomErrorPages.php +++ b/Check/CustomErrorPages.php @@ -4,6 +4,7 @@ use Laminas\Diagnostics\Check\CheckInterface; use Laminas\Diagnostics\Result\Failure; +use Laminas\Diagnostics\Result\ResultInterface; use Laminas\Diagnostics\Result\Success; /** @@ -35,6 +36,9 @@ public function __construct(array $errorCodes, $path, $projectDir) $this->projectDir = $projectDir; } + /** + * @return ResultInterface + */ public function check() { $dir = $this->getCustomTemplateDirectory(); @@ -55,15 +59,15 @@ public function check() return new Success(); } + /** + * @return string + */ public function getLabel() { return 'Custom error pages'; } - /** - * @return string - */ - private function getCustomTemplateDirectory() + private function getCustomTemplateDirectory(): string { if ($this->projectDir !== $this->path) { return $this->path; // using custom directory diff --git a/Check/DoctrineDbal.php b/Check/DoctrineDbal.php index a096c052..f61144fc 100644 --- a/Check/DoctrineDbal.php +++ b/Check/DoctrineDbal.php @@ -4,6 +4,7 @@ use Doctrine\Persistence\ConnectionRegistry; use Laminas\Diagnostics\Check\AbstractCheck; +use Laminas\Diagnostics\Result\ResultInterface; use Laminas\Diagnostics\Result\Success; class DoctrineDbal extends AbstractCheck @@ -17,6 +18,9 @@ public function __construct(ConnectionRegistry $registry, $connectionName = null $this->connectionName = $connectionName; } + /** + * @return ResultInterface + */ public function check() { $connection = $this->manager->getConnection($this->connectionName); diff --git a/Check/DoctrineDbalCollection.php b/Check/DoctrineDbalCollection.php index cc29ea05..0b957883 100644 --- a/Check/DoctrineDbalCollection.php +++ b/Check/DoctrineDbalCollection.php @@ -26,6 +26,9 @@ public function __construct(ConnectionRegistry $manager, $connections) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/DoctrineMigrationsCollection.php b/Check/DoctrineMigrationsCollection.php index f182d840..4fe2e572 100644 --- a/Check/DoctrineMigrationsCollection.php +++ b/Check/DoctrineMigrationsCollection.php @@ -48,6 +48,9 @@ public function __construct( $this->migrations = $migrations; } + /** + * @return array|\Traversable + */ public function getChecks() { if (null === $this->checks) { diff --git a/Check/DoctrineMongoDb.php b/Check/DoctrineMongoDb.php index d85fab1b..39e6a51b 100644 --- a/Check/DoctrineMongoDb.php +++ b/Check/DoctrineMongoDb.php @@ -5,6 +5,7 @@ use Doctrine\Bundle\MongoDBBundle\ManagerRegistry; use Laminas\Diagnostics\Check\AbstractCheck; use Laminas\Diagnostics\Result\Failure; +use Laminas\Diagnostics\Result\ResultInterface; use Laminas\Diagnostics\Result\Success; use MongoDB\Driver\Command; use MongoDB\Driver\Exception\ConnectionException; @@ -20,6 +21,9 @@ public function __construct(ManagerRegistry $registry, $connectionName = null) $this->connectionName = $connectionName; } + /** + * @return ResultInterface + */ public function check() { $connection = $this->manager->getConnection($this->connectionName); diff --git a/Check/DoctrineMongoDbCollection.php b/Check/DoctrineMongoDbCollection.php index 1e9980c5..3fea5785 100644 --- a/Check/DoctrineMongoDbCollection.php +++ b/Check/DoctrineMongoDbCollection.php @@ -26,6 +26,9 @@ public function __construct(ConnectionRegistry $manager, $connections) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/Expression.php b/Check/Expression.php index edaeb2cd..5fdac568 100644 --- a/Check/Expression.php +++ b/Check/Expression.php @@ -4,6 +4,7 @@ use Laminas\Diagnostics\Check\CheckInterface; use Laminas\Diagnostics\Result\Failure; +use Laminas\Diagnostics\Result\ResultInterface; use Laminas\Diagnostics\Result\Success; use Laminas\Diagnostics\Result\Warning; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; @@ -36,6 +37,9 @@ public function __construct($label, $warningCheck = null, $criticalCheck = null, $this->criticalMessage = $criticalMessage; } + /** + * @return ResultInterface + */ public function check() { $language = $this->getExpressionLanguage(); @@ -51,12 +55,15 @@ public function check() return new Success(); } + /** + * @return string + */ public function getLabel() { return $this->label; } - protected function getExpressionLanguage() + protected function getExpressionLanguage(): ExpressionLanguage { $language = new ExpressionLanguage(); $language->register( diff --git a/Check/ExpressionCollection.php b/Check/ExpressionCollection.php index 2eded80c..84b4252f 100644 --- a/Check/ExpressionCollection.php +++ b/Check/ExpressionCollection.php @@ -24,6 +24,9 @@ public function __construct(array $configs) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/GuzzleHttpServiceCollection.php b/Check/GuzzleHttpServiceCollection.php index 9cdab888..e5fc81ad 100644 --- a/Check/GuzzleHttpServiceCollection.php +++ b/Check/GuzzleHttpServiceCollection.php @@ -31,6 +31,9 @@ public function __construct(array $configs) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/HttpServiceCollection.php b/Check/HttpServiceCollection.php index 514f120e..4facaf22 100644 --- a/Check/HttpServiceCollection.php +++ b/Check/HttpServiceCollection.php @@ -22,6 +22,9 @@ public function __construct(array $configs) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/MemcacheCollection.php b/Check/MemcacheCollection.php index 88d3921d..33da0fc8 100644 --- a/Check/MemcacheCollection.php +++ b/Check/MemcacheCollection.php @@ -22,6 +22,9 @@ public function __construct(array $configs) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/MemcachedCollection.php b/Check/MemcachedCollection.php index f48cf6be..bbd83feb 100644 --- a/Check/MemcachedCollection.php +++ b/Check/MemcachedCollection.php @@ -22,6 +22,9 @@ public function __construct(array $configs) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/PdoConnectionCollection.php b/Check/PdoConnectionCollection.php index 55d913b0..a116806f 100644 --- a/Check/PdoConnectionCollection.php +++ b/Check/PdoConnectionCollection.php @@ -17,6 +17,9 @@ public function __construct(array $connections) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/PhpFlagsCollection.php b/Check/PhpFlagsCollection.php index 1aae5941..c2c7f950 100644 --- a/Check/PhpFlagsCollection.php +++ b/Check/PhpFlagsCollection.php @@ -22,6 +22,9 @@ public function __construct(array $configs) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/PhpVersionCollection.php b/Check/PhpVersionCollection.php index 110728cc..c6284483 100644 --- a/Check/PhpVersionCollection.php +++ b/Check/PhpVersionCollection.php @@ -22,6 +22,9 @@ public function __construct(array $configs) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/ProcessRunningCollection.php b/Check/ProcessRunningCollection.php index 7543e3fc..e2462ed9 100644 --- a/Check/ProcessRunningCollection.php +++ b/Check/ProcessRunningCollection.php @@ -26,6 +26,9 @@ public function __construct($processes) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/RabbitMQCollection.php b/Check/RabbitMQCollection.php index c4cb301c..13e73c76 100644 --- a/Check/RabbitMQCollection.php +++ b/Check/RabbitMQCollection.php @@ -36,6 +36,9 @@ public function __construct(array $configs) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/RedisCollection.php b/Check/RedisCollection.php index d8a8fea4..78ae743c 100644 --- a/Check/RedisCollection.php +++ b/Check/RedisCollection.php @@ -26,7 +26,7 @@ public function __construct(array $configs) } } - private function parseDsn(array &$config) + private function parseDsn(array &$config): void { $config = \array_merge($config, \parse_url($config['dsn'])); @@ -45,6 +45,9 @@ private function parseDsn(array &$config) } } + /** + * @return array|\Traversable + */ public function getChecks() { return $this->checks; diff --git a/Check/SymfonyRequirements.php b/Check/SymfonyRequirements.php index 623afb47..e53b7c91 100644 --- a/Check/SymfonyRequirements.php +++ b/Check/SymfonyRequirements.php @@ -4,6 +4,7 @@ use Laminas\Diagnostics\Check\CheckInterface; use Laminas\Diagnostics\Result\Failure; +use Laminas\Diagnostics\Result\ResultInterface; use Laminas\Diagnostics\Result\Success; use Laminas\Diagnostics\Result\Warning; @@ -21,6 +22,9 @@ public function __construct($file) require $file; } + /** + * @return ResultInterface + */ public function check() { $symfonyRequirements = new \SymfonyRequirements(); @@ -36,6 +40,9 @@ public function check() return new Success(); } + /** + * @return string + */ public function getLabel() { return 'Symfony2 Requirements'; diff --git a/Check/SymfonyVersion.php b/Check/SymfonyVersion.php index c53e4872..ac7778d6 100644 --- a/Check/SymfonyVersion.php +++ b/Check/SymfonyVersion.php @@ -4,6 +4,7 @@ use Laminas\Diagnostics\Check\CheckInterface; use Laminas\Diagnostics\Result\Failure; +use Laminas\Diagnostics\Result\ResultInterface; use Laminas\Diagnostics\Result\Success; use Laminas\Diagnostics\Result\Warning; use Symfony\Component\HttpClient\HttpClient; @@ -20,6 +21,9 @@ class SymfonyVersion implements CheckInterface const PACKAGIST_URL = 'https://packagist.org/packages/symfony/symfony.json'; const VERSION_CHECK_URL = 'https://symfony.com/releases/%s.json'; + /** + * @return ResultInterface + */ public function check() { $currentBranch = Kernel::MAJOR_VERSION.'.'.Kernel::MINOR_VERSION; @@ -47,6 +51,9 @@ public function check() return new Success(sprintf('Your current Symfony branch reaches it\'s end of life in %s.', $endOfLife)); } + /** + * @return string + */ public function getLabel() { return 'Symfony version'; @@ -55,11 +62,9 @@ public function getLabel() /** * @param string $branch * - * @return string - * * @throws \Exception */ - private function getLatestVersion($branch) + private function getLatestVersion($branch): string { $response = $this->getResponseAndDecode(self::PACKAGIST_URL); @@ -96,13 +101,11 @@ function ($value) use ($branch) { } /** - * @param $url - * - * @return array + * @param string $url * * @throws \Exception */ - private function getResponseAndDecode($url) + private function getResponseAndDecode($url): array { if (class_exists(HttpClient::class)) { return HttpClient::create()->request('GET', $url)->toArray(); diff --git a/Command/HealthCheckCommand.php b/Command/HealthCheckCommand.php index a3acf67d..fd33772c 100644 --- a/Command/HealthCheckCommand.php +++ b/Command/HealthCheckCommand.php @@ -26,7 +26,7 @@ public function __construct(ConsoleReporter $reporter, RawConsoleReporter $rawRe parent::__construct($name); } - protected function configure() + protected function configure(): void { $this ->setName('monitor:health') @@ -53,10 +53,7 @@ protected function configure() ; } - /** - * @return int - */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $failureCount = 0; diff --git a/Command/ListChecksCommand.php b/Command/ListChecksCommand.php index c4180bdc..63157bc7 100644 --- a/Command/ListChecksCommand.php +++ b/Command/ListChecksCommand.php @@ -22,7 +22,7 @@ public function __construct(RunnerManager $runnerManager, Runner $runner, $name parent::__construct($name); } - protected function configure() + protected function configure(): void { $this ->setName('monitor:list') @@ -34,7 +34,7 @@ protected function configure() ; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { switch (true) { case $input->getOption('reporters'): @@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - protected function listChecks(InputInterface $input, OutputInterface $output) + protected function listChecks(InputInterface $input, OutputInterface $output): void { $group = $input->getOption('group'); @@ -69,7 +69,7 @@ protected function listChecks(InputInterface $input, OutputInterface $output) $this->doListChecks($output, $runner); } - protected function listAllChecks(OutputInterface $output) + protected function listAllChecks(OutputInterface $output): void { foreach ($this->runnerManager->getRunners() as $group => $runner) { $output->writeln(sprintf('%s', $group)); @@ -78,7 +78,7 @@ protected function listAllChecks(OutputInterface $output) } } - protected function listReporters(OutputInterface $output) + protected function listReporters(OutputInterface $output): void { $reporters = $this->runner->getAdditionalReporters(); if (0 === count($reporters)) { @@ -90,14 +90,14 @@ protected function listReporters(OutputInterface $output) } } - protected function listGroups(OutputInterface $output) + protected function listGroups(OutputInterface $output): void { foreach ($this->runnerManager->getGroups() as $group) { $output->writeln($group); } } - private function doListChecks(OutputInterface $output, Runner $runner) + private function doListChecks(OutputInterface $output, Runner $runner): void { $checks = $runner->getChecks(); diff --git a/Composer/ScriptHandler.php b/Composer/ScriptHandler.php index 86759bde..808c3408 100644 --- a/Composer/ScriptHandler.php +++ b/Composer/ScriptHandler.php @@ -11,7 +11,7 @@ */ class ScriptHandler extends BaseHandler { - public static function checkHealth(Event $event) + public static function checkHealth(Event $event): void { $options = self::getOptions($event); diff --git a/Controller/HealthCheckController.php b/Controller/HealthCheckController.php index 9c9f4028..9a7cbe03 100644 --- a/Controller/HealthCheckController.php +++ b/Controller/HealthCheckController.php @@ -29,10 +29,7 @@ public function __construct(RunnerManager $runnerManager, PathHelper $pathHelper $this->failureStatusCode = $failureStatusCode; } - /** - * @return Response - */ - public function indexAction(Request $request) + public function indexAction(Request $request): Response { $group = $this->getGroup($request); @@ -61,10 +58,7 @@ public function indexAction(Request $request) return new Response($content, 200, ['Content-Type' => 'text/html']); } - /** - * @return Response - */ - public function listAction(Request $request) + public function listAction(Request $request): JsonResponse { $ret = []; @@ -77,10 +71,7 @@ public function listAction(Request $request) return new JsonResponse($ret); } - /** - * @return JsonResponse - */ - public function listAllAction() + public function listAllAction(): JsonResponse { $allChecks = []; @@ -93,20 +84,14 @@ public function listAllAction() return new JsonResponse($allChecks); } - /** - * @return JsonResponse - */ - public function listGroupsAction() + public function listGroupsAction(): JsonResponse { $groups = $this->runnerManager->getGroups(); return new JsonResponse($groups); } - /** - * @return Response - */ - public function runAllChecksAction(Request $request) + public function runAllChecksAction(Request $request): JsonResponse { $report = $this->runTests($request); @@ -116,10 +101,7 @@ public function runAllChecksAction(Request $request) ]); } - /** - * @return Response - */ - public function runAllChecksHttpStatusAction(Request $request) + public function runAllChecksHttpStatusAction(Request $request): Response { $report = $this->runTests($request); @@ -131,10 +113,8 @@ public function runAllChecksHttpStatusAction(Request $request) /** * @param string $checkId - * - * @return Response */ - public function runSingleCheckHttpStatusAction($checkId, Request $request) + public function runSingleCheckHttpStatusAction($checkId, Request $request): Response { $report = $this->runTests($request, $checkId); @@ -146,10 +126,8 @@ public function runSingleCheckHttpStatusAction($checkId, Request $request) /** * @param string $checkId - * - * @return Response */ - public function runSingleCheckAction($checkId, Request $request) + public function runSingleCheckAction($checkId, Request $request): JsonResponse { $results = $this->runTests($request, $checkId)->getResults(); @@ -158,10 +136,8 @@ public function runSingleCheckAction($checkId, Request $request) /** * @param string|null $checkId - * - * @return ArrayReporter */ - protected function runTests(Request $request, $checkId = null) + protected function runTests(Request $request, $checkId = null): ArrayReporter { $reporters = $request->query->get('reporters') ?? []; @@ -181,11 +157,9 @@ protected function runTests(Request $request, $checkId = null) } /** - * @return Runner - * * @throws \Exception */ - private function getRunner(Request $request) + private function getRunner(Request $request): Runner { $group = $this->getGroup($request); @@ -198,18 +172,12 @@ private function getRunner(Request $request) throw new \RuntimeException(sprintf('Unknown check group "%s"', $group)); } - /** - * @return string - */ - private function getGroup(Request $request) + private function getGroup(Request $request): string { return $request->query->get('group') ?: $this->runnerManager->getDefaultGroup(); } - /** - * @return Response - */ - public function listReportersAction() + public function listReportersAction(): JsonResponse { return new JsonResponse($this->runnerManager->getReporters()); } diff --git a/DependencyInjection/Compiler/AddGroupsCompilerPass.php b/DependencyInjection/Compiler/AddGroupsCompilerPass.php index a4ad8052..ffbceb72 100644 --- a/DependencyInjection/Compiler/AddGroupsCompilerPass.php +++ b/DependencyInjection/Compiler/AddGroupsCompilerPass.php @@ -9,7 +9,7 @@ class AddGroupsCompilerPass implements CompilerPassInterface { const SERVICE_ID_PREFIX = 'liip_monitor.check.'; - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasParameter('liip_monitor.checks')) { return; @@ -23,10 +23,7 @@ public function process(ContainerBuilder $container) $this->addGroupTags($container, $checkCollections, 'liip_monitor.check_collection'); } - /** - * @return array - */ - private function parseGroups(ContainerBuilder $container, array $data) + private function parseGroups(ContainerBuilder $container, array $data): array { $checks = []; $checkCollections = []; @@ -56,7 +53,7 @@ private function parseGroups(ContainerBuilder $container, array $data) * * @param string $tag */ - private function addGroupTags(ContainerBuilder $container, array $checks, $tag) + private function addGroupTags(ContainerBuilder $container, array $checks, $tag): void { foreach ($checks as $checkName => $groups) { $serviceId = self::SERVICE_ID_PREFIX.$checkName; diff --git a/DependencyInjection/Compiler/AdditionalReporterCompilerPass.php b/DependencyInjection/Compiler/AdditionalReporterCompilerPass.php index 335d46c4..15ea86f8 100644 --- a/DependencyInjection/Compiler/AdditionalReporterCompilerPass.php +++ b/DependencyInjection/Compiler/AdditionalReporterCompilerPass.php @@ -11,7 +11,7 @@ */ class AdditionalReporterCompilerPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (false === $container->hasParameter('liip_monitor.runners')) { return; diff --git a/DependencyInjection/Compiler/CheckAssetsEnabledPass.php b/DependencyInjection/Compiler/CheckAssetsEnabledPass.php index 27d0bf73..31c55a08 100644 --- a/DependencyInjection/Compiler/CheckAssetsEnabledPass.php +++ b/DependencyInjection/Compiler/CheckAssetsEnabledPass.php @@ -8,7 +8,7 @@ class CheckAssetsEnabledPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if ($container->has('liip_monitor.health_controller') && !$container->has('assets.packages')) { throw new LogicException('Controller support cannot be enabled unless the frameworkbundle "assets" support is also enabled.'); diff --git a/DependencyInjection/Compiler/CheckCollectionTagCompilerPass.php b/DependencyInjection/Compiler/CheckCollectionTagCompilerPass.php index 0ffb6c71..fd224588 100644 --- a/DependencyInjection/Compiler/CheckCollectionTagCompilerPass.php +++ b/DependencyInjection/Compiler/CheckCollectionTagCompilerPass.php @@ -8,7 +8,7 @@ class CheckCollectionTagCompilerPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (false === $container->hasParameter('liip_monitor.default_group')) { return; diff --git a/DependencyInjection/Compiler/CheckTagCompilerPass.php b/DependencyInjection/Compiler/CheckTagCompilerPass.php index c36c2c99..413e6e58 100644 --- a/DependencyInjection/Compiler/CheckTagCompilerPass.php +++ b/DependencyInjection/Compiler/CheckTagCompilerPass.php @@ -8,7 +8,7 @@ class CheckTagCompilerPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (false === $container->hasParameter('liip_monitor.default_group')) { return; diff --git a/DependencyInjection/Compiler/GroupRunnersCompilerPass.php b/DependencyInjection/Compiler/GroupRunnersCompilerPass.php index 1753450f..4b5e4ee4 100644 --- a/DependencyInjection/Compiler/GroupRunnersCompilerPass.php +++ b/DependencyInjection/Compiler/GroupRunnersCompilerPass.php @@ -7,7 +7,7 @@ class GroupRunnersCompilerPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $noRunner = false === $container->hasDefinition('liip_monitor.runner'); $noDefaultGroup = false === $container->hasParameter('liip_monitor.default_group'); @@ -45,10 +45,7 @@ public function process(ContainerBuilder $container) $container->setParameter('liip_monitor.runners', $runners); } - /** - * @return array - */ - private function getGroups(array $services) + private function getGroups(array $services): array { $groups = []; foreach ($services as $serviceId => $tags) { @@ -62,10 +59,7 @@ private function getGroups(array $services) return array_keys($groups); } - /** - * @return array - */ - private function getGroupsFromParameter(ContainerBuilder $container) + private function getGroupsFromParameter(ContainerBuilder $container): array { $groups = []; diff --git a/DependencyInjection/Compiler/MailerCompilerPass.php b/DependencyInjection/Compiler/MailerCompilerPass.php index 67950571..335032e9 100644 --- a/DependencyInjection/Compiler/MailerCompilerPass.php +++ b/DependencyInjection/Compiler/MailerCompilerPass.php @@ -13,7 +13,7 @@ */ class MailerCompilerPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (false === $container->hasParameter('liip_monitor.mailer.enabled')) { return; diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 0c63db6f..e11da28e 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -4,6 +4,7 @@ use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle; use Symfony\Component\Config\Definition\BaseNode; +use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; @@ -19,10 +20,8 @@ class Configuration implements ConfigurationInterface { /** * Generates the configuration tree. - * - * @return TreeBuilder */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('liip_monitor'); @@ -86,7 +85,7 @@ public function getConfigTreeBuilder() return $treeBuilder; } - private function createGroupsNode() + private function createGroupsNode(): NodeDefinition { $builder = new TreeBuilder('groups'); @@ -440,7 +439,7 @@ private function createGroupsNode() * introduced at the same time. By checking if getDeprecation() exists, * we can determine the correct param count to use when calling setDeprecated. */ - private static function getCustomErrorPagesControllerDeprecationMessage() + private static function getCustomErrorPagesControllerDeprecationMessage(): array { $message = 'The custom error page controller option is no longer used; the corresponding config parameter was deprecated in 2.13 and will be dropped in 3.0.'; diff --git a/DependencyInjection/DoctrineMigrations/DoctrineMigrationsLoader.php b/DependencyInjection/DoctrineMigrations/DoctrineMigrationsLoader.php index f3172cc0..0028eafc 100644 --- a/DependencyInjection/DoctrineMigrations/DoctrineMigrationsLoader.php +++ b/DependencyInjection/DoctrineMigrations/DoctrineMigrationsLoader.php @@ -28,7 +28,7 @@ public function __construct() : new V3MigrationsLoader(); } - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!($this->loader instanceof CompilerPassInterface)) { return; diff --git a/DependencyInjection/DoctrineMigrations/V2MigrationsLoader.php b/DependencyInjection/DoctrineMigrations/V2MigrationsLoader.php index 91b0e3b0..1cfc8e0c 100644 --- a/DependencyInjection/DoctrineMigrations/V2MigrationsLoader.php +++ b/DependencyInjection/DoctrineMigrations/V2MigrationsLoader.php @@ -35,7 +35,7 @@ final class V2MigrationsLoader extends AbstractDoctrineMigrationsLoader implemen */ private $migrationConfigurationsServices = []; - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { foreach ($this->migrationConfigurationsServices as $services) { [$configurationService, $configuration] = $services; diff --git a/DependencyInjection/LiipMonitorExtension.php b/DependencyInjection/LiipMonitorExtension.php index 3ed2a4be..68d52e09 100644 --- a/DependencyInjection/LiipMonitorExtension.php +++ b/DependencyInjection/LiipMonitorExtension.php @@ -30,7 +30,7 @@ public function __construct() /** * Loads the services based on your application configuration. */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('runner.xml'); @@ -96,7 +96,7 @@ public function load(array $configs, ContainerBuilder $container) $this->configureDoctrineMigrationsCheck($container, $containerParams); } - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $this->migrationsLoader->process($container); } @@ -106,7 +106,7 @@ public function process(ContainerBuilder $container) * @param string $group * @param array $values */ - private function setParameters(ContainerBuilder $container, $checkName, $group, $values) + private function setParameters(ContainerBuilder $container, $checkName, $group, $values): void { $prefix = sprintf('%s.check.%s', $this->getAlias(), $checkName); switch ($checkName) { @@ -161,10 +161,8 @@ private function setParameters(ContainerBuilder $container, $checkName, $group, * * @param ContainerBuilder $container The container * @param array $params Container params - * - * @return void */ - private function configureDoctrineMigrationsCheck(ContainerBuilder $container, array $params) + private function configureDoctrineMigrationsCheck(ContainerBuilder $container, array $params): void { if (!$container->hasDefinition('liip_monitor.check.doctrine_migrations') || !isset($params['groups'])) { return; @@ -186,7 +184,7 @@ private function configureDoctrineMigrationsCheck(ContainerBuilder $container, a } } - private function configureMailer(ContainerBuilder $container, array $config) + private function configureMailer(ContainerBuilder $container, array $config): void { if (false === $config['mailer']['enabled']) { return; diff --git a/DoctrineMigrations/Configuration.php b/DoctrineMigrations/Configuration.php index 16f4af1c..ed82953d 100644 --- a/DoctrineMigrations/Configuration.php +++ b/DoctrineMigrations/Configuration.php @@ -29,20 +29,16 @@ class Configuration extends BaseConfiguration * Set service container. * * @param ContainerInterface $container Service container - * - * @return void */ - public function setContainer(ContainerInterface $container) + public function setContainer(ContainerInterface $container): void { $this->container = $container; } /** * Tune this configuration parameters according to migrations bundle. - * - * @return void */ - public function configure() + public function configure(): void { if (null === self::$haveMigrationBundle) { self::$haveMigrationBundle = class_exists(DoctrineCommand::class); diff --git a/Helper/AbstractMailReporter.php b/Helper/AbstractMailReporter.php index c530f202..8cd2749f 100644 --- a/Helper/AbstractMailReporter.php +++ b/Helper/AbstractMailReporter.php @@ -41,22 +41,37 @@ public function __construct($recipients, $sender, $subject, $sendOnWarning = tru $this->sendOnWarning = $sendOnWarning; } + /** + * @return void + */ public function onStart(ArrayObject $checks, $runnerConfig) { } + /** + * @return bool|void + */ public function onBeforeRun(CheckInterface $check, $checkAlias = null) { } + /** + * @return bool|void + */ public function onAfterRun(CheckInterface $check, ResultInterface $result, $checkAlias = null) { } + /** + * @return void + */ public function onStop(ResultsCollection $results) { } + /** + * @return void + */ public function onFinish(ResultsCollection $results) { if ($results->getUnknownCount() > 0) { @@ -78,5 +93,5 @@ public function onFinish(ResultsCollection $results) } } - abstract protected function sendEmail(ResultsCollection $results); + abstract protected function sendEmail(ResultsCollection $results): void; } diff --git a/Helper/ArrayReporter.php b/Helper/ArrayReporter.php index edf1ab61..f9074c9b 100644 --- a/Helper/ArrayReporter.php +++ b/Helper/ArrayReporter.php @@ -21,22 +21,19 @@ class ArrayReporter implements ReporterInterface private $globalStatus = self::STATUS_OK; private $results = []; - /** - * @return array - */ - public function getResults() + public function getResults(): array { return $this->results; } - /** - * @return string - */ - public function getGlobalStatus() + public function getGlobalStatus(): string { return $this->globalStatus; } + /** + * @return bool|void + */ public function onAfterRun(CheckInterface $check, ResultInterface $result, $checkAlias = null) { switch (true) { @@ -71,21 +68,33 @@ public function onAfterRun(CheckInterface $check, ResultInterface $result, $chec ]; } + /** + * @return void + */ public function onStart(\ArrayObject $checks, $runnerConfig) { return; } + /** + * @return bool|void + */ public function onBeforeRun(CheckInterface $check, $checkAlias = null) { return; } + /** + * @return void + */ public function onStop(ResultsCollection $results) { return; } + /** + * @return void + */ public function onFinish(ResultsCollection $results) { return; diff --git a/Helper/ConsoleReporter.php b/Helper/ConsoleReporter.php index 201eba2e..26f4d6c7 100644 --- a/Helper/ConsoleReporter.php +++ b/Helper/ConsoleReporter.php @@ -33,11 +33,14 @@ public function __construct(OutputInterface $output = null) $this->output = $output; } - public function setOutput(OutputInterface $output) + public function setOutput(OutputInterface $output): void { $this->output = $output; } + /** + * @return bool|void + */ public function onAfterRun(CheckInterface $check, ResultInterface $result, $checkAlias = null) { switch (true) { @@ -66,21 +69,33 @@ public function onAfterRun(CheckInterface $check, ResultInterface $result, $chec $this->output->writeln(''); } + /** + * @return void + */ public function onStart(\ArrayObject $checks, $runnerConfig) { return; } + /** + * @return bool|void + */ public function onBeforeRun(CheckInterface $check, $checkAlias = null) { return; } + /** + * @return void + */ public function onStop(ResultsCollection $results) { return; } + /** + * @return void + */ public function onFinish(ResultsCollection $results) { return; diff --git a/Helper/PathHelper.php b/Helper/PathHelper.php index eee6d789..7ea4bb7c 100644 --- a/Helper/PathHelper.php +++ b/Helper/PathHelper.php @@ -13,10 +13,7 @@ public function __construct($assetsHelper, $routerHelper) $this->routerHelper = $routerHelper; } - /** - * @return array - */ - public function generateRoutes(array $routes) + public function generateRoutes(array $routes): array { $ret = []; @@ -36,10 +33,7 @@ public function generateRoutes(array $routes) return $ret; } - /** - * @return string - */ - public function getRoutesJs(array $routes) + public function getRoutesJs(array $routes): string { $script = '