Menu

← Back to class.*

Error Identifier: class.missingExtends

Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.

Code example #

<?php declare(strict_types = 1);

abstract class BaseController
{
}

/**
 * @phpstan-require-extends BaseController
 */
interface ControllerInterface
{
}

class MyService implements ControllerInterface
{
}

Why is it reported? #

An interface or trait declares a @phpstan-require-extends tag that requires any implementing class (or class using the trait) to extend a specific base class. The class does not extend the required class.

In the example above, ControllerInterface requires implementing classes to extend BaseController, but MyService does not extend BaseController.

How to fix it #

Extend the required base class:

-class MyService implements ControllerInterface
+class MyService extends BaseController implements ControllerInterface
 {
 }

How to ignore this error #

You can use the identifier class.missingExtends to ignore this error using a comment:

// @phpstan-ignore class.missingExtends
codeThatProducesTheError();

You can also use only the identifier key to ignore all errors of the same type in your configuration file in the ignoreErrors parameter:

parameters:
	ignoreErrors:
		-
			identifier: class.missingExtends

Rules that report this error #

  • PHPStan\Rules\Classes\RequireExtendsRule [1] [2]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.