Skip to content

Commit bfd9445

Browse files
committed
Use callable
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent a8eb199 commit bfd9445

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,12 +1812,6 @@ parameters:
18121812
count: 7
18131813
path: src/Utils/Formatter.php
18141814

1815-
-
1816-
message: '#^Trying to invoke non\-empty\-string but it might not be a callable\.$#'
1817-
identifier: callable.nonCallable
1818-
count: 1
1819-
path: src/Utils/Formatter.php
1820-
18211815
-
18221816
message: '''
18231817
#^Access to deprecated property \$isDelete of class PhpMyAdmin\\SqlParser\\Utils\\StatementFlags\:

src/Utils/Formatter.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use function str_contains;
2020
use function str_repeat;
2121
use function str_replace;
22+
use function strtolower;
2223
use function strtoupper;
2324

2425
use const ENT_NOQUOTES;
@@ -82,7 +83,7 @@ protected function __construct(protected FormattingOptions $options = new Format
8283
* The styles used for HTML formatting.
8384
* [$type, $flags, $span, $callback].
8485
*
85-
* @return list<array{type: int, flags: int, html: string, cli: string, function: string}>
86+
* @return list<array{type: int, flags: int, html: string, cli: string, function: callable|''}>
8687
*/
8788
protected function getDefaultFormats(): array
8889
{
@@ -92,14 +93,14 @@ protected function getDefaultFormats(): array
9293
'flags' => Token::FLAG_KEYWORD_RESERVED,
9394
'html' => 'class="sql-reserved"',
9495
'cli' => "\x1b[35m",
95-
'function' => 'strtoupper',
96+
'function' => strtoupper(...),
9697
],
9798
[
9899
'type' => TokenType::Keyword->value,
99100
'flags' => 0,
100101
'html' => 'class="sql-keyword"',
101102
'cli' => "\x1b[95m",
102-
'function' => 'strtoupper',
103+
'function' => strtoupper(...),
103104
],
104105
[
105106
'type' => TokenType::Comment->value,
@@ -113,14 +114,14 @@ protected function getDefaultFormats(): array
113114
'flags' => 0,
114115
'html' => 'class="sql-atom"',
115116
'cli' => "\x1b[36m",
116-
'function' => 'strtoupper',
117+
'function' => strtoupper(...),
117118
],
118119
[
119120
'type' => TokenType::Number->value,
120121
'flags' => 0,
121122
'html' => 'class="sql-number"',
122123
'cli' => "\x1b[92m",
123-
'function' => 'strtolower',
124+
'function' => strtolower(...),
124125
],
125126
[
126127
'type' => TokenType::String->value,

0 commit comments

Comments
 (0)