m2mdas / phpcomplete-extended

A fast, extensible, context aware autocomplete plugin for PHP composer projects with code inspection features.
MIT License
216 stars 23 forks source link

Index generation error for cakephp #27

Open nkvorn opened 10 years ago

nkvorn commented 10 years ago

I am trying to use phpcomplete-extended with a cake php project however I cannot get the index to be generated...

Here is the output I get:

PHP Fatal error:  Call to undefined function __d() in /home/nkvorn/Downloads/test_cake/vendor/pear-pear.cakephp.org/CakePHP/Cake/Network/Http/HttpResponse.php on line 21
Fatal error: Call to undefined function __d() in /home/nkvorn/Downloads/test_cake/vendor/pear-pear.cakephp.org/CakePHP/Cake/Network/Http/HttpResponse.php on line 21
Loading Index
Error detected while processing function phpcomplete_extended#readDataForProject
..phpcomplete_extended#loadProject..<SNR>119_loadIndex..<SNR>119_readIndex:
line    2:
Could not read index file .phpcomplete_extended/phpcomplete_index
Index Loaded.

Note that this command does not fail:

$ composer dumpautoload --optimize
Generating optimized autoload files

Here is a bash script to create a test project that reproduces this behaviour for me:

#!/bin/bash

mkdir test_cake
cd test_cake
cat << 'EOF' >composer.json
{
    "name": "example-app",
    "repositories": [
    {
        "type": "pear",
        "url": "http://pear.cakephp.org"
    }
    ],
        "require": {
            "pear-cakephp/cakephp": ">=2.4.0"
        }
}
EOF
composer install
#vendor/bin/cake bake app -q   # optionaly bake the app
m2mdas commented 10 years ago

Well CakePHP uses custom auto-loading mechanism and also maintains its own classmap instead of utilizing composer PSR-0 auto-loading mechanism(see here and here) but this plugin currently only support PSR-0 auto-loading standard. To support CakePHP a separate plugin like phpcomplete-extended-laravel needs to be written. I will write a plugin for it if I get some free time.