website/errors/generics.noParent.md
<?php declare(strict_types = 1);
/**
* @template T
* @template U of \Exception
*/
class Collection
{
}
/**
* @extends Collection<int, \InvalidArgumentException>
*/
class FooDoesNotExtendAnything
{
}
The class has an @extends PHPDoc tag specifying generic type arguments for Collection, but it does not actually extend any class. The @extends tag is meaningless without a corresponding extends clause in the class declaration.
The same applies to @implements tags on classes that do not implement the referenced interface, and @use tags on classes that do not use the referenced trait.
Add the missing extends clause:
/**
* @extends Collection<int, \InvalidArgumentException>
*/
-class FooDoesNotExtendAnything
+class FooDoesNotExtendAnything extends Collection
{
}
Or remove the unnecessary @extends tag if the class is not supposed to extend Collection:
-/**
- * @extends Collection<int, \InvalidArgumentException>
- */
class FooDoesNotExtendAnything
{
}