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

Returns only completions being already used in this file #86

Closed
danrot opened this issue Jan 3, 2017 · 23 comments
Closed

Returns only completions being already used in this file #86

danrot opened this issue Jan 3, 2017 · 23 comments

Comments

@danrot
Copy link

danrot commented Jan 3, 2017

I am testing using deoplete-padawan with neovim, but I think the problem I am encountering is a general one (although I am not really sure).

Have a look at this screenshot:

image

This is the Symfony controller of the standard edition. The Controller class it inherits from has plenty of method defined, but I get only the ones either defined or already used in this class.

As already said I am using deoplete-padawan with the latest stable release:

$ composer global show mkusher/padawan
Changed current directory to /Users/daniel/.composer
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
name     : mkusher/padawan
descrip. : Smart php completion server
keywords :
versions : * v0.2.1
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
source   : [git] https://github.com/mkusher/padawan.php.git 7ee828f6e86c0ec567e050a9511eab048a10aaae
dist     : [zip] https://api.github.com/repos/mkusher/padawan.php/zipball/7ee828f6e86c0ec567e050a9511eab048a10aaae 7ee828f6e86c0ec567e050a9511eab048a10aaae
names    : mkusher/padawan

autoload
psr-4
* => src/

requires
doctrine/cache ^1.4
mnapoli/php-di ~4.4
monolog/monolog ~1.13
nikic/php-parser ~1.1
phine/path ~1.0
phpdocumentor/reflection-docblock ~2.0
react/react 0.4.*
symfony/event-dispatcher ^2.6

requires (dev)
behat/behat ~3.0
peridot-php/leo ~1.4
peridot-php/peridot ~1.15
peridot-php/peridot-prophecy-plugin ~1.0
phpspec/prophecy ^1.5
@pbogut
Copy link
Member

pbogut commented Jan 3, 2017

Have you run padawan generate? It looks like your project is not indexed.

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

The latest stable release on packagist has some problem with index file generation, see #76

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

@danrot You can try out my develop branch

$ git clone https://github.com/halftan/padawan.php.git --branch develop
$ cd padawan.php && composer install

then either configure deoplete-padawan to use the padawan bins from my repo, or add the bin dir to $PATH. After this, run padawan generate again in your project's root directory.

Also, the indexing file doesn't exclude test file, so may cause some exceptions during indexing process, such as ThisClassWontLoadTest.php. This PR #87 solves the problem.

After all this, I've achieved this screen shot:

image

@danrot
Copy link
Author

danrot commented Jan 4, 2017

@pbogut Yeah, I ran padawan generate already, rerunning it also doesn't improve anything.
@halftan When using your branch I get an error message:

$ padawan generate


  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Call to a member function getIndex() on boolean


generate [<path>]

Another question: Since #76 was already merged, shouldn't it be enough to test the master branch?

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

@danrot Please try rm -r .padawan in your project root dir and rerun padawan generate.

Yes, you can specify dev-master when using composer install.

@danrot
Copy link
Author

danrot commented Jan 4, 2017

@halftan Did that, padawan generate worked this time, but the initial problem persists.

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

@danrot is there anything suspicious in /tmp/padawan-server.log ?

@danrot
Copy link
Author

danrot commented Jan 4, 2017

Not really... That's all I see in the logs when trying to autocomplete the above values.

POST /complete
[2017-01-04 12:35:32] completer.DEBUG: 3.0040740966797E-5 seconds for ast processing [] []
[2017-01-04 12:35:32] completer.DEBUG: Found token '' with type 512 [] []
[2017-01-04 12:35:32] completer.DEBUG: 0.00081181526184082 seconds for entries generation [] []
Response time: 0.0012040138244629
POST /complete
[2017-01-04 12:35:45] completer.DEBUG: 5.0067901611328E-5 seconds for ast processing [] []
[2017-01-04 12:35:45] completer.DEBUG: Found token '' with type 4 [] []
[2017-01-04 12:35:45] completer.DEBUG: looking for type of this [] []
[2017-01-04 12:35:45] completer.DEBUG: creating entries [] []
[2017-01-04 12:35:45] completer.DEBUG: Creating completion for AppBundle\Controller\DefaultController [] []
[2017-01-04 12:35:45] completer.DEBUG: 0.0017099380493164 seconds for entries generation [] []
Response time: 0.0020999908447266

@danrot
Copy link
Author

danrot commented Jan 4, 2017

Although, when generating with padawan generate there is a PHP Warning I just found now:

