1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #706 - don’t namespace &

This commit is contained in:
Matt Brown 2018-05-03 13:15:16 -04:00
parent ae49558de6
commit f2ff727649
2 changed files with 25 additions and 1 deletions

View File

@ -464,7 +464,11 @@ abstract class Type
for ($i = 0, $l = count($return_type_tokens); $i < $l; $i++) {
$return_type_token = $return_type_tokens[$i];
if (in_array($return_type_token, ['<', '>', '|', '?', ',', '{', '}', ':', '[', ']', '(', ')'], true)) {
if (in_array(
$return_type_token,
['<', '>', '|', '?', ',', '{', '}', ':', '[', ']', '(', ')', '&'],
true
)) {
continue;
}

View File

@ -984,6 +984,26 @@ class TypeTest extends TestCase
function takesI(I $i): void {}
function takesA(A $i): void {}',
],
'intersectionInNamespace' => [
'<?php
namespace NS;
use Countable;
class Item {}
/**
* @var iterable<Item>&Countable $collection
*/
$collection = [];
count($collection);
/**
* @param iterable<Item>&Countable $collection
*/
function mycount($collection): int {
return count($collection);
}
mycount($collection);',
],
];
}