File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/BetterPhpDocParser/ValueObject/Type Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,20 @@ public function __construct(
2525 */
2626 public function __toString (): string
2727 {
28- $ this ->types = array_unique ($ this ->types , SORT_REGULAR );
28+ $ types = [];
29+
30+ // get the actual strings first before array_unique
31+ // to avoid similar object but different printing to be treated as unique
32+ foreach ($ this ->types as $ type ) {
33+ $ types [] = (string ) $ type ;
34+ }
35+
36+ $ types = array_unique ($ types );
2937 if (! $ this ->isWrappedInBrackets ) {
30- return implode ('| ' , $ this -> types );
38+ return implode ('| ' , $ types );
3139 }
3240
33- return '( ' . implode ('| ' , $ this -> types ) . ') ' ;
41+ return '( ' . implode ('| ' , $ types ) . ') ' ;
3442 }
3543
3644 public function isWrappedInBrackets (): bool
You can’t perform that action at this time.
0 commit comments