#98097Add type hints to all GeneralUtility::makeInstance calls
Description
Hi,
This is a change request to make it easier for PHPStan to check the code and IDEs to give helpful hints.
As an example
public/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
Line 541
$tce = GeneralUtility::makeInstance(DataHandler::class);
this should be changed to
/** @var DataHandler $tce */
$tce = GeneralUtility::makeInstance(DataHandler::class);
And I would like to suggest a change for coding styles like this.
Same file line 1079
$file = GeneralUtility::makeInstance(ResourceFactory::class)->getFileObject($fileUid);
This should be change in general to something like
/** @var ResourceFactory $resourceFactory */
$resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
$file = $resourceFactory->getFileObject($fileUid);
Only this way PHPStan and your IDE knows what to expect and navigating from one file to the next is just a click away.
Thanks