-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hotfix release 2.2.9 - Fix for: Get parameter array handled incorrectly
- Loading branch information
Showing
1 changed file
with
18 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/** | ||
* This file is part of MetaModels/core. | ||
* | ||
* (c) 2012-2019 The MetaModels team. | ||
* (c) 2012-2023 The MetaModels team. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
@@ -12,7 +12,8 @@ | |
* | ||
* @package MetaModels/core | ||
* @author Christian Schiffler <[email protected]> | ||
* @copyright 2012-2019 The MetaModels team. | ||
* @author Ingolf Steinhardt <[email protected]> | ||
* @copyright 2012-2023 The MetaModels team. | ||
* @license https://github.com/MetaModels/core/blob/master/LICENSE LGPL-3.0-or-later | ||
* @filesource | ||
*/ | ||
|
@@ -57,6 +58,16 @@ public function __construct( | |
array $getParameters = [], | ||
array $slugParameters = [] | ||
) { | ||
if (static::class !== __CLASS__) { | ||
// @codingStandardsIgnoreStart | ||
@\trigger_deprecation( | ||
'metamodels/core', | ||
'2.2', | ||
static::class . ' should not extend ' . __CLASS__ . ' as it will become final in 3.0.' | ||
); | ||
// @codingStandardsIgnoreEnd | ||
} | ||
|
||
$this->setPage($page); | ||
foreach ($getParameters as $name => $value) { | ||
$this->setGet($name, $value); | ||
|
@@ -139,12 +150,12 @@ public function getPageValue(string $name) | |
/** | ||
* Add a slug parameter. | ||
* | ||
* @param string $name The slug name. | ||
* @param string $value The slug value. | ||
* @param string $name The slug name. | ||
* @param string|list<string> $value The slug value. | ||
* | ||
* @return self | ||
*/ | ||
public function setGet(string $name, string $value): self | ||
public function setGet(string $name, $value): self | ||
{ | ||
if (empty($value)) { | ||
unset($this->getParameters[$name]); | ||
|
@@ -161,9 +172,9 @@ public function setGet(string $name, string $value): self | |
* | ||
* @param string $name The slug name. | ||
* | ||
* @return string | ||
* @return string|list<string>|null | ||
*/ | ||
public function getGet(string $name): ?string | ||
public function getGet(string $name) | ||
{ | ||
return ($this->getParameters[$name] ?? null); | ||
} | ||
|