Fix type hints
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
c8178c4120
commit
5179754bb9
@ -8280,12 +8280,6 @@ parameters:
|
||||
count: 2
|
||||
path: src/Plugins.php
|
||||
|
||||
-
|
||||
message: '#^Call to function in_array\(\) with arguments \(class\-string\<PhpMyAdmin\\Properties\\Options\\Groups\\OptionsPropertySubgroup\>&literal\-string\)\|null, array\{''PhpMyAdmin\\\\Properties\\\\Options\\\\Items\\\\BoolPropertyItem'', ''PhpMyAdmin\\\\Properties\\\\Options\\\\Items\\\\MessageOnlyPropertyItem'', ''PhpMyAdmin\\\\Properties\\\\Options\\\\Items\\\\SelectPropertyItem'', ''PhpMyAdmin\\\\Properties\\\\Options\\\\Items\\\\TextPropertyItem''\} and true will always evaluate to false\.$#'
|
||||
identifier: function.impossibleType
|
||||
count: 1
|
||||
path: src/Plugins.php
|
||||
|
||||
-
|
||||
message: '#^Call to function method_exists\(\) with PhpMyAdmin\\Properties\\Options\\OptionsPropertyItem and ''getText'' will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
|
||||
@ -5638,14 +5638,6 @@
|
||||
<RiskyTruthyFalsyComparison>
|
||||
<code><![CDATA[empty(Config::getInstance()->settings[$section][$opt])]]></code>
|
||||
</RiskyTruthyFalsyComparison>
|
||||
<TypeDoesNotContainType>
|
||||
<code><![CDATA[in_array($propertyClass, [
|
||||
BoolPropertyItem::class,
|
||||
MessageOnlyPropertyItem::class,
|
||||
SelectPropertyItem::class,
|
||||
TextPropertyItem::class,
|
||||
], true)]]></code>
|
||||
</TypeDoesNotContainType>
|
||||
<UndefinedMethod>
|
||||
<code><![CDATA[getProperties]]></code>
|
||||
</UndefinedMethod>
|
||||
|
||||
@ -28,6 +28,7 @@ use PhpMyAdmin\Properties\Options\Items\SelectPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\OptionsPropertyGroup;
|
||||
use PhpMyAdmin\Properties\Options\OptionsPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\OptionsPropertyOneItem;
|
||||
use SplFileInfo;
|
||||
use Throwable;
|
||||
|
||||
@ -326,14 +327,12 @@ class Plugins
|
||||
|
||||
$propertyClass = null;
|
||||
if ($properties !== null) {
|
||||
/** @var OptionsPropertySubgroup $propertyItem */
|
||||
foreach ($properties as $propertyItem) {
|
||||
$propertyClass = $propertyItem::class;
|
||||
// if the property is a subgroup, we deal with it recursively
|
||||
if (str_contains($propertyClass, 'Subgroup')) {
|
||||
if ($propertyItem instanceof OptionsPropertySubgroup) {
|
||||
// for subgroups
|
||||
// each subgroup can have a header, which may also be a form element
|
||||
/** @var OptionsPropertyItem|null $subgroupHeader */
|
||||
$subgroupHeader = $propertyItem->getSubgroupHeader();
|
||||
if ($subgroupHeader !== null) {
|
||||
$ret .= self::getOneOption($plugin, $section, $pluginName, $subgroupHeader);
|
||||
|
||||
@ -5,21 +5,21 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Properties\Options\Groups;
|
||||
|
||||
use PhpMyAdmin\Properties\Options\OptionsPropertyGroup;
|
||||
use PhpMyAdmin\Properties\PropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\OptionsPropertyOneItem;
|
||||
|
||||
/**
|
||||
* Group property item class of type subgroup
|
||||
*/
|
||||
class OptionsPropertySubgroup extends OptionsPropertyGroup
|
||||
{
|
||||
private PropertyItem|null $subgroupHeader = null;
|
||||
private OptionsPropertyOneItem|null $subgroupHeader = null;
|
||||
|
||||
public function getSubgroupHeader(): PropertyItem|null
|
||||
public function getSubgroupHeader(): OptionsPropertyOneItem|null
|
||||
{
|
||||
return $this->subgroupHeader;
|
||||
}
|
||||
|
||||
public function setSubgroupHeader(PropertyItem $subgroupHeader): void
|
||||
public function setSubgroupHeader(OptionsPropertyOneItem $subgroupHeader): void
|
||||
{
|
||||
$this->subgroupHeader = $subgroupHeader;
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Tests\Properties\Options\Groups;
|
||||
|
||||
use PhpMyAdmin\Properties\Options\Groups\OptionsPropertySubgroup;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
@ -40,7 +41,7 @@ class OptionsPropertySubgroupTest extends AbstractTestCase
|
||||
*/
|
||||
public function testGetSetSubgroupHeader(): void
|
||||
{
|
||||
$propertyItem = new OptionsPropertySubgroup();
|
||||
$propertyItem = new BoolPropertyItem();
|
||||
$this->object->setSubgroupHeader($propertyItem);
|
||||
|
||||
self::assertSame(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user