Skip to content

Commit e5c571f

Browse files
Théo FIDRYtheofidry
authored andcommitted
PoC
1 parent 3a37470 commit e5c571f

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Console/Command/SelfUpdateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use Humbug\PhpScoper\Logger\UpdateConsoleLogger;
1818
use Humbug\SelfUpdate\Updater;
19-
use PHAR;
19+
use Phar;
2020
use Symfony\Component\Console\Command\Command;
2121
use Symfony\Component\Console\Input\InputInterface;
2222
use Symfony\Component\Console\Input\InputOption;

src/NodeVisitor/NameStmtPrefixer.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ final class NameStmtPrefixer extends NodeVisitorAbstract
5353
private $whitelist;
5454
private $globalWhitelister;
5555
private $nameResolver;
56+
private $classReflector;
5657

5758
/**
5859
* @param string $prefix
@@ -70,6 +71,7 @@ public function __construct(
7071
$this->whitelist = $whitelist;
7172
$this->globalWhitelister = $globalWhitelister;
7273
$this->nameResolver = $nameResolver;
74+
$this->classReflector = (new BetterReflection())->classReflector();
7375
}
7476

7577
/**
@@ -124,14 +126,8 @@ private function prefixName(Name $name): Node
124126
// Check if the class can be prefixed
125127
if (false === ($parentNode instanceof ConstFetch || $parentNode instanceof FuncCall)) {
126128
if (1 === count($resolvedName->parts)) {
127-
try {
128-
var_dump($resolvedName->toString());
129-
var_dump($parentNode->name);
130-
$classInfo = (new BetterReflection())->classReflector()->reflect($resolvedName->toString());
129+
$classInfo = $this->classReflector->reflect($resolvedName->toString());
131130

132-
} catch (\Throwable $t) {
133-
$y = '';
134-
}
135131
//&& false === ($this->globalWhitelister)($resolvedName->toString())
136132
//if (false === ($this->globalWhitelister)($resolvedName->toString())) {
137133
// return $resolvedName;

0 commit comments

Comments
 (0)