[2017-01-04 12:40:26] completer.INFO: Progress: 87% [] []
[2017-01-04 12:40:26] completer.INFO: processing vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Composite.php [] []
[2017-01-04 12:40:26] completer.INFO: Traversing with 1 walkers [] []
[2017-01-04 12:40:26] completer.DEBUG: looking for type of nestedConstraints [] []
PHP Warning:  array_key_exists(): The first argument should be either a string or an integer in /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Collection/PropertiesCollection.php on line 52
PHP Stack trace:
PHP   1. {main}() /Users/daniel/Temporary/padawan.php/bin/padawan:0
PHP   2. Symfony\Component\Console\Application->run() /Users/daniel/Temporary/padawan.php/bin/padawan:26
PHP   3. Symfony\Component\Console\Application->doRun() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:124
PHP   4. Symfony\Component\Console\Application->doRunCommand() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:193
PHP   5. Symfony\Component\Console\Command\Command->run() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:850
PHP   6. Padawan\Command\GenerateCommand->execute() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Command/Command.php:257
PHP   7. Padawan\Framework\Generator\IndexGenerator->generateProjectIndex() /Users/daniel/Temporary/padawan.php/src/Padawan/Command/GenerateCommand.php:40
PHP   8. Padawan\Framework\Generator\IndexGenerator->processFile() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:67
PHP   9. Padawan\Framework\Generator\IndexGenerator->createScopeForFile() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:96
PHP  10. Padawan\Parser\Parser->parseContent() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:112
PHP  11. PhpParser\NodeTraverser->traverse() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Parser.php:50
PHP  12. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
PHP  13. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP  14. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP  15. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP  16. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP  17. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP  18. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP  19. Padawan\Parser\Walker\IndexGeneratingWalker->leaveNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:139
PHP  20. Padawan\Parser\Transformer\ClassAssignmentTransformer->transform() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Walker/IndexGeneratingWalker.php:110
PHP  21. Padawan\Domain\Project\Node\ClassData->hasProp() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Transformer/ClassAssignmentTransformer.php:33
PHP  22. Padawan\Domain\Project\Collection\PropertiesCollection->get() /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Node/ClassData.php:106
PHP  23. array_key_exists() /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Collection/PropertiesCollection.php:52

Warning: array_key_exists(): The first argument should be either a string or an integer in /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Collection/PropertiesCollection.php on line 52

Call Stack:
    0.0002     357920   1. {main}() /Users/daniel/Temporary/padawan.php/bin/padawan:0
    0.0165    2059864   2. Symfony\Component\Console\Application->run() /Users/daniel/Temporary/padawan.php/bin/padawan:26
    0.0188    2347248   3. Symfony\Component\Console\Application->doRun() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:124
    0.0190    2347248   4. Symfony\Component\Console\Application->doRunCommand() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:193
    0.0190    2347248   5. Symfony\Component\Console\Command\Command->run() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:850
    0.0192    2349504   6. Padawan\Command\GenerateCommand->execute() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Command/Command.php:257
    0.1255   37446504   7. Padawan\Framework\Generator\IndexGenerator->generateProjectIndex() /Users/daniel/Temporary/padawan.php/src/Padawan/Command/GenerateCommand.php:40
   36.3116  155261424   8. Padawan\Framework\Generator\IndexGenerator->processFile() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:67
   36.3121  155270000   9. Padawan\Framework\Generator\IndexGenerator->createScopeForFile() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:96
   36.3121  155270320  10. Padawan\Parser\Parser->parseContent() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:112
   36.3208  155630784  11. PhpParser\NodeTraverser->traverse() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Parser.php:50
   36.3208  155630784  12. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
   36.3208  155631208  13. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
   36.3208  155631608  14. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
   36.3222  155659256  15. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
   36.3222  155659808  16. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
   36.3222  155660824  17. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
   36.3222  155661368  18. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
   36.3223  155662360  19. Padawan\Parser\Walker\IndexGeneratingWalker->leaveNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:139
   36.3223  155662360  20. Padawan\Parser\Transformer\ClassAssignmentTransformer->transform() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Walker/IndexGeneratingWalker.php:110
   36.3224  155662360  21. Padawan\Domain\Project\Node\ClassData->hasProp() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Transformer/ClassAssignmentTransformer.php:33
   36.3224  155662360  22. Padawan\Domain\Project\Collection\PropertiesCollection->get() /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Node/ClassData.php:106
   36.3225  155662488  23. array_key_exists() /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Collection/PropertiesCollection.php:52

