Skip to content

Commit 6e23395

Browse files
committed
PHPStan fixes
1 parent 9950dc4 commit 6e23395

File tree

4 files changed

+37
-17
lines changed

4 files changed

+37
-17
lines changed

src/PHPFUI/MySQLSlowQuery/BaseObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __set(string $field, mixed $value)
4141

4242
$this->fields[$field] = $value;
4343

44-
return $value;
44+
4545
}
4646

4747
/** @return array<string, mixed> */

src/PHPFUI/MySQLSlowQuery/Entry.php

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,44 @@
33
namespace PHPFUI\MySQLSlowQuery;
44

55
/**
6-
* @property ?string $acceptedWaiver MySQL type timestamp
7-
* @property string $Time
8-
* @property string $User
9-
* @property string $Host
10-
* @property int $Id
11-
* @property float $Query_time
6+
* @property array<string> $Query
127
* @property float $Lock_time
13-
* @property int $Rows_sent
8+
* @property float $Query_time
9+
* @property int $Bytes_sent
10+
* @property int $Id
11+
* @property int $Merge_passes
12+
* @property int $Rows_affected
1413
* @property int $Rows_examined
15-
* @property array<string> $Query
14+
* @property int $Rows_sent
1615
* @property int $Session
16+
* @property int $Thread_id
17+
* @property int $Tmp_disk_tables
18+
* @property int $Tmp_table_sizes
19+
* @property int $Tmp_tables
20+
* @property string $explain
21+
* @property string $Filesort
22+
* @property string $Filesort_on_disk
23+
* @property string $Full_join
24+
* @property string $Full_scan
25+
* @property string $Host
26+
* @property string $Priority_queue
27+
* @property string $QC_hit
28+
* @property string $Schema
29+
* @property string $Time
30+
* @property string $Tmp_table
31+
* @property string $Tmp_table_on_disk
32+
* @property string $User
1733
*/
1834
class Entry extends \PHPFUI\MySQLSlowQuery\BaseObject
1935
{
36+
/**
37+
* @var array<string, string>
38+
*/
2039
private array $parameters = [];
2140

22-
// @phpstan-ignore-next-line
41+
/**
42+
* @param array<string, string> $parameters
43+
*/
2344
public function __construct(array $parameters = [])
2445
{
2546
$this->parameters = $parameters;

src/PHPFUI/MySQLSlowQuery/Parser.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class Parser
2828
* Parse a MySQL Slow Query Log file
2929
*/
3030
public function __construct(private string $fileName)
31-
{
32-
}
31+
{
32+
}
3333

3434
/**
3535
* Return \PHPFUI\MySQLSlowQuery\Entry entries from file
@@ -218,9 +218,9 @@ private function parse() : void
218218
$previousTimeLine = $line;
219219
}
220220
}
221-
while ((\strlen($line = $this->getNextLine()) > 0) && ('#' === $line[0]));
221+
while (\strlen($line = $this->getNextLine()) > 0 && '#' === $line[0]); // @phpstan-ignore-line
222222

223-
if ('mariadb' == $parseMode && ! $timeLineFound && $previousTimeLine)
223+
if ('mariadb' == $parseMode && ! $timeLineFound && $previousTimeLine) // @phpstan-ignore-line
224224
{
225225
// Always add the Time property. Assume that if it is not in the
226226
// log, it's the same as the previous logged query, and that the
@@ -231,8 +231,7 @@ private function parse() : void
231231
}
232232

233233
// gather (more) query lines until a non-query line is reached
234-
// @phpstan-ignore-next-line
235-
while (\strlen($line = $this->getNextLine()) > 0 && '#' !== $line[0])
234+
while (\strlen($line = $this->getNextLine()) > 0 && '#' !== $line[0]) // @phpstan-ignore-line
236235
{
237236
if (0 === \stripos($line, self::PORT))// found a new session header
238237
{

src/PHPFUI/MySQLSlowQuery/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class Session extends \PHPFUI\MySQLSlowQuery\BaseObject
1212
{
1313
/** @param array<int, string> $sessionData */
14-
public function __construct(array $sessionData = [], $parseMode = '')
14+
public function __construct(array $sessionData = [], string $parseMode = '')
1515
{
1616
$this->fields = [
1717
// Almost the full first line, i.e. executable and version.

0 commit comments

Comments
 (0)