Issue Task Closed

#96267Add dedicated error for class construction without dependencies

Mathias Brodala 12/07/21, 09:29 updated 09/14/26, 06:10

Description

Right now if GeneralUtility::makeInstance() is used to construct a class which uses constructor dependency injection and has not being marked as public, a low-level \ArgumentCountError is thrown by PHP.

This should be improved by catching this case and replacing the error with a custom one (e.g. MissingDependenciesError). Either that custom error already hints at possible solutions or its dedicated error code is used to link to the docs with more details. The docs could then suggest to mark the class as public or manually pass the dependencies as arguments.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 2

  1. Mathias Brodala commented and changed status New Closed <span data-processor="relativetime" data-value="2026-09-14T06:10:18+00:00" > 09/14/26, 06:10 </span>

    Less relevant these days since proper DI adoption is a lot higher.