Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit 0405356

Browse files
author
Edson Medina
committed
Allow declare() on global space
1 parent d15acb8 commit 0405356

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/NodeVisitors/CodeInGlobalSpaceVisitor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class CodeInGlobalSpaceVisitor extends VisitorAbstract
1111
{
1212
public function enterNode (PhpParser\Node $node)
1313
{
14+
if ($node instanceof Stmt\Declare_) {
15+
return PhpParser\NodeTraverser::DONT_TRAVERSE_CHILDREN;
16+
}
17+
1418
// check for code outside of classes/functions
1519
if ($this->inGlobalScope())
1620
{

0 commit comments

Comments
 (0)