Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 0f827e6

Browse files
author
Sergei Filonich
committed
Checking.
1 parent 5b677a0 commit 0f827e6

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

src/Check/ReturnCheck.php

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,20 @@ public function check(FileInfo $file)
4646
}
4747
}
4848

49-
if ($method['docblock']['return'] !== $method['return']) {
49+
if ($method['docblock']['return'] !== $method['return'] && !is_array($method['return'])) {
5050
if ($method['return'] === 'array' && substr($method['docblock']['return'], -2) === '[]') {
5151
// Do nothing because this is fine.
5252
} 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+
);
6563
}
6664
}
6765
}
@@ -75,16 +73,4 @@ public function enabled()
7573
{
7674
return !$this->config->isSkipSignatures();
7775
}
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-
}
9076
}

0 commit comments

Comments
 (0)