From 0e98032106d18e57f57176d616e3fae80db7a845 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Jan 2024 14:51:25 +0100 Subject: [PATCH] Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value --- Exception/AssetNotFoundException.php | 2 +- Package.php | 2 +- Packages.php | 8 ++++---- PathPackage.php | 2 +- UrlPackage.php | 2 +- VersionStrategy/JsonManifestVersionStrategy.php | 2 +- VersionStrategy/StaticVersionStrategy.php | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Exception/AssetNotFoundException.php b/Exception/AssetNotFoundException.php index f60ad30..d066ccd 100644 --- a/Exception/AssetNotFoundException.php +++ b/Exception/AssetNotFoundException.php @@ -24,7 +24,7 @@ class AssetNotFoundException extends RuntimeException * @param int $code Exception code * @param \Throwable $previous Previous exception used for the exception chaining */ - public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null) + public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); diff --git a/Package.php b/Package.php index a74e334..ccd6707 100644 --- a/Package.php +++ b/Package.php @@ -26,7 +26,7 @@ class Package implements PackageInterface private $versionStrategy; private $context; - public function __construct(VersionStrategyInterface $versionStrategy, ContextInterface $context = null) + public function __construct(VersionStrategyInterface $versionStrategy, ?ContextInterface $context = null) { $this->versionStrategy = $versionStrategy; $this->context = $context ?? new NullContext(); diff --git a/Packages.php b/Packages.php index 4d1540e..7673432 100644 --- a/Packages.php +++ b/Packages.php @@ -28,7 +28,7 @@ class Packages /** * @param PackageInterface[] $packages Additional packages indexed by name */ - public function __construct(PackageInterface $defaultPackage = null, iterable $packages = []) + public function __construct(?PackageInterface $defaultPackage = null, iterable $packages = []) { $this->defaultPackage = $defaultPackage; @@ -57,7 +57,7 @@ public function addPackage(string $name, PackageInterface $package) * @throws InvalidArgumentException If there is no package by that name * @throws LogicException If no default package is defined */ - public function getPackage(string $name = null) + public function getPackage(?string $name = null) { if (null === $name) { if (null === $this->defaultPackage) { @@ -82,7 +82,7 @@ public function getPackage(string $name = null) * * @return string */ - public function getVersion(string $path, string $packageName = null) + public function getVersion(string $path, ?string $packageName = null) { return $this->getPackage($packageName)->getVersion($path); } @@ -97,7 +97,7 @@ public function getVersion(string $path, string $packageName = null) * * @return string A public path which takes into account the base path and URL path */ - public function getUrl(string $path, string $packageName = null) + public function getUrl(string $path, ?string $packageName = null) { return $this->getPackage($packageName)->getUrl($path); } diff --git a/PathPackage.php b/PathPackage.php index 3c7c0bf..68dcb88 100644 --- a/PathPackage.php +++ b/PathPackage.php @@ -31,7 +31,7 @@ class PathPackage extends Package /** * @param string $basePath The base path to be prepended to relative paths */ - public function __construct(string $basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null) + public function __construct(string $basePath, VersionStrategyInterface $versionStrategy, ?ContextInterface $context = null) { parent::__construct($versionStrategy, $context); diff --git a/UrlPackage.php b/UrlPackage.php index 9928bb2..9b84222 100644 --- a/UrlPackage.php +++ b/UrlPackage.php @@ -41,7 +41,7 @@ class UrlPackage extends Package /** * @param string|string[] $baseUrls Base asset URLs */ - public function __construct($baseUrls, VersionStrategyInterface $versionStrategy, ContextInterface $context = null) + public function __construct($baseUrls, VersionStrategyInterface $versionStrategy, ?ContextInterface $context = null) { parent::__construct($versionStrategy, $context); diff --git a/VersionStrategy/JsonManifestVersionStrategy.php b/VersionStrategy/JsonManifestVersionStrategy.php index ee7c9eb..650d02d 100644 --- a/VersionStrategy/JsonManifestVersionStrategy.php +++ b/VersionStrategy/JsonManifestVersionStrategy.php @@ -40,7 +40,7 @@ class JsonManifestVersionStrategy implements VersionStrategyInterface * @param string $manifestPath Absolute path to the manifest file * @param bool $strictMode Throws an exception for unknown paths */ - public function __construct(string $manifestPath, HttpClientInterface $httpClient = null, $strictMode = false) + public function __construct(string $manifestPath, ?HttpClientInterface $httpClient = null, $strictMode = false) { $this->manifestPath = $manifestPath; $this->httpClient = $httpClient; diff --git a/VersionStrategy/StaticVersionStrategy.php b/VersionStrategy/StaticVersionStrategy.php index 1d2fb6f..9e6e9ce 100644 --- a/VersionStrategy/StaticVersionStrategy.php +++ b/VersionStrategy/StaticVersionStrategy.php @@ -25,7 +25,7 @@ class StaticVersionStrategy implements VersionStrategyInterface * @param string $version Version number * @param string $format Url format */ - public function __construct(string $version, string $format = null) + public function __construct(string $version, ?string $format = null) { $this->version = $version; $this->format = $format ?: '%s?%s';