{"record":{"id":"a9388af67ddf42fd","repo":"doctrine/orm","slug":"the-reportfieldswheredeclared-argument-is-no-long","errorCode":null,"errorMessage":"The $reportFieldsWhereDeclared argument is no longer supported, make sure to omit it when calling %s.","messagePattern":"The \\$reportFieldsWhereDeclared argument is no longer supported, make sure to omit it when calling (.+?)\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Mapping/Driver/AttributeDriver.php","lineNumber":45,"sourceCode":"{\n    use ColocatedMappingDriver;\n    use ReflectionBasedDriver;\n\n    private const ENTITY_ATTRIBUTE_CLASSES = [\n        Mapping\\Entity::class => 1,\n        Mapping\\MappedSuperclass::class => 2,\n    ];\n\n    private readonly AttributeReader $reader;\n\n    /**\n     * @param string[]|ClassLocator $paths                     a ClassLocator, or an array of directories.\n     * @param true                  $reportFieldsWhereDeclared no-op, to be removed in 4.0\n     */\n    public function __construct(array|ClassLocator $paths, bool $reportFieldsWhereDeclared = true)\n    {\n        if (! $reportFieldsWhereDeclared) {\n            throw new InvalidArgumentException(sprintf(\n                'The $reportFieldsWhereDeclared argument is no longer supported, make sure to omit it when calling %s.',\n                __METHOD__,\n            ));\n        }\n\n        $this->reader = new AttributeReader();\n\n        if ($paths instanceof ClassLocator) {\n            $this->classLocator = $paths;\n        } else {\n            $this->addPaths($paths);\n        }\n    }\n\n    public function isTransient(string $className): bool\n    {\n        $classAttributes = $this->reader->getClassAttributes(new ReflectionClass($className));\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/doctrine/orm/blob/d9b9ff73016bf598ae07515f97289ce8074e97a5/src/Mapping/Driver/AttributeDriver.php#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n$driver = new AttributeDriver([__DIR__ . '/src/Entity'], false);\n\n// after\n$driver = new AttributeDriver([__DIR__ . '/src/Entity']);","handlingStrategy":"validation","validationCode":"// The argument is a no-op: simply never pass it.\n$driver = new AttributeDriver($paths);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["doctrine-orm","attribute-driver","upgrade","breaking-change"],"backgroundTag":"removed-constructor-argument","analyzedSha":"d9b9ff73016bf598ae07515f97289ce8074e97a5","analyzedAt":"2026-08-21T06:13:15.863Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}