Make Status\Data::$status readonly
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
7f5cd0575a
commit
25ca884d61
@ -3948,18 +3948,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Controllers/Server/Status/VariablesController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$haystack of function str_contains expects string, \(int\|string\) given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Server/Status/VariablesController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$name of static method PhpMyAdmin\\Html\\Generator\:\:linkToVarDocumentation\(\) expects string, \(int\|string\) given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Server/Status/VariablesController.php
|
||||
|
||||
-
|
||||
message: '#^Short ternary operator is not allowed\. Use null coalesce operator if applicable or consider using long ternary\.$#'
|
||||
identifier: ternary.shortNotAllowed
|
||||
@ -16296,6 +16284,12 @@ parameters:
|
||||
count: 1
|
||||
path: src/Server/Status/Data.php
|
||||
|
||||
-
|
||||
message: '#^Property PhpMyAdmin\\Server\\Status\\Data\:\:\$status \(array\<string, mixed\>\) does not accept array\<mixed\>\.$#'
|
||||
identifier: assign.propertyType
|
||||
count: 1
|
||||
path: src/Server/Status/Data.php
|
||||
|
||||
-
|
||||
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
|
||||
identifier: foreach.nonIterable
|
||||
@ -20490,12 +20484,6 @@ parameters:
|
||||
count: 1
|
||||
path: tests/unit/Controllers/Server/Status/ProcessesControllerTest.php
|
||||
|
||||
-
|
||||
message: '#^@readonly property PhpMyAdmin\\Server\\Status\\Data\:\:\$status is assigned outside of its declaring class\.$#'
|
||||
identifier: property.readOnlyByPhpDocAssignOutOfClass
|
||||
count: 1
|
||||
path: tests/unit/Controllers/Server/Status/QueriesControllerTest.php
|
||||
|
||||
-
|
||||
message: '#^@readonly property PhpMyAdmin\\Server\\Status\\Data\:\:\$usedQueries is assigned outside of its declaring class\.$#'
|
||||
identifier: property.readOnlyByPhpDocAssignOutOfClass
|
||||
@ -20532,12 +20520,6 @@ parameters:
|
||||
count: 1
|
||||
path: tests/unit/Controllers/Server/Status/QueriesControllerTest.php
|
||||
|
||||
-
|
||||
message: '#^@readonly property PhpMyAdmin\\Server\\Status\\Data\:\:\$status is assigned outside of its declaring class\.$#'
|
||||
identifier: property.readOnlyByPhpDocAssignOutOfClass
|
||||
count: 6
|
||||
path: tests/unit/Controllers/Server/Status/StatusControllerTest.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
|
||||
@ -20553,7 +20535,7 @@ parameters:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 3
|
||||
count: 2
|
||||
path: tests/unit/Controllers/Server/Status/StatusControllerTest.php
|
||||
|
||||
-
|
||||
|
||||
@ -2410,10 +2410,6 @@
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$flush]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArgumentTypeCoercion>
|
||||
<code><![CDATA[$name]]></code>
|
||||
<code><![CDATA[$name]]></code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$dontFormat]]></code>
|
||||
<code><![CDATA[$filterAlert]]></code>
|
||||
@ -9530,6 +9526,9 @@
|
||||
<code><![CDATA[100 * $keyReads]]></code>
|
||||
<code><![CDATA[100 * $keyWrites]]></code>
|
||||
</MixedOperand>
|
||||
<MixedPropertyTypeCoercion>
|
||||
<code><![CDATA[$serverStatus]]></code>
|
||||
</MixedPropertyTypeCoercion>
|
||||
<PossiblyInvalidArgument>
|
||||
<code><![CDATA[$_POST['primary_connection'] ?? null]]></code>
|
||||
</PossiblyInvalidArgument>
|
||||
@ -11979,7 +11978,6 @@
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<InaccessibleProperty>
|
||||
<code><![CDATA[$this->data->status]]></code>
|
||||
<code><![CDATA[$this->data->usedQueries]]></code>
|
||||
</InaccessibleProperty>
|
||||
<MixedArgument>
|
||||
@ -12001,16 +11999,7 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<InaccessibleProperty>
|
||||
<code><![CDATA[$data->status]]></code>
|
||||
<code><![CDATA[$data->status]]></code>
|
||||
<code><![CDATA[$data->status]]></code>
|
||||
<code><![CDATA[$data->status]]></code>
|
||||
<code><![CDATA[$data->status]]></code>
|
||||
<code><![CDATA[$data->status]]></code>
|
||||
</InaccessibleProperty>
|
||||
</file>
|
||||
<file src="tests/unit/Controllers/Server/Status/VariablesControllerTest.php">
|
||||
<DeprecatedMethod>
|
||||
|
||||
@ -69,11 +69,8 @@ final class Data
|
||||
'Opened_files' => 'files',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var mixed[]
|
||||
* @readonly
|
||||
* */
|
||||
public array $status;
|
||||
/** @var array<string, mixed> */
|
||||
public readonly array $status;
|
||||
|
||||
/** @var array<string, string> */
|
||||
public readonly array $sections;
|
||||
|
||||
@ -46,8 +46,18 @@ class QueriesControllerTest extends AbstractTestCase
|
||||
$config->selectedServer['DisableIS'] = false;
|
||||
$config->selectedServer['host'] = 'localhost';
|
||||
|
||||
$this->data = new Data($this->dbi, $config);
|
||||
$this->data->status['Uptime'] = 36000;
|
||||
$dummyDbi = $this->createDbiDummy();
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
$dummyDbi->addResult('SHOW GLOBAL STATUS', [
|
||||
['Uptime' , '36000'],
|
||||
['Aborted_connects' , '0'],
|
||||
['Aborted_clients', '0'],
|
||||
['Com_delete_multi', '0'],
|
||||
['Com_create_function', '0'],
|
||||
['Com_empty_query', '0'],
|
||||
], ['Variable_name', 'Value']);
|
||||
|
||||
$this->data = new Data($dbi, $config);
|
||||
$this->data->usedQueries = [
|
||||
'Com_change_db' => '15',
|
||||
'Com_select' => '12',
|
||||
|
||||
@ -44,19 +44,28 @@ class StatusControllerTest extends AbstractTestCase
|
||||
|
||||
public function testIndex(): void
|
||||
{
|
||||
$data = new Data(DatabaseInterface::getInstance(), Config::getInstance());
|
||||
|
||||
$bytesReceived = 100;
|
||||
$bytesSent = 200;
|
||||
$maxUsedConnections = 500;
|
||||
$abortedConnections = 200;
|
||||
$connections = 1000;
|
||||
$data->status['Uptime'] = 36000;
|
||||
$data->status['Bytes_received'] = $bytesReceived;
|
||||
$data->status['Bytes_sent'] = $bytesSent;
|
||||
$data->status['Max_used_connections'] = $maxUsedConnections;
|
||||
$data->status['Aborted_connects'] = $abortedConnections;
|
||||
$data->status['Connections'] = $connections;
|
||||
|
||||
$dummyDbi = $this->createDbiDummy();
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
$dummyDbi->addResult('SHOW GLOBAL STATUS', [
|
||||
['Uptime' , '36000'],
|
||||
['Bytes_received' , $bytesReceived],
|
||||
['Bytes_sent' , $bytesSent],
|
||||
['Max_used_connections' ,$maxUsedConnections],
|
||||
['Aborted_connects' , $abortedConnections],
|
||||
['Connections' , $connections],
|
||||
['Aborted_clients', '0'],
|
||||
['Com_delete_multi', '0'],
|
||||
['Com_create_function', '0'],
|
||||
['Com_empty_query', '0'],
|
||||
], ['Variable_name', 'Value']);
|
||||
|
||||
$data = new Data($dbi, Config::getInstance());
|
||||
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user