Skip to content

Commit beec85c

Browse files
Merge pull request #460 from kamil-tekiela/narrow-down-types
Narrow down return types
2 parents 19f6db1 + d25cf7e commit beec85c

File tree

3 files changed

+12
-62
lines changed

3 files changed

+12
-62
lines changed

phpstan-baseline.neon

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -871,50 +871,20 @@ parameters:
871871
path: src/Tools/TestGenerator.php
872872

873873
-
874-
message: "#^Cannot access offset 'a' on mixed\\.$#"
875-
count: 3
876-
path: src/Utils/CLI.php
877-
878-
-
879-
message: "#^Cannot access offset 'c' on mixed\\.$#"
880-
count: 2
881-
path: src/Utils/CLI.php
882-
883-
-
884-
message: "#^Cannot access offset 'f' on mixed\\.$#"
885-
count: 1
886-
path: src/Utils/CLI.php
887-
888-
-
889-
message: "#^Cannot access offset 'h' on mixed\\.$#"
890-
count: 3
891-
path: src/Utils/CLI.php
892-
893-
-
894-
message: "#^Cannot access offset 'q' on mixed\\.$#"
895-
count: 12
896-
path: src/Utils/CLI.php
897-
898-
-
899-
message: "#^Parameter \\#1 \\$context of static method PhpMyAdmin\\\\SqlParser\\\\Context\\:\\:load\\(\\) expects string, mixed given\\.$#"
874+
message: "#^Parameter \\#1 \\$context of static method PhpMyAdmin\\\\SqlParser\\\\Context\\:\\:load\\(\\) expects string, string\\|false given\\.$#"
900875
count: 1
901876
path: src/Utils/CLI.php
902877

903878
-
904-
message: "#^Parameter \\#1 \\$query of static method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\Formatter\\:\\:format\\(\\) expects string, mixed given\\.$#"
879+
message: "#^Parameter \\#1 \\$query of static method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\Formatter\\:\\:format\\(\\) expects string, string\\|false given\\.$#"
905880
count: 1
906881
path: src/Utils/CLI.php
907882

908883
-
909-
message: "#^Parameter \\#1 \\$str of class PhpMyAdmin\\\\SqlParser\\\\Lexer constructor expects PhpMyAdmin\\\\SqlParser\\\\UtfString\\|string, mixed given\\.$#"
884+
message: "#^Parameter \\#1 \\$str of class PhpMyAdmin\\\\SqlParser\\\\Lexer constructor expects PhpMyAdmin\\\\SqlParser\\\\UtfString\\|string, string\\|false given\\.$#"
910885
count: 2
911886
path: src/Utils/CLI.php
912887

913-
-
914-
message: "#^Parameter \\#2 \\$options of static method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\Formatter\\:\\:format\\(\\) expects array\\<string, array\\<int, array\\<string, int\\|string\\>\\>\\|bool\\|string\\>, array\\<string, mixed\\> given\\.$#"
915-
count: 1
916-
path: src/Utils/CLI.php
917-
918888
-
919889
message: "#^Argument of an invalid type array\\<int, array\\<string, int\\|string\\>\\>\\|bool\\|string supplied for foreach, only iterables are supported\\.$#"
920890
count: 1

psalm-baseline.xml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5300,36 +5300,16 @@
53005300
<InvalidReturnType>
53015301
<code>string[]|false[]|false</code>
53025302
</InvalidReturnType>
5303-
<MixedArgument>
5304-
<code><![CDATA[$params['c']]]></code>
5305-
<code><![CDATA[$params['q']]]></code>
5306-
<code><![CDATA[$params['q']]]></code>
5307-
<code><![CDATA[$params['q']]]></code>
5308-
</MixedArgument>
53095303
<MixedArgumentTypeCoercion>
53105304
<code>$idx</code>
5311-
<code><![CDATA[['type' => $params['f']]]]></code>
53125305
</MixedArgumentTypeCoercion>
5313-
<MixedArrayAccess>
5306+
<PossiblyFalseArgument>
5307+
<code>$params</code>
5308+
<code>$params</code>
53145309
<code><![CDATA[$params['c']]]></code>
5315-
<code><![CDATA[$params['f']]]></code>
5316-
<code><![CDATA[$params['q']]]></code>
5317-
<code><![CDATA[$params['q']]]></code>
5318-
<code><![CDATA[$params['q']]]></code>
5319-
</MixedArrayAccess>
5320-
<MixedArrayAssignment>
53215310
<code><![CDATA[$params['q']]]></code>
53225311
<code><![CDATA[$params['q']]]></code>
53235312
<code><![CDATA[$params['q']]]></code>
5324-
</MixedArrayAssignment>
5325-
<MixedAssignment>
5326-
<code>$params</code>
5327-
<code>$params</code>
5328-
<code>$params</code>
5329-
</MixedAssignment>
5330-
<PossiblyFalseArgument>
5331-
<code>$params</code>
5332-
<code>$params</code>
53335313
</PossiblyFalseArgument>
53345314
</file>
53355315
<file src="src/Utils/Error.php">

src/Utils/CLI.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public function getopt($opt, $long): array|false
6868
}
6969

7070
/**
71-
* @return mixed|false
71+
* @return string[]|false[]|false
7272
*/
73-
public function parseHighlight()
73+
public function parseHighlight(): array|false
7474
{
7575
$longopts = [
7676
'help',
@@ -151,9 +151,9 @@ public function usageLint()
151151
}
152152

153153
/**
154-
* @return mixed
154+
* @return string[]|false[]|false
155155
*/
156-
public function parseLint()
156+
public function parseLint(): array|false
157157
{
158158
$longopts = [
159159
'help',
@@ -230,9 +230,9 @@ public function usageTokenize()
230230
}
231231

232232
/**
233-
* @return mixed
233+
* @return string[]|false[]|false
234234
*/
235-
public function parseTokenize()
235+
public function parseTokenize(): array|false
236236
{
237237
$longopts = [
238238
'help',

0 commit comments

Comments
 (0)