Skip to content

Commit

Permalink
Merge pull request #229 from laminas/2.33.x-merge-up-into-3.0.x_r5PZO0RC
Browse files Browse the repository at this point in the history
Merge release 2.33.0 into 3.0.x
  • Loading branch information
gsteel authored Jan 3, 2024
2 parents 2015440 + 5cb12c4 commit fee5cd3
Show file tree
Hide file tree
Showing 22 changed files with 434 additions and 456 deletions.
477 changes: 252 additions & 225 deletions composer.lock

Large diffs are not rendered by default.

248 changes: 92 additions & 156 deletions psalm-baseline.xml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/Helper/HeadLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,20 +241,20 @@ public function append($value)
/**
* offsetSet()
*
* @param int $index
* @param int $offset
* @param object $value
* @throws Exception\InvalidArgumentException
* @return void
* @throws Exception\InvalidArgumentException
*/
public function offsetSet($index, $value)
public function offsetSet($offset, $value)
{
if (! $this->isValid($value)) {
throw new Exception\InvalidArgumentException(
'offsetSet() expects a data token; please use one of the custom offsetSet*() methods'
);
}

$this->getContainer()->offsetSet($index, $value);
$this->getContainer()->offsetSet($offset, $value);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Helper/HeadMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,17 @@ public function offsetSet($index, $value)
/**
* OffsetUnset
*
* @param int $index
* @param int $offset
* @return void
* @throws Exception\InvalidArgumentException
*/
public function offsetUnset($index)
public function offsetUnset($offset)
{
if (! in_array($index, $this->getContainer()->getKeys())) {
if (! in_array($offset, $this->getContainer()->getKeys())) {
throw new Exception\InvalidArgumentException('Invalid index passed to offsetUnset()');
}

$this->getContainer()->offsetUnset($index);
$this->getContainer()->offsetUnset($offset);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Helper/HeadScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,12 +556,12 @@ public function set($value)
/**
* Override offsetSet
*
* @param int $index Set script of file offset
* @param int $offset Set script of file offset
* @param ObjectShape $value
* @throws Exception\InvalidArgumentException
* @return void
* @throws Exception\InvalidArgumentException
*/
public function offsetSet($index, $value)
public function offsetSet($offset, $value)
{
if (! $this->isValid($value)) {
throw new Exception\InvalidArgumentException(
Expand All @@ -570,7 +570,7 @@ public function offsetSet($index, $value)
);
}

$this->getContainer()->offsetSet($index, $value);
$this->getContainer()->offsetSet($offset, $value);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Helper/HeadStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,20 +420,20 @@ public function append($value)
/**
* Override offsetSet to enforce style creation
*
* @param int $index
* @param int $offset
* @param ObjectShape $value
* @throws Exception\InvalidArgumentException
* @return void
* @throws Exception\InvalidArgumentException
*/
public function offsetSet($index, $value)
public function offsetSet($offset, $value)
{
if (! $this->isValid($value)) {
throw new Exception\InvalidArgumentException(
'Invalid value passed to offsetSet; please use offsetSetStyle()',
);
}

$this->getContainer()->offsetSet($index, $value);
$this->getContainer()->offsetSet($offset, $value);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/HtmlObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class HtmlObject extends AbstractHtmlElement
* @param string $type Data file type
* @param array $attribs Attribs for the object tag
* @param array $params Params for in the object tag
* @param string $content Alternative content for object
* @param string|list<string>|null $content Alternative content for object
* @throws InvalidArgumentException
* @return string
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Helper/Navigation/AbstractHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ public function getIndent()
/**
* Sets the maximum depth a page can have to be included when rendering
*
* @param int $maxDepth Default is null, which sets no maximum depth.
* @param int|null|numeric-string $maxDepth Default is null, which sets no maximum depth.
* @return AbstractHelper
*/
public function setMaxDepth($maxDepth = null)
Expand All @@ -645,7 +645,7 @@ public function getMaxDepth()
/**
* Sets the minimum depth a page must have to be included when rendering
*
* @param int $minDepth Default is null, which sets no minimum depth.
* @param int|null|numeric-string $minDepth Default is null, which sets no minimum depth.
* @return AbstractHelper
*/
public function setMinDepth($minDepth = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/Placeholder/Container/AbstractContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Abstract class representing container for placeholder values
*
* @template TKey
* @template TKey of array-key
* @template TValue
* @extends ArrayObject<TKey, TValue>
*/
Expand Down
7 changes: 3 additions & 4 deletions src/Helper/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

use function array_merge;
use function func_num_args;
use function gettype;
use function get_debug_type;
use function is_array;
use function is_bool;
use function is_object;
use function iterator_to_array;
use function sprintf;

Expand Down Expand Up @@ -121,7 +120,7 @@ public function setRouter($router)
'%s expects a %s instance; received %s',
__METHOD__,
RouteStackInterface::class,
is_object($router) ? $router::class : gettype($router)
get_debug_type($router),
));
}

Expand All @@ -143,7 +142,7 @@ public function setRouteMatch($routeMatch)
'%s expects a %s instance; received %s',
__METHOD__,
RouteMatch::class,
is_object($routeMatch) ? $routeMatch::class : gettype($routeMatch)
get_debug_type($routeMatch),
));
}

