That's an issue, indeed. I've already thought about it and the only solution I can think of is to mark types explicitly (see jsdoc: `{int}`). This would also allow renderers and IDEs to link types even if they are part of the description. But this is another topic.

Am 05.10.2019 10:22 schrieb Ben Mewburn <b...@mewburn.id.au>:
Hello,
One solution here is to remove @throws from the list of tags that must be inherited.
I guess the aim of having @throws inherited is like Java checked exceptions?
Though, haven't other languages like C# avoided this because it creates just as many problems as it solves?

On Monday, November 26, 2018 at 10:28:06 PM UTC+11, Magnar Ovedal Myrtveit wrote:
According to the current version of PSR-19, PHPDoc is implicitly inherited, and even when PHPDoc is present in both the subclass and the superclass, tags that are present in the superclass' PHPDoc but not in the subclass' PHPDoc are inherited.

I think this is a very good idea, but I see a potential issue. Consider the following code.
interface FooInterface {
/**
* @throws RuntimeException If the operation fails.
*/
public function foo();
}

class FooImplementation implements FooInterface {
public function foo() {
// Do something that will never fail.
}
}

FooImplementation::foo() will never throw an exception, but FooInterface allows other implementations of FooInterface::foo() to throw exceptions. For someone depending on FooInterface, they will have to handle any thrown exceptions. For someone depending on FooImplementation, however, they do not have to care about FooImplementation::foo() throwing exceptions. But there seems to be no way to prevent FooImplementation::foo() from inheriting the @throws tag from FooInterface::foo().

Do we need a way to specify tags that should not be inherited?

--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/f4624339-bfe7-4ad8-a7f0-3bc3f067bb32%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/b878256a-d509-42bb-9eb9-1275fd6c8cda%40email.android.com.

Reply via email to