Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeTypeResolver failed to resolve correct variable type when it's surrounded by parenthesis #90

Open
halftan opened this issue Jan 6, 2017 · 0 comments
Assignees
Labels

Comments

@halftan
Copy link
Contributor

halftan commented Jan 6, 2017

When getting candidates in this situation:

<?php
$parser = new PhpParser\ParserFactory-><TAB>

$context->getData() in ObjectCompleter returns:

array(4) {
  [0]=>
  object(Padawan\Domain\Project\FQCN)#97 (3) {
    ["_isArray":"Padawan\Domain\Project\FQCN":private]=>
    bool(false)
    ["_isScalar":"Padawan\Domain\Project\FQCN":private]=>
    bool(false)
    ["parts":"Padawan\Domain\Project\FQN":private]=>
    array(2) {
      [0]=>
      string(9) "PhpParser"
      [1]=>
      string(13) "ParserFactory"
    }
  }
  [1]=>
  bool(false)
  [2]=>
  array(0) {
  }
  [3]=>
  object(PhpParser\Node\Expr\Assign)#80 (3) {
    ["var"]=>
    object(PhpParser\Node\Expr\Variable)#184149 (2) {
      ["name"]=>
      string(6) "parser"
      ["attributes":protected]=>
      array(2) {
        ["startLine"]=>
        int(1)
        ["endLine"]=>
        int(1)
      }
    }
    ["expr"]=>
    object(PhpParser\Node\Expr\New_)#81 (3) {
      ["class"]=>
      object(PhpParser\Node\Name)#184212 (2) {
        ["parts"]=>
        array(2) {
          [0]=>
          string(9) "PhpParser"
          [1]=>
          string(13) "ParserFactory"
        }
        ["attributes":protected]=>
        array(2) {
          ["startLine"]=>
          int(1)
          ["endLine"]=>
          int(1)
        }
      }
      ["args"]=>
      array(0) {
      }
      ["attributes":protected]=>
      array(2) {
        ["startLine"]=>
        int(1)
        ["endLine"]=>
        int(1)
      }
    }
    ["attributes":protected]=>
    array(2) {
      ["startLine"]=>
      int(1)
      ["endLine"]=>
      int(1)
    }
  }
}

which is desired.

But when in this situation:

<?php
$parser = (new PhpParser\ParserFactory)-><TAB>

it returns:

array(4) {
  [0]=>
  NULL
  [1]=>
  bool(false)
  [2]=>
  array(0) {
  }
  [3]=>
  object(PhpParser\Node\Expr\Variable)#184149 (2) {
    ["name"]=>
    string(6) "parser"
    ["attributes":protected]=>
    array(2) {
      ["startLine"]=>
      int(1)
      ["endLine"]=>
      int(1)
    }
  }
}

which is not desired and need to be fixed.

@halftan halftan added the bug label Jan 6, 2017
@halftan halftan self-assigned this Jan 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant