Inheritance: extends ClassLike
Esempio n. 1
0
 /**
  * @param string $namespace
  * @param Use_[] $uses
  * @param PhpParserInterface $interface
  * @param File $file
  */
 public function __construct($namespace, array $uses, PhpParserInterface $interface, File $file)
 {
     $this->namespace = $namespace;
     $this->file = $file;
     $this->node = $interface;
     $this->uses = $uses;
     $this->fqn = join('\\', array_filter([$namespace, $interface->name]));
     $this->resolveNames();
     if (count($this->extends) !== count($interface->extends)) {
         throw new \RuntimeException('Something is amiss, resolved ' . count($this->extends) . ' extend(s) but found ' . count($interface->extends) . ' actual extend(s) in ' . $file->getSplFile()->getRealPath() . ':' . $interface->getLine());
     }
 }
 /**
  * @param Node\Stmt\Interface_ $node
  */
 protected function parseInterfaceNode(Node\Stmt\Interface_ $node)
 {
     if (!isset($node->namespacedName)) {
         return;
     }
     $this->currentStructuralElement = $node;
     $extendedInterfaces = [];
     /** @var Node\Name $extends */
     foreach ($node->extends as $extends) {
         $extendedInterfaces[] = $extends->toString();
     }
     $this->structuralElements[$node->namespacedName->toString()] = ['name' => $node->name, 'type' => 'interface', 'startLine' => $node->getLine(), 'parents' => $extendedInterfaces, 'docComment' => $node->getDocComment() ? $node->getDocComment()->getText() : null, 'traits' => [], 'methods' => [], 'properties' => [], 'constants' => []];
 }
 /**
  * @return int
  */
 public function getLine()
 {
     return $this->interfaceAfter->getLine();
 }
 /**
  * @return int
  */
 public function getLine()
 {
     return $this->interfaceBefore->getLine();
 }