Skip to content
Permalink
Browse files

Allow space in intersection type

Ref #1645
  • Loading branch information...
muglug committed May 16, 2019
1 parent 6b04503 commit 66bbe5bb747da1e326bd302ba35e7da475988a3f
Showing with 24 additions and 5 deletions.
  1. +9 −5 src/Psalm/Internal/Analyzer/CommentAnalyzer.php
  2. +15 −0 tests/AnnotationTest.php
@@ -991,13 +991,17 @@ public static function splitDocLine($return_block)
continue;
}
if ($next_char === '|') {
++$i;
$type .= $next_char;
continue;
if ($next_char === '|' || $next_char === '&') {
$nexter_char = $i < $l - 2 ? $return_block[$i + 2] : null;
if ($nexter_char === ' ') {
++$i;
$type .= $next_char;
continue;
}
}
if ($last_char === '|') {
if ($last_char === '|' || $last_char === '&') {
continue;
}
@@ -974,6 +974,21 @@ class Foo {
private $s = null;
}',
],
'intersectionWithSpace' => [
'<?php
interface A {
public function foo() : void;
}
interface B {
public function bar() : void;
}
/** @param A & B $a */
function f(A $a) : void {
$a->foo();
$a->bar();
}'
],
];
}

0 comments on commit 66bbe5b

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