PHP Warning:  Illegal offset type in /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Collection/PropertiesCollection.php on line 19
PHP Stack trace:
PHP   1. {main}() /Users/daniel/Temporary/padawan.php/bin/padawan:0
PHP   2. Symfony\Component\Console\Application->run() /Users/daniel/Temporary/padawan.php/bin/padawan:26
PHP   3. Symfony\Component\Console\Application->doRun() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:124
PHP   4. Symfony\Component\Console\Application->doRunCommand() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:193
PHP   5. Symfony\Component\Console\Command\Command->run() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:850
PHP   6. Padawan\Command\GenerateCommand->execute() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Command/Command.php:257
PHP   7. Padawan\Framework\Generator\IndexGenerator->generateProjectIndex() /Users/daniel/Temporary/padawan.php/src/Padawan/Command/GenerateCommand.php:40
PHP   8. Padawan\Framework\Generator\IndexGenerator->processFile() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:67
PHP   9. Padawan\Framework\Generator\IndexGenerator->createScopeForFile() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:96
PHP  10. Padawan\Parser\Parser->parseContent() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:112
PHP  11. PhpParser\NodeTraverser->traverse() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Parser.php:50
PHP  12. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
PHP  13. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP  14. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP  15. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP  16. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP  17. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP  18. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP  19. Padawan\Parser\Walker\IndexGeneratingWalker->leaveNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:139
PHP  20. Padawan\Parser\Transformer\ClassAssignmentTransformer->transform() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Walker/IndexGeneratingWalker.php:110
PHP  21. Padawan\Domain\Project\Node\ClassData->addProp() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Transformer/ClassAssignmentTransformer.php:40
PHP  22. Padawan\Domain\Project\Collection\PropertiesCollection->add() /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Node/ClassData.php:110

Warning: Illegal offset type in /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Collection/PropertiesCollection.php on line 19

Call Stack:
    0.0002     357920   1. {main}() /Users/daniel/Temporary/padawan.php/bin/padawan:0
    0.0165    2059864   2. Symfony\Component\Console\Application->run() /Users/daniel/Temporary/padawan.php/bin/padawan:26
    0.0188    2347248   3. Symfony\Component\Console\Application->doRun() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:124
    0.0190    2347248   4. Symfony\Component\Console\Application->doRunCommand() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:193
    0.0190    2347248   5. Symfony\Component\Console\Command\Command->run() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Application.php:850
    0.0192    2349504   6. Padawan\Command\GenerateCommand->execute() /Users/daniel/Temporary/padawan.php/vendor/symfony/console/Command/Command.php:257
    0.1255   37446504   7. Padawan\Framework\Generator\IndexGenerator->generateProjectIndex() /Users/daniel/Temporary/padawan.php/src/Padawan/Command/GenerateCommand.php:40
   36.3116  155261424   8. Padawan\Framework\Generator\IndexGenerator->processFile() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:67
   36.3121  155270000   9. Padawan\Framework\Generator\IndexGenerator->createScopeForFile() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:96
   36.3121  155270320  10. Padawan\Parser\Parser->parseContent() /Users/daniel/Temporary/padawan.php/src/Padawan/Framework/Generator/IndexGenerator.php:112
   36.3208  155630784  11. PhpParser\NodeTraverser->traverse() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Parser.php:50
   36.3208  155630784  12. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
   36.3208  155631208  13. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
   36.3208  155631608  14. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
   36.3222  155659256  15. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
   36.3222  155659808  16. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
   36.3222  155660824  17. PhpParser\NodeTraverser->traverseNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
   36.3222  155661368  18. PhpParser\NodeTraverser->traverseArray() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
   36.3223  155662360  19. Padawan\Parser\Walker\IndexGeneratingWalker->leaveNode() /Users/daniel/Temporary/padawan.php/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:139
   36.3223  155662360  20. Padawan\Parser\Transformer\ClassAssignmentTransformer->transform() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Walker/IndexGeneratingWalker.php:110
   36.3227  155662488  21. Padawan\Domain\Project\Node\ClassData->addProp() /Users/daniel/Temporary/padawan.php/src/Padawan/Parser/Transformer/ClassAssignmentTransformer.php:40
   36.3227  155662488  22. Padawan\Domain\Project\Collection\PropertiesCollection->add() /Users/daniel/Temporary/padawan.php/src/Padawan/Domain/Project/Node/ClassData.php:110

Is it possible that the index is corrupt because of that?

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

@danrot very likely. May I have your Symfony version? I need to test the indexing functionality against the same code.

@danrot
Copy link
Author

danrot commented Jan 4, 2017

@halftan Symfony version is 3.2.1, just did a composer create-project symfony/framework-standard-edition two days ago. Please let me know if you can reproduce the problem, so that I know it's not my fault 😊

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

Here's my output:

