This repository was archived by the owner on Feb 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-25
lines changed Expand file tree Collapse file tree 1 file changed +11
-25
lines changed Original file line number Diff line number Diff line change @@ -46,22 +46,20 @@ public function check(FileInfo $file)
46
46
}
47
47
}
48
48
49
- if ($ method ['docblock ' ]['return ' ] !== $ method ['return ' ]) {
49
+ if ($ method ['docblock ' ]['return ' ] !== $ method ['return ' ] && ! is_array ( $ method [ ' return ' ]) ) {
50
50
if ($ method ['return ' ] === 'array ' && substr ($ method ['docblock ' ]['return ' ], -2 ) === '[] ' ) {
51
51
// Do nothing because this is fine.
52
52
} else {
53
- if (!is_array ($ method ['return ' ]) || !$ this ->checkMultipleReturnStatements ($ method )) {
54
- $ this ->fileStatus ->add (
55
- new ReturnMismatchWarning (
56
- $ file ->getFileName (),
57
- $ name ,
58
- $ method ['line ' ],
59
- $ name ,
60
- $ method ['return ' ],
61
- $ method ['docblock ' ]['return ' ]
62
- )
63
- );
64
- }
53
+ $ this ->fileStatus ->add (
54
+ new ReturnMismatchWarning (
55
+ $ file ->getFileName (),
56
+ $ name ,
57
+ $ method ['line ' ],
58
+ $ name ,
59
+ $ method ['return ' ],
60
+ $ method ['docblock ' ]['return ' ]
61
+ )
62
+ );
65
63
}
66
64
}
67
65
}
@@ -75,16 +73,4 @@ public function enabled()
75
73
{
76
74
return !$ this ->config ->isSkipSignatures ();
77
75
}
78
-
79
- /**
80
- * @param array $method
81
- * @return bool
82
- */
83
- private function checkMultipleReturnStatements (array $ method ): bool
84
- {
85
- $ dockReturn = explode ('| ' , $ method ['docblock ' ]['return ' ]);
86
- $ methodReturn = $ method ['return ' ];
87
-
88
- return count (array_diff ($ dockReturn , $ methodReturn )) == 0 && count (array_diff ($ methodReturn , $ dockReturn )) == 0 ;
89
- }
90
76
}
You can’t perform that action at this time.
0 commit comments