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:
parent
ae49558de6
commit
f2ff727649
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user