Expand Down
8 changes: 4 additions & 4 deletions src/Model/ModelInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ public function setOption($name, $value);
/**
* Set renderer options/hints en masse
*
* @param array|Traversable $options
* @param array<string, mixed>|Traversable<string, mixed> $options
* @return ModelInterface
*/
public function setOptions($options);

/**
* Get renderer options/hints
*
* @return array|Traversable
* @return array<string, mixed>|Traversable<string, mixed>
*/
public function getOptions();

Expand All @@ -66,15 +66,15 @@ public function setVariable($name, $value);
/**
* Set view variables en masse
*
* @param array|ArrayAccess $variables
* @param array<string, mixed>|ArrayAccess<string, mixed> $variables
* @return ModelInterface
*/
public function setVariables($variables);

/**
* Get view variables
*
* @return array|ArrayAccess
* @return array<string, mixed>|ArrayAccess<string, mixed>
*/
public function getVariables();

Expand Down
15 changes: 8 additions & 7 deletions src/Model/ViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use function array_key_exists;
use function array_merge;
use function count;
use function get_debug_type;
use function gettype;
use function is_array;
use function is_object;
Expand All @@ -39,7 +40,7 @@ class ViewModel implements ModelInterface, ClearableModelInterface, RetrievableC
/**
* Renderer options
*
* @var array
* @var array<string, mixed>
*/
protected $options = [];

Expand Down Expand Up @@ -75,8 +76,8 @@ class ViewModel implements ModelInterface, ClearableModelInterface, RetrievableC
/**
* Constructor
*
* @param null|array|Traversable|ArrayAccess $variables
* @param array|Traversable $options
* @param null|array<string, mixed>|Traversable<string, mixed>|ArrayAccess<string, mixed> $variables
* @param null|array<string, mixed>|Traversable<string, mixed> $options
*/
public function __construct($variables = null, $options = null)
{
Expand Down Expand Up @@ -191,7 +192,7 @@ public function getOption($name, $default = null)
/**
* Set renderer options/hints en masse
*
* @param array|Traversable $options
* @param array<string, mixed>|Traversable<string, mixed> $options
* @throws Exception\InvalidArgumentException
* @return ViewModel
*/
Expand All @@ -207,7 +208,7 @@ public function setOptions($options)
throw new Exception\InvalidArgumentException(sprintf(
'%s: expects an array, or Traversable argument; received "%s"',
__METHOD__,
is_object($options) ? $options::class : gettype($options)
get_debug_type($options),
));
}

