The whole principle of autoload is that files are looked up when needed by code.
(自动加载的全部原理是在代码需要时查找文件。)
It also assumes that class files don't have any runtime logic and including class file only makes class definition(s) available. (它还假定类文件没有任何运行时逻辑,并且包括类文件仅使类定义可用。)
If you have some kind of runtime logic with definitions it's advisable to separate it out for use with autoload.
(如果您有某种带有定义的运行时逻辑,建议将其分离出来以用于自动加载。)
You could try to make an explicit load procedure that tries to instantiate classes in your preferred order but that won't be too robust long term.
(您可以尝试创建一个显式的加载过程,该过程尝试按您的首选顺序实例化类,但长期来看不会太健壮。)
In a nutshell — change to autoload completely or stick with explicit load, don't mix the approaches for the same classes.
(简而言之,更改为完全自动加载或坚持显式加载,不要将相同类的方法混在一起。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…