doctrine/orm · error · InvalidArgumentException
The $reportFieldsWhereDeclared argument is no longer support
Error message
The $reportFieldsWhereDeclared argument is no longer supported, make sure to omit it when calling %s.
What it means
In doctrine/orm 3.x the AttributeDriver constructor's second parameter $reportFieldsWhereDeclared was reduced to a no-op kept only for signature compatibility. It still defaults to true, but explicitly passing false throws an InvalidArgumentException, because the old 'do not report fields declared in a mapped superclass' behaviour no longer exists.
Source
Thrown at src/Mapping/Driver/AttributeDriver.php:45
{
use ColocatedMappingDriver;
use ReflectionBasedDriver;
private const ENTITY_ATTRIBUTE_CLASSES = [
Mapping\Entity::class => 1,
Mapping\MappedSuperclass::class => 2,
];
private readonly AttributeReader $reader;
/**
* @param string[]|ClassLocator $paths a ClassLocator, or an array of directories.
* @param true $reportFieldsWhereDeclared no-op, to be removed in 4.0
*/
public function __construct(array|ClassLocator $paths, bool $reportFieldsWhereDeclared = true)
{
if (! $reportFieldsWhereDeclared) {
throw new InvalidArgumentException(sprintf(
'The $reportFieldsWhereDeclared argument is no longer supported, make sure to omit it when calling %s.',
__METHOD__,
));
}
$this->reader = new AttributeReader();
if ($paths instanceof ClassLocator) {
$this->classLocator = $paths;
} else {
$this->addPaths($paths);
}
}
public function isTransient(string $className): bool
{
$classAttributes = $this->reader->getClassAttributes(new ReflectionClass($className));
View on GitHub (pinned to d9b9ff7301)
Solutions
- Remove the second argument entirely: new AttributeDriver($paths).
- If the value comes from bundle config (DoctrineBundle service definition, Symfony recipe), upgrade the bundle/recipe so the argument is no longer forwarded.
- Search the project for 'new AttributeDriver(' and for the literal 'reportFieldsWhereDeclared' in config/compiler passes and delete the wiring.
Example fix
// before $driver = new AttributeDriver([__DIR__ . '/src/Entity'], false); // after $driver = new AttributeDriver([__DIR__ . '/src/Entity']);
Defensive patterns
Strategy: validation
Validate before calling
// The argument is a no-op: simply never pass it. $driver = new AttributeDriver($paths);
Prevention
- After major ORM upgrades, grep for 'new AttributeDriver(' and remove dropped arguments.
- Keep DoctrineBundle/Symfony recipes updated so constructor arguments are forwarded correctly.
- Add a smoke test that boots the EntityManager config.
When it happens
Trigger: Any call of the form new AttributeDriver($paths, false) — i.e. explicitly passing false as the second constructor argument. Omitting the argument or passing true works.
Common situations: Upgrading from ORM 2.x / early 3.x, where applications or bundles passed false to silence 'field declared in subclass' deprecation notices; copy-pasted configuration snippets or old Symfony/DoctrineBundle recipes that forward the flag.
Related errors
- The lazy ghost object feature cannot be disabled anymore. Pl
- Rejecting ID collisions in the identity map cannot be disabl
- Uninitialized result set mapping.
- Unable to use access strategy type of [%s] without a Concurr
- Unrecognized access strategy type [%s]
AI-assisted analysis of doctrine/orm@d9b9ff7301 (2026-08-21).
Data as JSON: /api/errors/a9388af67ddf42fd.
Report an issue: GitHub.