Skip to content

Commit 503123e

Browse files
committed
Fix PHPUnit warning in FormatterTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.com.br>
1 parent 6397892 commit 503123e

3 files changed

Lines changed: 15 additions & 20 deletions

File tree

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
],
7575
"update:baselines": [
7676
"@php phpstan analyse --generate-baseline",
77-
"@php psalm --set-baseline=psalm-baseline.xml"
77+
"@php psalm --no-cache --threads=max --set-baseline=psalm-baseline.xml"
7878
]
7979
},
8080
"config": {

‎src/Utils/FormattingOptions.php‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
use PhpMyAdmin\SqlParser\Token;
88
use PhpMyAdmin\SqlParser\TokenType;
99

10-
use function strtolower;
11-
use function strtoupper;
12-
1310
use const PHP_SAPI;
1411

1512
final class FormattingOptions
@@ -71,14 +68,14 @@ public static function getDefaultFormats(): array
7168
'flags' => Token::FLAG_KEYWORD_RESERVED,
7269
'html' => 'sql-reserved',
7370
'cli' => "\x1b[35m",
74-
'function' => strtoupper(...),
71+
'function' => 'strtoupper',
7572
],
7673
[
7774
'type' => TokenType::Keyword,
7875
'flags' => 0,
7976
'html' => 'sql-keyword',
8077
'cli' => "\x1b[95m",
81-
'function' => strtoupper(...),
78+
'function' => 'strtoupper',
8279
],
8380
[
8481
'type' => TokenType::Comment,
@@ -92,14 +89,14 @@ public static function getDefaultFormats(): array
9289
'flags' => 0,
9390
'html' => 'sql-atom',
9491
'cli' => "\x1b[36m",
95-
'function' => strtoupper(...),
92+
'function' => 'strtoupper',
9693
],
9794
[
9895
'type' => TokenType::Number,
9996
'flags' => 0,
10097
'html' => 'sql-number',
10198
'cli' => "\x1b[92m",
102-
'function' => strtolower(...),
99+
'function' => 'strtolower',
103100
],
104101
[
105102
'type' => TokenType::String,

‎tests/Utils/FormatterTest.php‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,62 +11,60 @@
1111
use PhpMyAdmin\SqlParser\Utils\FormattingOptions;
1212
use PHPUnit\Framework\Attributes\DataProvider;
1313

14-
use function strtoupper;
15-
1614
class FormatterTest extends TestCase
1715
{
1816
public function testMergeFormats(): void
1917
{
2018
$object = new FormattingOptions(formats: []);
21-
self::assertEquals($object->formats, FormattingOptions::getDefaultFormats());
19+
self::assertSame($object->formats, FormattingOptions::getDefaultFormats());
2220

2321
$object = new FormattingOptions(formats: [
2422
[
2523
'type' => TokenType::Keyword,
2624
'flags' => Token::FLAG_KEYWORD_RESERVED,
2725
'html' => 'sql-foo',
2826
'cli' => "\x1b[35m",
29-
'function' => strtoupper(...),
27+
'function' => 'strtoupper',
3028
],
3129
[
3230
'type' => TokenType::Keyword,
3331
'flags' => 0,
3432
'html' => 'sql-bar',
3533
'cli' => "\x1b[95m",
36-
'function' => strtoupper(...),
34+
'function' => 'strtoupper',
3735
],
3836
[
3937
'type' => TokenType::Keyword,
4038
'flags' => Token::FLAG_KEYWORD_COMPOSED,
4139
'html' => 'sql-baz',
4240
'cli' => "\x1b[95m",
43-
'function' => strtoupper(...),
41+
'function' => 'strtoupper',
4442
],
4543

4644
]);
4745

48-
self::assertContainsEquals([
46+
self::assertContains([
4947
'type' => TokenType::Keyword,
5048
'flags' => Token::FLAG_KEYWORD_RESERVED,
5149
'html' => 'sql-foo',
5250
'cli' => "\x1b[35m",
53-
'function' => strtoupper(...),
51+
'function' => 'strtoupper',
5452
], $object->formats);
5553

56-
self::assertContainsEquals([
54+
self::assertContains([
5755
'type' => TokenType::Keyword,
5856
'flags' => 0,
5957
'html' => 'sql-bar',
6058
'cli' => "\x1b[95m",
61-
'function' => strtoupper(...),
59+
'function' => 'strtoupper',
6260
], $object->formats);
6361

64-
self::assertContainsEquals([
62+
self::assertContains([
6563
'type' => TokenType::Keyword,
6664
'flags' => Token::FLAG_KEYWORD_COMPOSED,
6765
'html' => 'sql-baz',
6866
'cli' => "\x1b[95m",
69-
'function' => strtoupper(...),
67+
'function' => 'strtoupper',
7068
], $object->formats);
7169
}
7270

0 commit comments

Comments
 (0)