Skip to content

Commit

Permalink
Use explicit nullable type
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhelias committed Apr 19, 2024
1 parent 3b5ed46 commit 7904b1e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Asset/EntrypointLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class EntrypointLookup implements EntrypointLookupInterface, IntegrityDataProvid

private $strictMode;

public function __construct(string $entrypointJsonPath, CacheItemPoolInterface $cache = null, string $cacheKey = null, bool $strictMode = true)
public function __construct(string $entrypointJsonPath, ?CacheItemPoolInterface $cache = null, ?string $cacheKey = null, bool $strictMode = true)
{
$this->entrypointJsonPath = $entrypointJsonPath;
$this->cache = $cache;
Expand Down
4 changes: 2 additions & 2 deletions src/Asset/EntrypointLookupCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class EntrypointLookupCollection implements EntrypointLookupCollectionInterface

private $defaultBuildName;

public function __construct(ContainerInterface $buildEntrypoints, string $defaultBuildName = null)
public function __construct(ContainerInterface $buildEntrypoints, ?string $defaultBuildName = null)
{
$this->buildEntrypoints = $buildEntrypoints;
$this->defaultBuildName = $defaultBuildName;
}

public function getEntrypointLookup(string $buildName = null): EntrypointLookupInterface
public function getEntrypointLookup(?string $buildName = null): EntrypointLookupInterface
{
if (null === $buildName) {
if (null === $this->defaultBuildName) {
Expand Down
2 changes: 1 addition & 1 deletion src/Asset/EntrypointLookupCollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ interface EntrypointLookupCollectionInterface
*
* @throws UndefinedBuildException if the build does not exist
*/
public function getEntrypointLookup(string $buildName = null): EntrypointLookupInterface;
public function getEntrypointLookup(?string $buildName = null): EntrypointLookupInterface;
}
8 changes: 4 additions & 4 deletions src/Asset/TagRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
array $defaultAttributes = [],
array $defaultScriptAttributes = [],
array $defaultLinkAttributes = [],
EventDispatcherInterface $eventDispatcher = null
?EventDispatcherInterface $eventDispatcher = null
) {
$this->entrypointLookupCollection = $entrypointLookupCollection;
$this->packages = $packages;
Expand All @@ -46,7 +46,7 @@ public function __construct(
$this->reset();
}

public function renderWebpackScriptTags(string $entryName, string $packageName = null, string $entrypointName = null, array $extraAttributes = []): string
public function renderWebpackScriptTags(string $entryName, ?string $packageName = null, ?string $entrypointName = null, array $extraAttributes = []): string
{
$entrypointName = $entrypointName ?: '_default';
$scriptTags = [];
Expand Down Expand Up @@ -83,7 +83,7 @@ public function renderWebpackScriptTags(string $entryName, string $packageName =
return implode('', $scriptTags);
}

public function renderWebpackLinkTags(string $entryName, string $packageName = null, string $entrypointName = null, array $extraAttributes = []): string
public function renderWebpackLinkTags(string $entryName, ?string $packageName = null, ?string $entrypointName = null, array $extraAttributes = []): string
{
$entrypointName = $entrypointName ?: '_default';
$scriptTags = [];
Expand Down Expand Up @@ -144,7 +144,7 @@ public function reset(): void
];
}

private function getAssetPath(string $assetPath, string $packageName = null): string
private function getAssetPath(string $assetPath, ?string $packageName = null): string
{
if (null === $this->packages) {
throw new \Exception('To render the script or link tags, run "composer require symfony/asset".');
Expand Down
2 changes: 1 addition & 1 deletion src/CacheWarmer/EntrypointCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(array $cacheKeys, string $phpArrayFile)
parent::__construct($phpArrayFile);
}

protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, string $buildDir = null): bool
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, ?string $buildDir = null): bool
{
foreach ($this->cacheKeys as $cacheKey => $path) {
// If the file does not exist then just skip past this entry point.
Expand Down
4 changes: 2 additions & 2 deletions src/Twig/EntryFilesTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public function getWebpackCssFiles(string $entryName, string $entrypointName = '
->getCssFiles($entryName);
}

public function renderWebpackScriptTags(string $entryName, string $packageName = null, string $entrypointName = '_default', array $attributes = []): string
public function renderWebpackScriptTags(string $entryName, ?string $packageName = null, string $entrypointName = '_default', array $attributes = []): string
{
return $this->getTagRenderer()
->renderWebpackScriptTags($entryName, $packageName, $entrypointName, $attributes);
}

public function renderWebpackLinkTags(string $entryName, string $packageName = null, string $entrypointName = '_default', array $attributes = []): string
public function renderWebpackLinkTags(string $entryName, ?string $packageName = null, string $entrypointName = '_default', array $attributes = []): string
{
return $this->getTagRenderer()
->renderWebpackLinkTags($entryName, $packageName, $entrypointName, $attributes);
Expand Down

0 comments on commit 7904b1e

Please sign in to comment.