diff --git a/src/Symfony/Component/Config/ConfigCacheFactory.php b/src/Symfony/Component/Config/ConfigCacheFactory.php index bfb70cb2ceda5..bcec95c11d9c1 100644 --- a/src/Symfony/Component/Config/ConfigCacheFactory.php +++ b/src/Symfony/Component/Config/ConfigCacheFactory.php @@ -35,7 +35,7 @@ public function __construct(bool $debug) /** * {@inheritdoc} */ - public function cache($file, $callback) + public function cache(string $file, $callback) { if (!\is_callable($callback)) { throw new \InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', \gettype($callback))); diff --git a/src/Symfony/Component/Config/ConfigCacheFactoryInterface.php b/src/Symfony/Component/Config/ConfigCacheFactoryInterface.php index 8e80142b7816d..255b85a6575a7 100644 --- a/src/Symfony/Component/Config/ConfigCacheFactoryInterface.php +++ b/src/Symfony/Component/Config/ConfigCacheFactoryInterface.php @@ -28,5 +28,5 @@ interface ConfigCacheFactoryInterface * * @return ConfigCacheInterface The cache instance */ - public function cache($file, $callable); + public function cache(string $file, $callable); } diff --git a/src/Symfony/Component/Config/ConfigCacheInterface.php b/src/Symfony/Component/Config/ConfigCacheInterface.php index 7c47ad70a5685..001e7e7c105e8 100644 --- a/src/Symfony/Component/Config/ConfigCacheInterface.php +++ b/src/Symfony/Component/Config/ConfigCacheInterface.php @@ -45,5 +45,5 @@ public function isFresh(); * * @throws \RuntimeException When the cache file cannot be written */ - public function write($content, array $metadata = null); + public function write(string $content, array $metadata = null); } diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index 43697ef27943c..9fabdd5628a4c 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -102,40 +102,32 @@ public function getXmlRemappings() /** * Sets whether to add default values for this array if it has not been * defined in any of the configuration files. - * - * @param bool $boolean */ - public function setAddIfNotSet($boolean) + public function setAddIfNotSet(bool $boolean) { - $this->addIfNotSet = (bool) $boolean; + $this->addIfNotSet = $boolean; } /** * Sets whether false is allowed as value indicating that the array should be unset. - * - * @param bool $allow */ - public function setAllowFalse($allow) + public function setAllowFalse(bool $allow) { - $this->allowFalse = (bool) $allow; + $this->allowFalse = $allow; } /** * Sets whether new keys can be defined in subsequent configurations. - * - * @param bool $allow */ - public function setAllowNewKeys($allow) + public function setAllowNewKeys(bool $allow) { - $this->allowNewKeys = (bool) $allow; + $this->allowNewKeys = $allow; } /** * Sets if deep merging should occur. - * - * @param bool $boolean */ - public function setPerformDeepMerging($boolean) + public function setPerformDeepMerging(bool $boolean) { $this->performDeepMerging = (bool) $boolean; } @@ -146,16 +138,16 @@ public function setPerformDeepMerging($boolean) * @param bool $boolean To allow extra keys * @param bool $remove To remove extra keys */ - public function setIgnoreExtraKeys($boolean, $remove = true) + public function setIgnoreExtraKeys(bool $boolean, $remove = true) { - $this->ignoreExtraKeys = (bool) $boolean; + $this->ignoreExtraKeys = $boolean; $this->removeExtraKeys = $this->ignoreExtraKeys && $remove; } /** * {@inheritdoc} */ - public function setName($name) + public function setName(string $name) { $this->name = $name; } diff --git a/src/Symfony/Component/Config/Definition/PrototypeNodeInterface.php b/src/Symfony/Component/Config/Definition/PrototypeNodeInterface.php index 8bbb84d4dcc7b..53ed43667ffce 100644 --- a/src/Symfony/Component/Config/Definition/PrototypeNodeInterface.php +++ b/src/Symfony/Component/Config/Definition/PrototypeNodeInterface.php @@ -23,5 +23,5 @@ interface PrototypeNodeInterface extends NodeInterface * * @param string $name The name of the node */ - public function setName($name); + public function setName(string $name); } diff --git a/src/Symfony/Component/Config/Definition/VariableNode.php b/src/Symfony/Component/Config/Definition/VariableNode.php index 0bcb28f233b17..fd193d8e73418 100644 --- a/src/Symfony/Component/Config/Definition/VariableNode.php +++ b/src/Symfony/Component/Config/Definition/VariableNode.php @@ -56,15 +56,15 @@ public function getDefaultValue() * * @param bool $boolean True if this entity will accept empty values */ - public function setAllowEmptyValue($boolean) + public function setAllowEmptyValue(bool $boolean) { - $this->allowEmptyValue = (bool) $boolean; + $this->allowEmptyValue = $boolean; } /** * {@inheritdoc} */ - public function setName($name) + public function setName(string $name) { $this->name = $name; } diff --git a/src/Symfony/Component/Config/FileLocator.php b/src/Symfony/Component/Config/FileLocator.php index b80026ea0769b..345e63e6cd61e 100644 --- a/src/Symfony/Component/Config/FileLocator.php +++ b/src/Symfony/Component/Config/FileLocator.php @@ -33,7 +33,7 @@ public function __construct($paths = []) /** * {@inheritdoc} */ - public function locate($name, $currentPath = null, $first = true) + public function locate(string $name, string $currentPath = null, $first = true) { if ('' == $name) { throw new \InvalidArgumentException('An empty file name is not valid to be located.'); @@ -81,7 +81,7 @@ public function locate($name, $currentPath = null, $first = true) * * @return bool */ - private function isAbsolutePath($file) + private function isAbsolutePath(string $file) { if ('/' === $file[0] || '\\' === $file[0] || (\strlen($file) > 3 && ctype_alpha($file[0]) diff --git a/src/Symfony/Component/Config/FileLocatorInterface.php b/src/Symfony/Component/Config/FileLocatorInterface.php index cf3c2e594df85..e3ca1d49c4066 100644 --- a/src/Symfony/Component/Config/FileLocatorInterface.php +++ b/src/Symfony/Component/Config/FileLocatorInterface.php @@ -30,5 +30,5 @@ interface FileLocatorInterface * @throws \InvalidArgumentException If $name is empty * @throws FileLocatorFileNotFoundException If a file is not found */ - public function locate($name, $currentPath = null, $first = true); + public function locate(string $name, string $currentPath = null, bool $first = true); } diff --git a/src/Symfony/Component/Config/Loader/DelegatingLoader.php b/src/Symfony/Component/Config/Loader/DelegatingLoader.php index e40e57d7af6aa..2ec64cb021246 100644 --- a/src/Symfony/Component/Config/Loader/DelegatingLoader.php +++ b/src/Symfony/Component/Config/Loader/DelegatingLoader.php @@ -31,7 +31,7 @@ public function __construct(LoaderResolverInterface $resolver) /** * {@inheritdoc} */ - public function load($resource, $type = null) + public function load($resource, string $type = null) { if (false === $loader = $this->resolver->resolve($resource, $type)) { throw new LoaderLoadException($resource, null, null, null, $type); @@ -43,7 +43,7 @@ public function load($resource, $type = null) /** * {@inheritdoc} */ - public function supports($resource, $type = null) + public function supports($resource, string $type = null) { return false !== $this->resolver->resolve($resource, $type); } diff --git a/src/Symfony/Component/Config/Loader/GlobFileLoader.php b/src/Symfony/Component/Config/Loader/GlobFileLoader.php index f432b45ba4fe8..fecb1c5d073ac 100644 --- a/src/Symfony/Component/Config/Loader/GlobFileLoader.php +++ b/src/Symfony/Component/Config/Loader/GlobFileLoader.php @@ -21,7 +21,7 @@ class GlobFileLoader extends FileLoader /** * {@inheritdoc} */ - public function load($resource, $type = null) + public function load($resource, string $type = null) { return $this->import($resource); } @@ -29,7 +29,7 @@ public function load($resource, $type = null) /** * {@inheritdoc} */ - public function supports($resource, $type = null) + public function supports($resource, string $type = null) { return 'glob' === $type; } diff --git a/src/Symfony/Component/Config/Loader/LoaderInterface.php b/src/Symfony/Component/Config/Loader/LoaderInterface.php index dfca9dd27bf0d..4dfb42c53fada 100644 --- a/src/Symfony/Component/Config/Loader/LoaderInterface.php +++ b/src/Symfony/Component/Config/Loader/LoaderInterface.php @@ -21,22 +21,20 @@ interface LoaderInterface /** * Loads a resource. * - * @param mixed $resource The resource - * @param string|null $type The resource type or null if unknown + * @param mixed $resource The resource * * @throws \Exception If something went wrong */ - public function load($resource, $type = null); + public function load($resource, string $type = null); /** * Returns whether this class supports the given resource. * - * @param mixed $resource A resource - * @param string|null $type The resource type or null if unknown + * @param mixed $resource A resource * * @return bool True if this class supports the given resource, false otherwise */ - public function supports($resource, $type = null); + public function supports($resource, string $type = null); /** * Gets the loader resolver. diff --git a/src/Symfony/Component/Config/Loader/LoaderResolver.php b/src/Symfony/Component/Config/Loader/LoaderResolver.php index c99efda4fd365..d243b91d42542 100644 --- a/src/Symfony/Component/Config/Loader/LoaderResolver.php +++ b/src/Symfony/Component/Config/Loader/LoaderResolver.php @@ -39,7 +39,7 @@ public function __construct(array $loaders = []) /** * {@inheritdoc} */ - public function resolve($resource, $type = null) + public function resolve($resource, string $type = null) { foreach ($this->loaders as $loader) { if ($loader->supports($resource, $type)) { diff --git a/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php b/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php index 40f1a1a63f295..2c45a4cbd79b7 100644 --- a/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php +++ b/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php @@ -26,5 +26,5 @@ interface LoaderResolverInterface * * @return LoaderInterface|false The loader or false if none is able to load the resource */ - public function resolve($resource, $type = null); + public function resolve($resource, string $type = null); } diff --git a/src/Symfony/Component/Config/Resource/SelfCheckingResourceChecker.php b/src/Symfony/Component/Config/Resource/SelfCheckingResourceChecker.php index d72203bc1a42c..eab332393ab28 100644 --- a/src/Symfony/Component/Config/Resource/SelfCheckingResourceChecker.php +++ b/src/Symfony/Component/Config/Resource/SelfCheckingResourceChecker.php @@ -28,7 +28,7 @@ public function supports(ResourceInterface $metadata) return $metadata instanceof SelfCheckingResourceInterface; } - public function isFresh(ResourceInterface $resource, $timestamp) + public function isFresh(ResourceInterface $resource, int $timestamp) { /* @var SelfCheckingResourceInterface $resource */ return $resource->isFresh($timestamp); diff --git a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php index 34dc35d5f51f8..39a16db9513fd 100644 --- a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php +++ b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php @@ -116,7 +116,7 @@ public function isFresh() * * @throws \RuntimeException When cache file can't be written */ - public function write($content, array $metadata = null) + public function write(string $content, array $metadata = null) { $mode = 0666; $umask = umask(); diff --git a/src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php b/src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php index 0338635ff5a62..fc1702f3cb89a 100644 --- a/src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php +++ b/src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php @@ -32,7 +32,7 @@ public function __construct(iterable $resourceCheckers = []) /** * {@inheritdoc} */ - public function cache($file, $callback) + public function cache(string $file, $callback) { if (!\is_callable($callback)) { throw new \InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', \gettype($callback))); diff --git a/src/Symfony/Component/Config/ResourceCheckerInterface.php b/src/Symfony/Component/Config/ResourceCheckerInterface.php index 612d77786446a..f9724442dd562 100644 --- a/src/Symfony/Component/Config/ResourceCheckerInterface.php +++ b/src/Symfony/Component/Config/ResourceCheckerInterface.php @@ -44,5 +44,5 @@ public function supports(ResourceInterface $metadata); * * @return bool True if the resource has not changed since the given timestamp, false otherwise */ - public function isFresh(ResourceInterface $resource, $timestamp); + public function isFresh(ResourceInterface $resource, int $timestamp); } diff --git a/src/Symfony/Component/Config/Tests/FileLocatorTest.php b/src/Symfony/Component/Config/Tests/FileLocatorTest.php index 0bd97f7d8a38e..d4299111cf111 100644 --- a/src/Symfony/Component/Config/Tests/FileLocatorTest.php +++ b/src/Symfony/Component/Config/Tests/FileLocatorTest.php @@ -115,6 +115,6 @@ public function testLocateEmpty() { $loader = new FileLocator([__DIR__.'/Fixtures']); - $loader->locate(null, __DIR__); + $loader->locate('', __DIR__); } }