Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Improve documentation #22

Open
berturion opened this issue Mar 18, 2016 · 4 comments
Open

Improve documentation #22

berturion opened this issue Mar 18, 2016 · 4 comments

Comments

@berturion
Copy link

Hi,
In Java Styles enumeration implementations, members are called with static methods that are not explicitly declared. So, in IDE like Eclipse PHP or other, those methods are not listed for auto-completion.

I found that adding appropriate PHPDocumentor doc blocks resolves this issue.

For example, if you have those members in a Exemple class extending AbstractMultiton:

Exemple::FOO()
Exemple::BAR()

You can add this doc block:

/**
 * @method static Exemple FOO()
 * @method static Exemple BAR()
 */
class Exemple extends AbstractMultiton
{
    (...)
}

Trust me, it is very useful !

@ezzatron
Copy link
Contributor

Seems like useful information to have. I'll try to include this in the README when I get a chance.

@Bilge
Copy link
Contributor

Bilge commented Jun 29, 2016

This is entirely unnecessary. If you do not like those semantics use Enumeration::memberByKey() instead. Static analysis will work in your editor with this calling convention.

@berturion
Copy link
Author

I agree, this is not necessary, but it is more convenient, at least for me.

Exemple::FOO() is shorter than Exemple::memberByKey(Exemple::FOO) or Exemple::memberByKey('FOO') and auto-completion in IDE is called once instead of two.

Without those @method annotations, auto-completion only propose the static member of the enumeration (FOO) so we always need to add parentheses at the end to call the Enumeration object (FOO()). But the IDE doesn't recognize the static method Exemple::FOO() because it is not explicitly declared.

Anyway, it is up to you to add this tip. I just wanted to share it. You can close the issue if you mind.

@Bilge
Copy link
Contributor

Bilge commented Jul 28, 2017

Perhaps you should submit a PR rather than an issue if you want to share this information.

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

No branches or pull requests

3 participants