diff --git a/src/Composer/DevelopmentIntegrator.php b/src/Composer/DevelopmentIntegrator.php index 9088bd9ce..c867eddd2 100644 --- a/src/Composer/DevelopmentIntegrator.php +++ b/src/Composer/DevelopmentIntegrator.php @@ -43,7 +43,7 @@ public static function integrate(Event $event) $event->getIO()->write(''.$process->getOutput().''); } - private static function noramlizePath($path): string + private static function noramlizePath(string $path): string { return strtr($path, '/', DIRECTORY_SEPARATOR); } diff --git a/src/Composer/GrumPHPPlugin.php b/src/Composer/GrumPHPPlugin.php index b91849d3d..5c286eef0 100644 --- a/src/Composer/GrumPHPPlugin.php +++ b/src/Composer/GrumPHPPlugin.php @@ -62,7 +62,7 @@ public function activate(Composer $composer, IOInterface $io) * * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ PackageEvents::POST_PACKAGE_INSTALL => 'postPackageInstall', diff --git a/src/Configuration/GrumPHP.php b/src/Configuration/GrumPHP.php index 910cee7ac..ddf27db5b 100644 --- a/src/Configuration/GrumPHP.php +++ b/src/Configuration/GrumPHP.php @@ -122,7 +122,7 @@ public function getTestSuites(): TestSuiteCollection * * @return string|null */ - public function getAsciiContentPath($resource) + public function getAsciiContentPath(string $resource) { $paths = $this->container->getParameter('ascii'); if (!array_key_exists($resource, $paths)) { diff --git a/src/Console/Application.php b/src/Console/Application.php index 615bdac34..61d3e7c14 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -13,7 +13,9 @@ use Monolog\Handler\StreamHandler; use Monolog\Logger; use Symfony\Component\Console\Application as SymfonyConsole; +use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\ConsoleOutput; @@ -54,7 +56,7 @@ public function __construct() parent::__construct(self::APP_NAME, self::APP_VERSION); } - protected function getDefaultInputDefinition() + protected function getDefaultInputDefinition(): InputDefinition { $definition = parent::getDefaultInputDefinition(); $definition->addOption( @@ -70,7 +72,7 @@ protected function getDefaultInputDefinition() return $definition; } - protected function getDefaultCommands() + protected function getDefaultCommands(): array { $commands = parent::getDefaultCommands(); @@ -106,7 +108,7 @@ protected function getDefaultCommands() return $commands; } - protected function getDefaultHelperSet() + protected function getDefaultHelperSet(): HelperSet { $helperSet = parent::getDefaultHelperSet(); $helperSet->set($this->initializeComposerHelper()); diff --git a/src/Console/Helper/PathsHelper.php b/src/Console/Helper/PathsHelper.php index a8e9458bc..93da8efde 100644 --- a/src/Console/Helper/PathsHelper.php +++ b/src/Console/Helper/PathsHelper.php @@ -180,7 +180,7 @@ public function getBinDir(): string * Search a command in the bin folder * Note: the command locator is not injected because it needs the relative bin path. */ - public function getBinCommand($command, $forceUnix = false): string + public function getBinCommand($command, bool $forceUnix = false): string { return $this->externalCommandLocator->locate($command, $forceUnix); } @@ -188,7 +188,7 @@ public function getBinCommand($command, $forceUnix = false): string /** * @throws FileNotFoundException If file doesn't exists */ - public function getRelativePath($path): string + public function getRelativePath(string $path): string { $realpath = $this->getAbsolutePath($path); diff --git a/src/Console/Helper/TaskRunnerHelper.php b/src/Console/Helper/TaskRunnerHelper.php index a9ac54298..d61a07211 100644 --- a/src/Console/Helper/TaskRunnerHelper.php +++ b/src/Console/Helper/TaskRunnerHelper.php @@ -132,7 +132,7 @@ private function returnWarningMessages(OutputInterface $output, array $warningMe /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return self::HELPER_NAME; } diff --git a/src/Locator/ConfigurationFile.php b/src/Locator/ConfigurationFile.php index 892e3317c..bee0c93bd 100644 --- a/src/Locator/ConfigurationFile.php +++ b/src/Locator/ConfigurationFile.php @@ -45,7 +45,7 @@ public function locate(string $workingDir, PackageInterface $package = null): st return $defaultPath; } - private function useConfigPathFromComposer(PackageInterface $package, $defaultPath): string + private function useConfigPathFromComposer(PackageInterface $package, string $defaultPath): string { $extra = $package->getExtra(); if (!isset($extra['grumphp']['config-default-path'])) { @@ -57,7 +57,7 @@ private function useConfigPathFromComposer(PackageInterface $package, $defaultPa return $this->locateConfigFileWithDistSupport($composerDefaultPath); } - private function locateConfigFileWithDistSupport($defaultPath): string + private function locateConfigFileWithDistSupport(string $defaultPath): string { $distPath = ('.dist' !== strpos($defaultPath, -5)) ? $defaultPath.'.dist' : $defaultPath; if ($this->filesystem->exists($defaultPath) || !$this->filesystem->exists($distPath)) { diff --git a/src/Parser/Php/Configurator/TraverserConfigurator.php b/src/Parser/Php/Configurator/TraverserConfigurator.php index c839e196a..1bdce7600 100644 --- a/src/Parser/Php/Configurator/TraverserConfigurator.php +++ b/src/Parser/Php/Configurator/TraverserConfigurator.php @@ -59,11 +59,9 @@ public function registerVisitorId(string $alias, string $visitorId) } /** - * @param array|null $visitorOptions - * * @throws \GrumPHP\Exception\RuntimeException */ - public function registerStandardEnabledVisitor($alias, array $visitorOptions = null) + public function registerStandardEnabledVisitor(string $alias, array $visitorOptions = null) { if (array_key_exists($alias, $this->standardEnabledVisitors)) { throw new RuntimeException( diff --git a/src/Process/ProcessFactory.php b/src/Process/ProcessFactory.php index 36882cb22..716712d29 100644 --- a/src/Process/ProcessFactory.php +++ b/src/Process/ProcessFactory.php @@ -12,7 +12,7 @@ */ final class ProcessFactory { - public static function fromArguments(ProcessArgumentsCollection $arguments) + public static function fromArguments(ProcessArgumentsCollection $arguments): Process { // @todo Remove backward compatibility layer as soon as Symfony Process accepts an array (3.3+). // From then on, you can simply pass `$arguments->getValues()` directly as the first constructor argument. diff --git a/src/Util/Regex.php b/src/Util/Regex.php index 2d8d23850..203b632ce 100644 --- a/src/Util/Regex.php +++ b/src/Util/Regex.php @@ -22,7 +22,7 @@ class Regex /** * Regex constructor. */ - public function __construct($string) + public function __construct(string $string) { $this->regex = $this->toRegex($string); }