You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: generator/src/PhpStanFunctions/PhpStanType.php
+13-22
Original file line number
Diff line number
Diff line change
@@ -42,13 +42,6 @@ public function __construct(string|\SimpleXMLElement $data, bool $writeOnly = fa
42
42
$data = $regs[1];
43
43
}
44
44
45
-
//weird case: null|false => null
46
-
if ($data === 'null|false') {
47
-
$this->nullable = false;
48
-
$this->falsable = true;
49
-
$this->types = ['null'];
50
-
return;
51
-
}
52
45
//first we try to parse the type string to have a list as clean as possible.
53
46
$nullable = false;
54
47
$falsable = false;
@@ -189,25 +182,23 @@ public function getSignatureType(?ErrorType $errorType = null): string
189
182
$type = 'string';
190
183
}
191
184
}
185
+
// filter out duplicates due to input types like "array<string>|array<int>"
186
+
$types = array_unique($types);
192
187
sort($types);
193
188
194
-
//if there are several distinct types, no typehint (we use distinct in case doc block contains several times the same type, for example array<int>|array<string>)
0 commit comments