Skip to content
Permalink
Browse files

Fix #1636 - don’t allow invalid phpdoc to be outputted

  • Loading branch information...
muglug committed May 14, 2019
1 parent e7f4a52 commit 10272c2da1d3590b48c6eaaa4fc8a9f459754baa
@@ -243,7 +243,7 @@ private function __construct($file_path, FunctionLike $stmt, ProjectAnalyzer $pr
*/
public function setReturnType($php_type, $new_type, $phpdoc_type, $is_php_compatible, $description)
{
$new_type = str_replace(['<mixed, mixed>', '<array-key, mixed>', '<empty, empty>'], '', $new_type);
$new_type = str_replace(['<mixed, mixed>', '<array-key, mixed>'], '', $new_type);
$this->new_php_return_type = $php_type;
$this->new_phpdoc_return_type = $phpdoc_type;
@@ -73,7 +73,7 @@ public function toNamespacedString($namespace, array $aliased_classes, $this_cla
$value_type = $this->type_params[1];
if ($value_type->isMixed()) {
if ($value_type->isMixed() || $value_type->isEmpty()) {
return $base_value;
}
@@ -1208,6 +1208,25 @@ function foo(): void {}',
false,
false,
],
'noEmptyArrayAnnotation' => [
'<?php
function foo() {
return [];
}',
'<?php
/**
* @return array
*
* @psalm-return array<empty, empty>
*/
function foo(): array {
return [];
}',
'7.3',
['MissingReturnType'],
false,
],
];
}
}

0 comments on commit 10272c2

Please sign in to comment.
You can’t perform that action at this time.