From 5fe2486c1cd9ed2cdbe2e937097d2932980ffb7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jab=C5=AFrek?= Date: Sun, 6 Oct 2024 14:40:25 +0200 Subject: [PATCH] refactor: add return type hints --- src/DependencyInjection/Configuration.php | 2 +- src/DependencyInjection/EnginiroAssetExtension.php | 3 ++- src/VersionStrategy/HashVersionStrategy.php | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index f4edc56..b4c2998 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -20,7 +20,7 @@ public function __construct(string $defaultManifestPath) { $this->defaultManifestPath = $defaultManifestPath; } - public function getConfigTreeBuilder() { + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('enginiro_asset'); $treeBuilder->getRootNode() diff --git a/src/DependencyInjection/EnginiroAssetExtension.php b/src/DependencyInjection/EnginiroAssetExtension.php index 5013926..b144c97 100644 --- a/src/DependencyInjection/EnginiroAssetExtension.php +++ b/src/DependencyInjection/EnginiroAssetExtension.php @@ -10,6 +10,7 @@ namespace Enginiro\AssetBundle\DependencyInjection; +use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; @@ -19,7 +20,7 @@ class EnginiroAssetExtension extends ConfigurableExtension implements PrependExtensionInterface { private const MANIFEST_PATH = '%s/var/dat/asset-hashes.json'; - public function getConfiguration(array $config, ContainerBuilder $container) { + public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface { $defaultManifestPath = sprintf(self::MANIFEST_PATH, $container->getParameter('kernel.project_dir')); return new Configuration($defaultManifestPath); diff --git a/src/VersionStrategy/HashVersionStrategy.php b/src/VersionStrategy/HashVersionStrategy.php index 875b93e..15a7f0a 100644 --- a/src/VersionStrategy/HashVersionStrategy.php +++ b/src/VersionStrategy/HashVersionStrategy.php @@ -51,7 +51,7 @@ final class HashVersionStrategy implements VersionStrategyInterface, LoggerAware /** * @required */ - public function setLogger(LoggerInterface $logger) { + public function setLogger(LoggerInterface $logger): void { $this->logger = $logger; } @@ -67,7 +67,7 @@ public function __construct(string $manifestPath) { /** * @inheritdoc */ - public function getVersion(string $path) { + public function getVersion(string $path): string { if (strlen($path) >= 2 && $path[0] === '/') { /** @var string $path */ $path = substr($path, 1); @@ -79,7 +79,7 @@ public function getVersion(string $path) { /** * @inheritdoc */ - public function applyVersion(string $path) { + public function applyVersion(string $path): string { $version = $this->getVersion($path); if ($version === '') {