thephpleague / omnipay-common

Core components for the Omnipay PHP payment processing library
MIT License
330 stars 244 forks source link

AbstractGatewayTest.php Inconsistencies #142

Closed wimpog closed 7 years ago

wimpog commented 7 years ago

class AbstractGatewayTest_MockAbstractGateway extends AbstractGateway { public function getName() { return 'Mock Gateway Implementation'; }

public function getProtectedHttpClient()
{
    return $this->httpClient;
}

public function getProtectedHttpRequest()
{
    return $this->httpRequest;
}

public function callCreateRequest($class, array $parameters)
{
    return $this->createRequest($class, $parameters);
}

}

Error Class must be declared abstract or implement methods 'completeAuthorize', 'deleteCard', 'completePurchase', 'authorize', 'void', 'purchase', 'capture', 'createCard', 'updateCard', 'refund'

Is this test not finished or what?

delatbabel commented 7 years ago

Where are you seeing that error?

IIRC it's something that phpStorm throws up based on the tags in the comments in the abstract class but not actually a real PHP error.

dcaswel commented 7 years ago

I have run into this issue on PhpStorm as well. Does anyone know of a way to make it so PhpStorm doesn't give an error based on what is in the comments?

delatbabel commented 7 years ago

This is a question for the makers of phpStorm not for the omnipay library. I hit this error a lot but I just ignore it.

dcaswel commented 7 years ago

I have done some research on this and it looks like PhpStorm maybe right in the way it is treating this. I found a page(https://www.phpdoc.org/docs/latest/references/phpdoc/tags/method.html) that talks about the @method tag and it's purpose. It seems that the purpose here is to document methods that are implemented through __call instead of a standard function so when PhpStorm doesn't see the same tags in the concrete class, it throws that error. It would be nice if we could find a different way to document those methods but I have not seen one. PhpStorm does offer a couple solutions. You can "Disable Inspection" but I don't recommend this option because it disables that inspection for all of your classes, not just the current one. You can also "suppress" the inspection which adds a comment to your code but then the error will only be gone in the current class. The third option is to do as @delatbabel does and just realize that error is not an actual php error and ignore it. I haven't decided yet what I am going to do. Probably the third option.

delatbabel commented 7 years ago

The third option is the winner for me. I'm closing this because it's not an actual PHP bug in either omnipay or the test classes, just a feature of the way that annotations are handled by certain non-PHP code checking tools.