Expand All @@ -218,7 +219,7 @@ public function setOptions($options)
/**
* Get renderer options/hints
*
* @return array
* @return array<string, mixed>
*/
public function getOptions()
{
Expand All @@ -228,7 +229,7 @@ public function getOptions()
/**
* Clear any existing renderer options/hints
*
* @return ViewModel
* @return $this
*/
public function clearOptions()
{
Expand Down
7 changes: 3 additions & 4 deletions src/Renderer/FeedRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
use Laminas\View\Model\ModelInterface as Model;
use Laminas\View\Resolver\ResolverInterface as Resolver;

use function gettype;
use function get_debug_type;
use function in_array;
use function is_object;
use function is_string;
use function sprintf;
use function strtolower;
Expand Down Expand Up @@ -59,7 +58,7 @@ public function setResolver(Resolver $resolver)
*
* @todo Determine what use case exists for accepting only $nameOrModel
* @param string|Model $nameOrModel The script/resource process, or a view model
* @param null|array|ArrayAccess $values Values to use during rendering
* @param null|array<string, mixed>|ArrayAccess<string, mixed> $values Values to use during rendering
* @throws Exception\InvalidArgumentException
* @return string The script output.
*/
Expand Down Expand Up @@ -87,7 +86,7 @@ public function render($nameOrModel, $values = null)
throw new Exception\InvalidArgumentException(sprintf(
'%s expects a ViewModel or a string feed type as the first argument; received "%s"',
__METHOD__,
is_object($nameOrModel) ? $nameOrModel::class : gettype($nameOrModel)
get_debug_type($nameOrModel),
));
}

Expand Down
16 changes: 10 additions & 6 deletions src/Renderer/PhpRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@

use function array_key_exists;
use function array_pop;
use function assert;
use function call_user_func_array;
use function class_exists;
use function extract;
use function get_debug_type;
use function gettype;
use function is_array;
use function is_callable;
Expand Down Expand Up @@ -137,7 +139,7 @@ class PhpRenderer implements Renderer, TreeRendererInterface
private $__filterChain;

/**
* @var ArrayAccess|array|null ArrayAccess or associative array representing available variables
* @var Variables|null
*/
private $__vars;

Expand Down Expand Up @@ -218,7 +220,7 @@ public function resolver($name = null)
*
* Expects either an array, or an object implementing ArrayAccess.
*
* @param array|ArrayAccess $variables
* @param array<string, mixed>|ArrayAccess<string, mixed> $variables
* @return PhpRenderer
* @throws Exception\InvalidArgumentException
*/
Expand All @@ -227,7 +229,7 @@ public function setVars($variables)
if (! is_array($variables) && ! $variables instanceof ArrayAccess) {
throw new Exception\InvalidArgumentException(sprintf(
'Expected array or ArrayAccess object; received "%s"',
is_object($variables) ? $variables::class : gettype($variables)
get_debug_type($variables),
));
}

Expand All @@ -247,15 +249,17 @@ public function setVars($variables)
/**
* Get a single variable, or all variables
*
* @param mixed $key
* @return mixed
* @param string|null $key
* @return ($key is null ? Variables : mixed)
*/
public function vars($key = null)
{
if (null === $this->__vars) {
$this->setVars(new Variables());
}

assert($this->__vars !== null);

if (null === $key) {
return $this->__vars;
}
Expand All @@ -265,7 +269,7 @@ public function vars($key = null)
/**
* Get a single variable
*
* @param mixed $key
* @param string $key
* @return mixed
*/
public function get($key)
Expand Down
4 changes: 2 additions & 2 deletions src/Resolver/TemplatePathStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use function array_change_key_case;
use function count;
use function file_exists;
use function get_debug_type;
use function gettype;
use function is_array;
use function is_object;
use function is_string;
use function ltrim;
use function pathinfo;
Expand Down Expand Up @@ -101,7 +101,7 @@ public function setOptions($options)
if (! is_array($options) && ! $options instanceof Traversable) {
throw new Exception\InvalidArgumentException(sprintf(
'Expected array or Traversable object; received "%s"',
is_object($options) ? $options::class : gettype($options)
get_debug_type($options),
));
}

Expand Down
Loading

0 comments on commit fee5cd3

Please sign in to comment.