In the example below, at what point does the autoloader load the class file, if at all? For example, if $boolean_test === false
does the Subpackage get loaded?
use Org\Group\Package\Subpackage; // autoloader triggered here?
if ($boolean_test) {
Subpackage::method(); // or here?
}
I prefer the use
statement near the top of the code so I can see what packages are used in the page and for slightly better readability. But, if packages are only used based on conditionals, I may be loading unneeded resources.