Skip to content

Commit

Permalink
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_…
Browse files Browse the repository at this point in the history
…null_value
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
1 parent edb2457 commit 0e98032
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Exception/AssetNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions Packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion PathPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion UrlPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion VersionStrategy/JsonManifestVersionStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion VersionStrategy/StaticVersionStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 0e98032

Please sign in to comment.