Skip to content
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
24 changes: 0 additions & 24 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5106,12 +5106,6 @@ parameters:
count: 1
path: src/contracts/MVC/View/VariableProvider.php

-
message: '#^Method Ibexa\\Contracts\\Core\\Options\\OptionsBag\:\:all\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/contracts/Options/OptionsBag.php

-
message: '#^Method Ibexa\\Contracts\\Core\\Persistence\\Bookmark\\Handler\:\:loadByUserIdAndLocationId\(\) has parameter \$locationIds with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -11856,24 +11850,6 @@ parameters:
count: 1
path: src/lib/MVC/Symfony/Templating/RenderLocationStrategy.php

-
message: '#^Method Ibexa\\Core\\MVC\\Symfony\\Templating\\RenderOptions\:\:__construct\(\) has parameter \$options with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/MVC/Symfony/Templating/RenderOptions.php

-
message: '#^Method Ibexa\\Core\\MVC\\Symfony\\Templating\\RenderOptions\:\:all\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/MVC/Symfony/Templating/RenderOptions.php

-
message: '#^Property Ibexa\\Core\\MVC\\Symfony\\Templating\\RenderOptions\:\:\$options type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/MVC/Symfony/Templating/RenderOptions.php

-
message: '#^Method Ibexa\\Core\\MVC\\Symfony\\Templating\\RenderStrategy\:\:__construct\(\) has parameter \$strategies with no value type specified in iterable type iterable\.$#'
identifier: missingType.iterableValue
Expand Down
7 changes: 5 additions & 2 deletions src/contracts/Options/MutableOptionsBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
interface MutableOptionsBag extends OptionsBag
{
/**
* @param mixed|null $value
* Sets the value of the option identified by $key.
*/
public function set(string $key, $value): void;
public function set(string $key, mixed $value): void;

/**
* Removes the option identified by $key.
*/
public function remove(string $key): void;
}
14 changes: 11 additions & 3 deletions src/contracts/Options/OptionsBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@

interface OptionsBag
{
/**
* Returns all options as an associative array.
*
* @return array<string, mixed>
*/
public function all(): array;

/**
* @param mixed|null $default
* Returns the value of the option identified by $key.
*
* @return mixed|null
* If the option does not exist, returns $default.
*/
public function get(string $key, $default = null);
public function get(string $key, mixed $default = null): mixed;

/**
* Checks if the option identified by $key exists.
*/
public function has(string $key): bool;
}
19 changes: 7 additions & 12 deletions src/lib/MVC/Symfony/Templating/RenderOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@

final class RenderOptions implements MutableOptionsBag
{
/** @var array */
private $options;
/** @var array<string, mixed> */
private array $options;

/**
* @param array<string, mixed> $options
*/
public function __construct(array $options = [])
{
$this->options = $options;
Expand All @@ -25,12 +28,7 @@ public function all(): array
return $this->options;
}

/**
* @param mixed|null $default
*
* @return mixed|null
*/
public function get(string $key, $default = null)
public function get(string $key, mixed $default = null): mixed
{
if ($this->has($key)) {
return $this->options[$key];
Expand All @@ -39,10 +37,7 @@ public function get(string $key, $default = null)
return $default;
}

/**
* @param mixed|null $value
*/
public function set(string $key, $value): void
public function set(string $key, mixed $value): void
{
$this->options[$key] = $value;
}
Expand Down
Loading