website/errors/attribute.notFound.md
<?php declare(strict_types = 1);
#[MyCustomAttribute]
class Foo
{
}
The attribute class referenced in the #[...] syntax does not exist. PHP attributes must refer to existing classes. Using a non-existent class as an attribute will cause a runtime error when the attribute is reflected upon.
In the example above, the class MyCustomAttribute is not defined and cannot be autoloaded, so the attribute cannot be resolved.
Define the attribute class or fix the class name if it was misspelled:
<?php declare(strict_types = 1);
+#[\Attribute]
+class MyCustomAttribute
+{
+}
+
#[MyCustomAttribute]
class Foo
{
}
Or correct the class name if the attribute exists under a different name or namespace:
<?php declare(strict_types = 1);
-#[MyCustomAttribute]
+#[\App\Attributes\MyCustomAttribute]
class Foo
{
}