Make $usedQueries readonly

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2024-12-17 02:01:37 +00:00
parent df36e752f8
commit 54d42dc0c4
4 changed files with 14 additions and 16 deletions

View File

@ -20460,12 +20460,6 @@ parameters:
count: 1
path: tests/unit/Controllers/Server/Status/ProcessesControllerTest.php
-
message: '#^@readonly property PhpMyAdmin\\Server\\Status\\Data\:\:\$usedQueries is assigned outside of its declaring class\.$#'
identifier: property.readOnlyByPhpDocAssignOutOfClass
count: 1
path: tests/unit/Controllers/Server/Status/QueriesControllerTest.php
-
message: '#^Binary operation "\*" between float\|int and mixed results in an error\.$#'
identifier: binaryOp.invalid

View File

@ -11921,9 +11921,6 @@
<code><![CDATA[Config::getInstance()]]></code>
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
</DeprecatedMethod>
<InaccessibleProperty>
<code><![CDATA[$this->data->usedQueries]]></code>
</InaccessibleProperty>
<PossiblyInvalidOperand>
<code><![CDATA[$this->data->status['Uptime']]]></code>
<code><![CDATA[$this->data->status['Uptime']]]></code>

View File

@ -78,11 +78,8 @@ final class Data
/** @var array<string, string> */
public readonly array $variables;
/**
* @var array<string, string|int|float>
* @readonly
*/
public array $usedQueries;
/** @var array<string, string|int|float> */
public readonly array $usedQueries;
/** @var string[] */
public readonly array $allocationMap;

View File

@ -55,17 +55,27 @@ class QueriesControllerTest extends AbstractTestCase
['Com_delete_multi', '0'],
['Com_create_function', '0'],
['Com_empty_query', '0'],
['Com_change_db' , '15'],
['Com_select' , '12'],
['Com_set_option' , '54'],
['Com_show_databases' , '16'],
['Com_show_status' , '14'],
['Com_show_tables' , '13'],
], ['Variable_name', 'Value']);
$this->data = new Data($dbi, $config);
$this->data->usedQueries = [
}
public function testUsedQueries(): void
{
self::assertSame([
'Com_change_db' => '15',
'Com_select' => '12',
'Com_set_option' => '54',
'Com_show_databases' => '16',
'Com_show_status' => '14',
'Com_show_tables' => '13',
];
], $this->data->usedQueries);
}
public function testIndex(): void