[2017-01-04 13:09:27] completer.INFO: processing vendor/symfony/symfony/src/Symfony/Component/VarDumper/Tests/Fixtures/NotLoadableClass.php [] []
[2017-01-04 13:09:27] completer.INFO: Traversing with 1 walkers [] []
[2017-01-04 13:09:27] completer.INFO: Parsing: [0.0005648136138916]s [] []
[2017-01-04 13:09:27] completer.DEBUG: Processing 1 classes [] []
[2017-01-04 13:09:27] completer.DEBUG: Processing 0 interfaces [] []
[2017-01-04 13:09:27] completer.DEBUG: Processing 0 functions [] []
[2017-01-04 13:09:27] completer.DEBUG: Processing node Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass [] []

                                                  
  [Exception]                                     
  Parent class and child class could not be same  
                                                  

Clearly the index file would not be generated since the exception. Class NotLoadableClass should not be indexed by padawan. I've excluded all test related PHP files in PR #87 , please merge that branch and retry:

git remote add halftan https://github.com/halftan/padawan.php.git
git fetch
git checkout master
git merge halftan/enhancement/exclude-test-files-from-indexing

PS: I'm using PHP7.1. If you're still facing this problem try upgrading your PHP to a newer version ( > 7.0 ). I'll switch to PHP 5.6 and run this procedure again to see if it's a PHP version issue.

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

Checked PHP version 5.6 and everything's all right. Besides, the indexing took about 2 times the time PHP 7.1 used.

@danrot
Copy link
Author

danrot commented Jan 4, 2017

Updated to PHP 7.1, changed padawan to dev-master and pulled the changes from origin (since #87 has already been merged in the meantime). Still the same error as I got previously (Illegal offset type). I think I am going to debug that one later, and try to see what the illegal offset type is, that should probably help.

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

$ padawan generate | tee generate.log
$ grep 'Symfony/Bundle/FrameworkBundle/Controller/Controller' generate.log

can you see any line looks like

completer.INFO: processing vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php [] []

@danrot
Copy link
Author

danrot commented Jan 4, 2017

Yeah, got that line...

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

Please run this under your project's root dir

<?php
require 'Your/padawan.php/directory/vendor/autoload.php';
$data = file_get_contents('.padawan/project');
if (function_exists('igbinary_serialize')) {
    $data = igbinary_unserialize($data);
} else {
    $data = unserialize($data);
}

print_r(array_keys($data->getIndex()->getClasses()['Symfony\Bundle\FrameworkBundle\Controller\Controller']->methods->all()));

see if the output is:

Array
(
    [0] => setContainer
    [1] => generateUrl
    [2] => forward
    [3] => redirect
    [4] => redirectToRoute
    [5] => json
    [6] => file
    [7] => addFlash
    [8] => isGranted
    [9] => denyAccessUnlessGranted
    [10] => renderView
    [11] => render
    [12] => stream
    [13] => createNotFoundException
    [14] => createAccessDeniedException
    [15] => createForm
    [16] => createFormBuilder
    [17] => getDoctrine
    [18] => getUser
    [19] => has
    [20] => get
    [21] => getParameter
    [22] => isCsrfTokenValid
)

@danrot
Copy link
Author

danrot commented Jan 4, 2017

Yeah, I exactly have that output.

And regarding Illegal offset warning, I var_dumped the $prop->name variable at https://github.com/padawan-php/padawan.php/blob/master/src/Padawan/Domain/Project/Collection/PropertiesCollection.php#L19. The content in there is an object:

class PhpParser\Node\Expr\Variable#231341 (2) {
  public $name =>
  string(15) "compositeOption"
  protected $attributes =>
  array(2) {
    'startLine' =>
    int(111)
    'endLine' =>
    int(111)
  }
}

Any idea why that is?

But since the output of your previous script is correct it's probably not related to that, right?

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

Seems like it's dynamic object property access.

see symfony/src/Symfony/Component/Validator/Constraints/Composite.php Line 111:

image

@mkusher it seems like the same problem in #63 and issue #61 , I'll have a look on this.

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

@danrot Thanks a lot for your information, I'll keep you inform in this thread once it's been resolved.

@halftan
Copy link
Contributor

halftan commented Jan 4, 2017

Back to completion candidate's issue. Since @danrot 's index file is all right, I could only suspect that something's wrong in ObjectCompleter, so here comes some detailed log info:

add_more_log.txt

please apply this patch on the dev-master branch, and start padawan-server in command line, and try to complete again. This time the log information should be helpful.

@danrot
Copy link
Author

danrot commented Jan 5, 2017

I don't know what the wrong behavior was caused by, but it is gone now 😕 But it only works with the latest master branch, otherwise I get the same error as you now (Parent class and child class could not be same).

So I'll keep it like that for now. Any ideas when the next release is coming with these fixes?

@danrot danrot closed this as completed Jan 5, 2017
@halftan
Copy link
Contributor

halftan commented Jan 5, 2017

Maybe after the features (PR no. greater than 79) are merged. I'm testing these features now. I'll remove the WIP label once I think it's stable enough, then it depends on the project owner to accept it or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants