Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to tell PHPStorm to hide a method/function/variable/etc

I'm looking for a way to make PHPStorm hide some methods from code completion. I've tried to annotate the DocBlocks with @access private but that does not hide them from view.

Is there any way to hide private API, short of writing/generating a stub file with a limited interface and referencing that in my project?

for example:

Lets say the library has this in it:

<?php


interface IDoABunchOfStuff
{
    /**
     * My library users use this
     */
    public function doFoo();

    /**
     * My Library needs this but requires that my users don't see it.
     *
     * @access private
     * @visibility none
     * @package mylib
     * @internal
     */
    public function doBar();

}

class Foo extends Something implements IDoABunchOfStuff
{
    /**
     * does foo
     */
    public function doFoo()
    {
        // ...
    }

    /**
     * does bar. for internal use only
     *
     * @access private
     * @visibility none
     * @package mylib
     * @internal
     */
    public function _doBar()
    {
        // ...
    }
}

And my library user is typing:

<?php

myAwesomeFunction(IDoABunchOfStuff $aFoo)
{
    if($->$oFoo->[CTRL+SPACE] // invoking code completion...

Is it possible to (and if it is how do I) make it so that my user never sees _doBar?

Neither of the different annotations i've tried seem to have the desired effect.

P.S. I'm using PHPStorm 4.0.3

additional:

In this case I am implementing ArrayAccess and I don't want offsetGet, offsetSet, offsetExists and offsetUnset cluttering up my code completion window but I've had similar problems elsewhere enough to warrant asking a more generalized question.

like image 988
Kris Avatar asked Nov 04 '22 20:11

Kris


1 Answers

Nope -- you cannot do such thing in current version of PhpStorm.

There is a ticket on Issue Tracker that suggests using @access tag for this purpose, but currently it is not scheduled to be implemented for any particular version: http://youtrack.jetbrains.com/issue/WI-5788

Feel free to vote/comment/etc and maybe it will be implemented sooner.

like image 161
LazyOne Avatar answered Nov 08 '22 08:11

LazyOne