From 6c8cc2f057c3448d13934c741835182d806a9da4 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gulyam Date: Thu, 6 Apr 2017 18:08:15 +0300 Subject: [PATCH] fix --- src/Naneau/Obfuscator/Node/Visitor/ScrambleUse.php | 4 ++++ tests/before/Namespaces.php | 3 +++ tests/expected/Namespaces.php | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Naneau/Obfuscator/Node/Visitor/ScrambleUse.php b/src/Naneau/Obfuscator/Node/Visitor/ScrambleUse.php index 0481ef4..b95bd64 100644 --- a/src/Naneau/Obfuscator/Node/Visitor/ScrambleUse.php +++ b/src/Naneau/Obfuscator/Node/Visitor/ScrambleUse.php @@ -133,6 +133,10 @@ public function enterNode(Node $node) if ($this->isRenamed($name)) { $node->type = $this->getNewName($name); return $node; + } elseif ($this->isRenamed($node->type->getFirst())) { + reset($node->type->parts); + $node->type->parts[key($node->type->parts)] = $this->getNewName($node->type->getFirst()); + return $node; } } diff --git a/tests/before/Namespaces.php b/tests/before/Namespaces.php index 8e025f3..13248d0 100644 --- a/tests/before/Namespaces.php +++ b/tests/before/Namespaces.php @@ -35,4 +35,7 @@ public function __construct() { class classE extends namespaceDAlias\classD implements namespaceDAlias\interfaceA { + public function method(namespaceDAlias\classD $objectD) { + + } } \ No newline at end of file diff --git a/tests/expected/Namespaces.php b/tests/expected/Namespaces.php index 91552d8..dd690db 100644 --- a/tests/expected/Namespaces.php +++ b/tests/expected/Namespaces.php @@ -1,2 +1,2 @@ spa26210 = new spf0f507(); $this->sp2e1034 = new sp63627e\classD(); } } class classE extends sp63627e\classD implements sp63627e\interfaceA { } \ No newline at end of file +namespace namespaceA; class classA { } namespace namespaceC\namespaceD; class classD { } interface interfaceA { } namespace namespaceB; use namespaceA\classA as spf0f507; use namespaceC\namespaceD as sp63627e; class classB { private $spa26210; private $sp2e1034; public function __construct() { $this->spa26210 = new spf0f507(); $this->sp2e1034 = new sp63627e\classD(); } } class classE extends sp63627e\classD implements sp63627e\interfaceA { public function method(sp63627e\classD $spc1ac55) { } } \ No newline at end of file