- $stmt = $this->normalizeNode($stmt);
-
- $targets = array(
- 'Stmt_TraitUse' => &$this->uses,
- 'Stmt_ClassConst' => &$this->constants,
- 'Stmt_Property' => &$this->properties,
- 'Stmt_ClassMethod' => &$this->methods,
- );
-
- $type = $stmt->getType();
- if (!isset($targets[$type])) {
- throw new \LogicException(sprintf('Unexpected node of type "%s"', $type));
+ $stmt = BuilderHelpers::normalizeNode($stmt);
+
+ $targets = [
+ Stmt\TraitUse::class => &$this->uses,
+ Stmt\ClassConst::class => &$this->constants,
+ Stmt\Property::class => &$this->properties,
+ Stmt\ClassMethod::class => &$this->methods,
+ ];
+
+ $class = \get_class($stmt);
+ if (!isset($targets[$class])) {
+ throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));