Skip to content

Commit ebfbb70

Browse files
committed
[PHP7] bug in type resolver
1 parent da7e043 commit ebfbb70

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Hal/Component/OOP/Resolver/TypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function resolve($string)
6363
return self::TYPE_ANONYMOUS_CLASS;
6464
}
6565

66-
if(preg_match('!^(new\s+)(.*?)([\(;].*|$)!', $cased, $matches)) {
66+
if(preg_match('!^(new\s+)(.*?)(\s*[\(;].*|$)!', $cased, $matches)) {
6767
return $matches[2];
6868
}
6969

tests/Hal/Component/OOP/Resolver/TypeResolverTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function providesTypes()
3333
array('$this->foo();', TypeResolver::TYPE_UNKNWON),
3434
array('new \StdClass', '\StdClass'),
3535
array('new \StdClass($a, $b)', '\StdClass'),
36+
array('new \StdClass ($a, $b)', '\StdClass'),
3637
array('new class implements Countable, Iterator {}', 'anonymous@class')
3738
);
3839
}

0 commit comments

Comments
 (0)