Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust to latest codestyle rules #1569

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
adjust to latest codestyle rules
  • Loading branch information
dbu committed Feb 23, 2024
commit f51040286f60248eef6f3d12102b605afb09f2db
2 changes: 1 addition & 1 deletion Async/ResolveCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ResolveCache implements \JsonSerializable
/**
* @param string[]|null $filters
*/
public function __construct(string $path, array $filters = null, bool $force = false)
public function __construct(string $path, ?array $filters = null, bool $force = false)
{
$this->path = $path;
$this->filters = $filters;
Expand Down
12 changes: 6 additions & 6 deletions Component/Console/Style/ImagineStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public function newline(int $count = 1): self
return $this;
}

public function status(string $status, string $fg = null): self
public function status(string $status, ?string $fg = null): self
{
return $this->text(
sprintf('<fg=%2$s>(</><fg=%2$s;options=bold>%1$s</><fg=%2$s>)</>', $status, $fg ?: 'default')
);
}

public function group(string $item, string $group, string $fg = null): self
public function group(string $item, string $group, ?string $fg = null): self
{
$this->text(
sprintf('<fg=%3$s;options=bold>%1$s[</><fg=%3$s>%2$s</><fg=%3$s;options=bold>]</>', $item, $group, $fg ?: 'default')
Expand All @@ -74,7 +74,7 @@ public function group(string $item, string $group, string $fg = null): self
return $this->space();
}

public function title(string $title, string $type = null): self
public function title(string $title, ?string $type = null): self
{
if (!$this->decoration) {
return $this->plainTitle($title, $type);
Expand All @@ -93,7 +93,7 @@ public function critBlock(string $string, array $replacements = []): self
return $this->largeBlock($this->compileString(strip_tags($string), $replacements), 'ERROR', 'white', 'red', '#');
}

private function largeBlock(string $string, string $type, string $fg = null, string $bg = null, string $prefix = null): self
private function largeBlock(string $string, string $type, ?string $fg = null, ?string $bg = null, ?string $prefix = null): self
{
return $this->block($string, $type, $fg, $bg, $prefix, true);
}
Expand All @@ -103,7 +103,7 @@ private function space(int $count = 1): self
return $this->text(str_repeat(' ', $count));
}

private function plainTitle(string $title, string $type = null): self
private function plainTitle(string $title, ?string $type = null): self
{
$this->newline();

Expand All @@ -116,7 +116,7 @@ private function plainTitle(string $title, string $type = null): self
return $this->newline();
}

private function block(string $string, string $type = null, string $fg = null, string $bg = null, string $prefix = null, bool $padding = true): self
private function block(string $string, ?string $type = null, ?string $fg = null, ?string $bg = null, ?string $prefix = null, bool $padding = true): self
{
if (!$this->decoration) {
return $this->plainBlock($string, $type);
Expand Down
2 changes: 1 addition & 1 deletion Config/Filter/Argument/Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class Point
*/
private $y;

public function __construct(int $x = null, int $y = null)
public function __construct(?int $x = null, ?int $y = null)
{
$this->x = $x;
$this->y = $y;
Expand Down
2 changes: 1 addition & 1 deletion Config/Filter/Argument/Size.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class Size
* To allow keeping aspect ratio, it is allowed to only specify one of width or height.
* It is however not allowed to specify neither dimension.
*/
public function __construct(int $width = null, int $height = null)
public function __construct(?int $width = null, ?int $height = null)
{
$this->width = $width;
$this->height = $height;
Expand Down
6 changes: 3 additions & 3 deletions Config/Filter/Type/Background.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ final class Background extends FilterAbstract
* @param string|null $position position of the input image on the newly created background image. Valid values: topleft, top, topright, left, center, right, bottomleft, bottom, and bottomright
*/
public function __construct(
string $color = null,
string $transparency = null,
string $position = null,
?string $color,
?string $transparency,
?string $position,
Size $size
) {
$this->color = $color;
Expand Down
2 changes: 1 addition & 1 deletion Config/Filter/Type/Downscale.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class Downscale extends FilterAbstract
/**
* @param float|null $by sets the "ratio multiple" which initiates a proportional scale operation computed by multiplying all image sides by this value
*/
public function __construct(Size $max = null, float $by = null)
public function __construct(?Size $max = null, ?float $by = null)
{
$this->max = $max;
$this->by = $by;
Expand Down
8 changes: 4 additions & 4 deletions Config/Filter/Type/RelativeResize.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ final class RelativeResize extends FilterAbstract
private $scale;

public function __construct(
float $heighten = null,
float $widen = null,
float $increase = null,
float $scale = null
?float $heighten = null,
?float $widen = null,
?float $increase = null,
?float $scale = null
) {
$this->heighten = $heighten;
$this->widen = $widen;
Expand Down
2 changes: 1 addition & 1 deletion Config/Filter/Type/Scale.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class Scale extends FilterAbstract
/**
* @param float|null $to proportional scale operation computed by multiplying all image sides by this value
*/
public function __construct(Size $dimensions, float $to = null)
public function __construct(Size $dimensions, ?float $to = null)
{
$this->dimensions = $dimensions;
$this->to = $to;
Expand Down
6 changes: 3 additions & 3 deletions Config/Filter/Type/Thumbnail.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ final class Thumbnail extends FilterAbstract

public function __construct(
Size $size,
string $mode = null,
bool $allowUpscale = null,
string $filter = null
?string $mode = null,
?bool $allowUpscale = null,
?string $filter = null
) {
$this->size = $size;
$this->mode = $mode;
Expand Down
2 changes: 1 addition & 1 deletion Config/Filter/Type/Upscale.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class Upscale extends FilterAbstract
/**
* @param float $by sets the "ratio multiple" which initiates a proportional scale operation computed by multiplying all image sides by this value
*/
public function __construct(Size $min, float $by = null)
public function __construct(Size $min, ?float $by = null)
{
$this->min = $min;
$this->by = $by;
Expand Down
2 changes: 1 addition & 1 deletion Config/Filter/Type/Watermark.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class Watermark extends FilterAbstract
*/
private $size;

public function __construct(string $image, string $position, float $size = null)
public function __construct(string $image, string $position, ?float $size = null)
{
$this->image = $image;
$this->position = $position;
Expand Down
2 changes: 1 addition & 1 deletion Config/Stack.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class Stack implements StackInterface
* @param string|null $dataLoader name of a custom data loader. Default value: filesystem (which means the standard filesystem loader is used).
* @param FilterInterface[] $filters
*/
public function __construct(string $name, string $dataLoader = null, int $quality = null, array $filters)
public function __construct(string $name, ?string $dataLoader, ?int $quality, array $filters)
{
$this->name = $name;
$this->dataLoader = $dataLoader;
Expand Down
4 changes: 2 additions & 2 deletions Controller/ImagineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(
FilterService $filterService,
DataManager $dataManager,
SignerInterface $signer,
ControllerConfig $controllerConfig = null
?ControllerConfig $controllerConfig = null
) {
$this->filterService = $filterService;
$this->dataManager = $dataManager;
Expand Down Expand Up @@ -156,7 +156,7 @@ private function getFiltersBc(Request $request): array
return $runtimeConfig;
}

private function createRedirectResponse(\Closure $url, string $path, string $filter, string $hash = null): RedirectResponse
private function createRedirectResponse(\Closure $url, string $path, string $filter, ?string $hash = null): RedirectResponse
{
try {
return new RedirectResponse($url(), $this->controllerConfig->getRedirectResponseCode());
Expand Down
2 changes: 1 addition & 1 deletion Factory/Config/Filter/Argument/SizeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class SizeFactory
{
public function create(int $width = null, int $height = null): Size
public function create(?int $width = null, ?int $height = null): Size
{
return new Size($width, $height);
}
Expand Down
2 changes: 1 addition & 1 deletion Factory/Config/StackFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
final class StackFactory implements StackFactoryInterface
{
public function create(string $name, string $dataLoader = null, int $quality = null, array $filters): StackInterface
public function create(string $name, ?string $dataLoader, ?int $quality, array $filters): StackInterface
{
return new Stack($name, $dataLoader, $quality, $filters);
}
Expand Down
2 changes: 1 addition & 1 deletion Factory/Config/StackFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ interface StackFactoryInterface
/**
* @param FilterInterface[] $filters
*/
public function create(string $name, string $dataLoader = null, int $quality = null, array $filters): StackInterface;
public function create(string $name, ?string $dataLoader, ?int $quality, array $filters): StackInterface;
}
2 changes: 1 addition & 1 deletion Imagine/Cache/Resolver/AbstractFilesystemResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(Filesystem $filesystem)
$this->filesystem = $filesystem;
}

public function setRequest(Request $request = null)
public function setRequest(?Request $request = null)
{
$this->request = $request;
}
Expand Down
2 changes: 1 addition & 1 deletion Imagine/Cache/Resolver/CacheResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CacheResolver implements ResolverInterface
* * index_key
* The name of the index key being used to save a list of created cache keys regarding one image and filter pairing.
*/
public function __construct(Cache $cache, ResolverInterface $cacheResolver, array $options = [], OptionsResolver $optionsResolver = null)
public function __construct(Cache $cache, ResolverInterface $cacheResolver, array $options = [], ?OptionsResolver $optionsResolver = null)
{
$this->cache = $cache;
$this->resolver = $cacheResolver;
Expand Down
2 changes: 1 addition & 1 deletion Imagine/Cache/Resolver/PsrCacheResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final class PsrCacheResolver implements ResolverInterface
* * index_key
* The name of the index key being used to save a list of created cache keys regarding one image and filter pairing.
*/
public function __construct(CacheItemPoolInterface $cache, ResolverInterface $cacheResolver, array $options = [], OptionsResolver $optionsResolver = null)
public function __construct(CacheItemPoolInterface $cache, ResolverInterface $cacheResolver, array $options = [], ?OptionsResolver $optionsResolver = null)
{
$this->cache = $cache;
$this->resolver = $cacheResolver;
Expand Down
4 changes: 2 additions & 2 deletions Imagine/Cache/Signer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct($secret)
$this->secret = $secret;
}

public function sign($path, array $runtimeConfig = null)
public function sign($path, ?array $runtimeConfig = null)
{
if ($runtimeConfig) {
array_walk_recursive($runtimeConfig, function (&$value) {
Expand All @@ -37,7 +37,7 @@ public function sign($path, array $runtimeConfig = null)
return mb_substr(preg_replace('/[^a-zA-Z0-9-_]/', '', base64_encode(hash_hmac('sha256', ltrim($path, '/').(null === $runtimeConfig ?: serialize($runtimeConfig)), $this->secret, true))), 0, 8);
}

public function check($hash, $path, array $runtimeConfig = null)
public function check($hash, $path, ?array $runtimeConfig = null)
{
return $hash === $this->sign($path, $runtimeConfig);
}
Expand Down
4 changes: 2 additions & 2 deletions Imagine/Cache/SignerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface SignerInterface
*
* @return string
*/
public function sign($path, array $runtimeConfig = null);
public function sign($path, ?array $runtimeConfig = null);

/**
* Check hash is correct.
Expand All @@ -30,5 +30,5 @@ public function sign($path, array $runtimeConfig = null);
*
* @return bool
*/
public function check($hash, $path, array $runtimeConfig = null);
public function check($hash, $path, ?array $runtimeConfig = null);
}
6 changes: 3 additions & 3 deletions Imagine/Filter/PostProcessor/AbstractPostProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class AbstractPostProcessor implements PostProcessorInterface
*/
private $filesystem;

public function __construct(string $executablePath, string $temporaryRootPath = null)
public function __construct(string $executablePath, ?string $temporaryRootPath = null)
{
$this->executablePath = $executablePath;
$this->temporaryRootPath = $temporaryRootPath;
Expand Down Expand Up @@ -79,7 +79,7 @@ protected function isBinaryTypeMatch(BinaryInterface $binary, array $types): boo
return \in_array($binary->getMimeType(), $types, true);
}

protected function writeTemporaryFile(BinaryInterface $binary, array $options = [], string $prefix = null): string
protected function writeTemporaryFile(BinaryInterface $binary, array $options = [], ?string $prefix = null): string
{
$temporary = $this->acquireTemporaryFilePath($options, $prefix);

Expand All @@ -92,7 +92,7 @@ protected function writeTemporaryFile(BinaryInterface $binary, array $options =
return $temporary;
}

protected function acquireTemporaryFilePath(array $options, string $prefix = null): string
protected function acquireTemporaryFilePath(array $options, ?string $prefix = null): string
{
$root = $options['temp_dir'] ?? $this->temporaryRootPath ?: sys_get_temp_dir();

Expand Down
14 changes: 7 additions & 7 deletions Imagine/Filter/PostProcessor/CwebpPostProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ class CwebpPostProcessor extends AbstractPostProcessor
*/
public function __construct(
string $executablePath = '/usr/bin/cwebp',
string $temporaryRootPath = null,
int $q = null,
int $alphaQ = null,
int $m = null,
string $alphaFilter = null,
int $alphaMethod = null,
bool $exact = null,
?string $temporaryRootPath = null,
?int $q = null,
?int $alphaQ = null,
?int $m = null,
?string $alphaFilter = null,
?int $alphaMethod = null,
?bool $exact = null,
array $metadata = []
) {
parent::__construct($executablePath, $temporaryRootPath);
Expand Down
2 changes: 1 addition & 1 deletion Message/WarmupCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class WarmupCache
* @param string[]|null $filters List of filter set names to warm up. If not set, all available filter sets are warmed up
* @param bool $force Whether to recreate existing cached images or only create them when no cache currently exists
*/
public function __construct(string $path, array $filters = null, bool $force = false)
public function __construct(string $path, ?array $filters = null, bool $force = false)
{
$this->path = $path;
$this->filters = $filters;
Expand Down
8 changes: 4 additions & 4 deletions Service/FilterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(
CacheManager $cacheManager,
bool $webpGenerate,
array $webpOptions,
LoggerInterface $logger = null
?LoggerInterface $logger = null
) {
$this->dataManager = $dataManager;
$this->filterManager = $filterManager;
Expand Down Expand Up @@ -96,7 +96,7 @@ public function bustCache($path, $filter)
public function warmUpCache(
string $path,
string $filter,
string $resolver = null,
?string $resolver = null,
bool $forced = false
): bool {
$warmedUp = false;
Expand Down Expand Up @@ -177,7 +177,7 @@ private function buildFilterPathContainers(string $source, string $target = '',
private function resolveFilterPathContainer(
FilterPathContainer $filterPathContainer,
string $filter,
string $resolver = null,
?string $resolver = null,
bool $webpSupported = false
): string {
$path = $filterPathContainer->getTarget();
Expand All @@ -197,7 +197,7 @@ private function resolveFilterPathContainer(
private function warmUpCacheFilterPathContainer(
FilterPathContainer $filterPathContainer,
string $filter,
string $resolver = null,
?string $resolver = null,
bool $forced = false
): bool {
if ($forced || !$this->cacheManager->isStored($filterPathContainer->getTarget(), $filter, $resolver)) {
Expand Down
2 changes: 1 addition & 1 deletion Templating/FilterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function filterCache(
string $path,
string $filter,
array $config = [],
string $resolver = null
?string $resolver = null
): string {
$path = parse_url($path, PHP_URL_PATH);

Expand Down
6 changes: 3 additions & 3 deletions Templating/LazyFilterRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class LazyFilterRuntime implements RuntimeExtensionInterface
*/
private $assetVersion;

public function __construct(CacheManager $cache, string $assetVersion = null)
public function __construct(CacheManager $cache, ?string $assetVersion = null)
{
$this->cache = $cache;
$this->assetVersion = $assetVersion;
Expand All @@ -38,7 +38,7 @@ public function __construct(CacheManager $cache, string $assetVersion = null)
/**
* Gets the browser path for the image and filter to apply.
*/
public function filter(string $path, string $filter, array $config = [], string $resolver = null, int $referenceType = UrlGeneratorInterface::ABSOLUTE_URL): string
public function filter(string $path, string $filter, array $config = [], ?string $resolver = null, int $referenceType = UrlGeneratorInterface::ABSOLUTE_URL): string
{
$path = $this->cleanPath($path);
$path = $this->cache->getBrowserPath($path, $filter, $config, $resolver, $referenceType);
Expand All @@ -51,7 +51,7 @@ public function filter(string $path, string $filter, array $config = [], string
*
* This does not check whether the cached image exists or not.
*/
public function filterCache(string $path, string $filter, array $config = [], string $resolver = null): string
public function filterCache(string $path, string $filter, array $config = [], ?string $resolver = null): string
{
$path = $this->cleanPath($path);
if (\count($config)) {
Expand Down
Loading
Loading