コード例 #1
0
ファイル: CompleterTest.php プロジェクト: tsufeki/phpcmplr
 public function test_MethodCall_self()
 {
     $class = (new Class_())->setName('\\C');
     $method = (new Method())->setName('qaz')->setClass($class)->setDocReturnType(Type::int_());
     $cls = new Name('self');
     $cls->setAttribute('resolved', new Name\FullyQualified('C'));
     $id = new Identifier('q');
     $expr = new Expr\StaticCall($cls, $id, []);
     $ctxmeth = new Stmt\ClassMethod('mm');
     $ctxcls = new Stmt\Class_('C');
     $ctxcls->setAttribute('namespacedName', '\\C');
     $completions = $this->complete([$id, $expr, $ctxmeth, $ctxcls], [$method]);
     $this->assertCount(1, $completions);
 }
コード例 #2
0
 protected function addNamespacedName(Node $node)
 {
     if (null !== $this->namespace) {
         $namespacedName = Name::concat($this->namespace, $node->name);
     } else {
         $namespacedName = new Name($node->name);
     }
     $node->setAttribute('namespacedName', new FullyQualified($namespacedName->parts));
 }