Menu

← Back to property.*

Error Identifier: property.notFound

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

class Foo
{
	public string $name = 'hello';
}

$foo = new Foo();
echo $foo->surname; // ERROR: Access to an undefined property Foo::$surname.

Why is it reported? #

The code accesses a property that does not exist on the object. This typically indicates a typo in the property name, a missing property declaration, or accessing a property on a wrong type. At runtime this would trigger a deprecation notice (or an error in strict scenarios) and return null.

How to fix it #

There are many ways to solve this error. Read the comprehensive article Solving PHPStan error “Access to an undefined property” for all of them, including:

How to ignore this error #

You can use the identifier property.notFound to ignore this error using a comment:

// @phpstan-ignore property.notFound
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: property.notFound

Rules that report this error #

  • PHPStan\Rules\Properties\AccessPropertiesInAssignRule [1]
  • PHPStan\Rules\Properties\AccessPropertiesRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.