Menu

← Back to interface.*

Error Identifier: interface.nameCase

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);

interface Loggable
{
	public function log(): void;
}

class Foo implements loggable
{
	public function log(): void
	{
	}
}

Why is it reported? #

An interface is referenced with a different letter casing than its declaration. While PHP class and interface names are case-insensitive and the code will work at runtime, using incorrect casing is considered poor practice. It makes code harder to read and can cause confusion.

In the example above, the interface is declared as Loggable with an uppercase L, but referenced as loggable with a lowercase l.

How to fix it #

Match the casing of the interface reference to its declaration:

 <?php declare(strict_types = 1);
 
-class Foo implements loggable
+class Foo implements Loggable
 {
 	public function log(): void
 	{
 	}
 }

How to ignore this error #

You can use the identifier interface.nameCase to ignore this error using a comment:

// @phpstan-ignore interface.nameCase
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: interface.nameCase

Rules that report this error #

  • PHPStan\Rules\Classes\ClassAttributesRule [1]
  • PHPStan\Rules\Classes\ClassConstantAttributesRule [1]
  • PHPStan\Rules\Classes\ClassConstantRule [1]
  • PHPStan\Rules\Classes\ExistingClassInClassExtendsRule [1]
  • PHPStan\Rules\Classes\ExistingClassInInstanceOfRule [1]
  • PHPStan\Rules\Classes\ExistingClassInTraitUseRule [1]
  • PHPStan\Rules\Classes\ExistingClassesInClassImplementsRule [1]
  • PHPStan\Rules\Classes\ExistingClassesInEnumImplementsRule [1]
  • PHPStan\Rules\Classes\ExistingClassesInInterfaceExtendsRule [1]
  • PHPStan\Rules\Classes\InstantiationRule [1]
  • PHPStan\Rules\Classes\LocalTypeAliasesRule [1]
  • PHPStan\Rules\Classes\LocalTypeTraitAliasesRule [1]
  • PHPStan\Rules\Classes\LocalTypeTraitUseAliasesRule [1]
  • PHPStan\Rules\Classes\MethodTagRule [1]
  • PHPStan\Rules\Classes\MethodTagTraitRule [1]
  • PHPStan\Rules\Classes\MethodTagTraitUseRule [1]
  • PHPStan\Rules\Classes\MixinRule [1]
  • PHPStan\Rules\Classes\MixinTraitRule [1]
  • PHPStan\Rules\Classes\MixinTraitUseRule [1]
  • PHPStan\Rules\Classes\PropertyTagRule [1]
  • PHPStan\Rules\Classes\PropertyTagTraitRule [1]
  • PHPStan\Rules\Classes\PropertyTagTraitUseRule [1]
  • PHPStan\Rules\Constants\ConstantAttributesRule [1]
  • PHPStan\Rules\EnumCases\EnumCaseAttributesRule [1]
  • PHPStan\Rules\Exceptions\CaughtExceptionExistenceRule [1]
  • PHPStan\Rules\Functions\ArrowFunctionAttributesRule [1]
  • PHPStan\Rules\Functions\ClosureAttributesRule [1]
  • PHPStan\Rules\Functions\ExistingClassesInArrowFunctionTypehintsRule [1]
  • PHPStan\Rules\Functions\ExistingClassesInClosureTypehintsRule [1]
  • PHPStan\Rules\Functions\ExistingClassesInTypehintsRule [1]
  • PHPStan\Rules\Functions\FunctionAttributesRule [1]
  • PHPStan\Rules\Functions\ParamAttributesRule [1]
  • PHPStan\Rules\Generics\ClassTemplateTypeRule [1]
  • PHPStan\Rules\Generics\FunctionTemplateTypeRule [1]
  • PHPStan\Rules\Generics\InterfaceTemplateTypeRule [1]
  • PHPStan\Rules\Generics\MethodTagTemplateTypeRule [1]
  • PHPStan\Rules\Generics\MethodTagTemplateTypeTraitRule [1]
  • PHPStan\Rules\Generics\MethodTemplateTypeRule [1]
  • PHPStan\Rules\Generics\TraitTemplateTypeRule [1]
  • PHPStan\Rules\Methods\CallStaticMethodsRule [1]
  • PHPStan\Rules\Methods\ExistingClassesInTypehintsRule [1]
  • PHPStan\Rules\Methods\MethodAttributesRule [1]
  • PHPStan\Rules\Methods\StaticMethodCallableRule [1]
  • PHPStan\Rules\Namespaces\ExistingNamesInGroupUseRule [1]
  • PHPStan\Rules\Namespaces\ExistingNamesInUseRule [1]
  • PHPStan\Rules\PhpDoc\FunctionAssertRule [1]
  • PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeRule [1]
  • PHPStan\Rules\PhpDoc\IncompatiblePropertyHookPhpDocTypeRule [1]
  • PHPStan\Rules\PhpDoc\IncompatiblePropertyPhpDocTypeRule [1]
  • PHPStan\Rules\PhpDoc\InvalidPhpDocVarTagTypeRule [1]
  • PHPStan\Rules\PhpDoc\MethodAssertRule [1]
  • PHPStan\Rules\PhpDoc\RequireExtendsDefinitionClassRule [1]
  • PHPStan\Rules\PhpDoc\RequireExtendsDefinitionTraitRule [1]
  • PHPStan\Rules\PhpDoc\RequireImplementsDefinitionTraitRule [1]
  • PHPStan\Rules\PhpDoc\SealedDefinitionClassRule [1]
  • PHPStan\Rules\Properties\AccessStaticPropertiesInAssignRule [1]
  • PHPStan\Rules\Properties\AccessStaticPropertiesRule [1]
  • PHPStan\Rules\Properties\ExistingClassesInPropertiesRule [1]
  • PHPStan\Rules\Properties\ExistingClassesInPropertyHookTypehintsRule [1]
  • PHPStan\Rules\Properties\PropertyAttributesRule [1]
  • PHPStan\Rules\Properties\PropertyHookAttributesRule [1]
  • PHPStan\Rules\Traits\TraitAttributesRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.