2

I'm working on a PHP library and I have two classes.

First one is like this:

/**
 * @method static A getInstance()
 */
interface A {...}

Second one is like this:

class B implements A {...}

getInstance is not defined in A, except in PHPDoc above class. Now, my IDE (PHPStorm) suggests an error, saying that I should implement getInstance in B.

My questions are:

  1. Why they put this method in PHPDoc even though it's not declared in the interface? I doubt it's a mistake, since they used the same comment in many other classes.

  2. What do you recommend? should I implement in B or should I remove the PHPDoc comment from A?

2
  • Can you attach a link to the library that contains interface A? Commented Jan 16, 2019 at 8:27
  • @MaximFedorov Of course. Here: github.com/oxwall/oxwall/blob/… Commented Jan 16, 2019 at 8:28

1 Answer 1

1

I think it's the mistake because any of the classes which implement OW_Storage interface don't implement getInstance() method. You can make sure it with help search. It means this function isn't used.

You can remove the doc block from the interface but right way is to do pull-request in origin repository.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.