Laravel-ide-helper: Get IdeHelper to generate functions for custom static facade

Created on 29 Oct 2014  路  3Comments  路  Source: barryvdh/laravel-ide-helper

Laravel Framework version 4.2.11
IdeHelper has been extremely useful for providing autocomplete for Laravel facades.
I want to use a custom facade for one of my interfaces but I don't know how to get IdeHelper to find and parse my facade.

I have an interface defined in app/classes with two implementations for different environments
The bindings are in bootstrap/start.php

App::bind('AnInterface', 'AClass');

I have also defined a facade in app/classes

<?php
use Illuminate\Support\Facades\Facade;

/**
 * Class AnApi
 *
 */
class AnApi extends Facade {
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor() { return 'AnInterface'; }
}

Calling static methods on the facade AnApi::myMethod() call the correct methods on the object, but IdeHelper doesn't generate a class so the Ide doesn't autocomplete.

I've tried adding references in the config under 'extra' and 'interfaces' but nothing has worked so far.

Any help much appreciated.

thanks

Marcus

Most helpful comment

The IDE helper looks in for the aliases defined by the AliasLoader (usually the ones in app/config/app.php, the facades array). That should analyze the facade.

All 3 comments

The IDE helper looks in for the aliases defined by the AliasLoader (usually the ones in app/config/app.php, the facades array). That should analyze the facade.

Thanks that has worked. I had to add my facade class to a namespace to get it to work.

@barryvdh OP reported it's solved, issue can be closed :}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lambik picture Lambik  路  5Comments

Newbie012 picture Newbie012  路  4Comments

ttomdewit picture ttomdewit  路  5Comments

half-evil picture half-evil  路  3Comments

quantumwebco picture quantumwebco  路  4Comments