Skip to content

Commit 1065ae7

Browse files
authored
Fixes regular non namespaced closures being consider callables (#97)
1 parent d738882 commit 1065ae7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Support/ReflectionClosure.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,8 +1169,14 @@ protected function getClosureNamespaceName()
11691169
{
11701170
$ns = $this->getNamespaceName();
11711171

1172+
$name = $this->getName();
1173+
11721174
// First class callables...
1173-
if ($this->getName() !== '{closure}' && empty($ns) && ! is_null($this->getClosureScopeClass())) {
1175+
if ($name !== '{closure}'
1176+
&& ! str_contains($name, '{closure:/')
1177+
&& ! str_contains($name, '{closure:\\')
1178+
&& empty($ns)
1179+
&& ! is_null($this->getClosureScopeClass())) {
11741180
$ns = $this->getClosureScopeClass()->getNamespaceName();
11751181
}
11761182

0 commit comments

Comments
 (0)