I have a CakePHP 4 application (though the question applies to PHP in general), with some controller class which uses a factory in one of its methods:
class C