From e9a4898976d8af15cc726228e35376b24ac9c88d Mon Sep 17 00:00:00 2001 From: Alexander Schnitzler <git@alexanderschnitzler.de> Date: Wed, 15 Apr 2020 13:29:00 +0200 Subject: [PATCH] [TASK] Add final private constructor to GeneralUtility GeneralUtility is a class with only static methods and a class comment stated for years not to instantiate it. Since there is a possibility to prevent instantiations of classes with private constructors, one has added to this class and on top is has been marked final. Releases: master Resolves: #91043 Change-Id: I15e2dfa98b2a30149f9f0efed31281d5d01d4efa Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64181 Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Oliver Hader <oliver.hader@typo3.org> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Benni Mack <benni@typo3.org> --- typo3/sysext/core/Classes/Utility/GeneralUtility.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index 466e86f0a307..e7a8a376d77e 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -39,8 +39,7 @@ use TYPO3\CMS\Core\SingletonInterface; * You are encouraged to use this library in your own scripts! * * USE: - * The class is intended to be used without creating an instance of it. - * So: Don't instantiate - call functions with "\TYPO3\CMS\Core\Utility\GeneralUtility::" prefixed the function name. + * All methods in this class are meant to be called statically. * So use \TYPO3\CMS\Core\Utility\GeneralUtility::[method-name] to refer to the functions, eg. '\TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds()' */ class GeneralUtility @@ -96,6 +95,10 @@ class GeneralUtility */ protected static $indpEnvCache = []; + final private function __construct() + { + } + /************************* * * GET/POST Variables -- GitLab