[TASK] Harden \TYPO3\CMS\Extbase\Service\EnvironmentService 92/59592/3
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Thu, 31 Jan 2019 17:26:48 +0000 (18:26 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 1 Feb 2019 13:37:38 +0000 (14:37 +0100)
- Use strict type mode
- Use type hints whereever possible

Releases: master
Resolves: #87597
Change-Id: Ic4cfb5512f49b3e20fa16c782301b8dcb2ba5dec
Reviewed-on: https://review.typo3.org/59592
Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: André Schließer <andy.schliesser@gmail.com>
Tested-by: André Schließer <andy.schliesser@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Felix Döring <Felix.Doering@3m5.de>
Tested-by: Felix Döring <Felix.Doering@3m5.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Documentation/Changelog/master/Important-87603-ClassesUseStrictModeAndScarlarTypeHints.rst
typo3/sysext/extbase/Classes/Service/EnvironmentService.php

index 68c7e0b..0f983df 100644 (file)
@@ -16,5 +16,6 @@ and their methods will force parameter types with scalar type hints:
 - :php:`\TYPO3\CMS\Extbase\Security\Cryptography\HashService`
 - :php:`\TYPO3\CMS\Extbase\Service\CacheService`
 - :php:`\TYPO3\CMS\Extbase\Utility\TypeHandlingUtility`
+- :php:`\TYPO3\CMS\Extbase\Service\EnvironmentService`
 
 .. index:: Backend, PHP-API, ext:extbase
index 37f0ba9..72dac2a 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+declare(strict_types = 1);
+
 namespace TYPO3\CMS\Extbase\Service;
 
 /*
@@ -25,7 +27,7 @@ class EnvironmentService implements \TYPO3\CMS\Core\SingletonInterface
      *
      * @return bool
      */
-    public function isEnvironmentInFrontendMode()
+    public function isEnvironmentInFrontendMode(): bool
     {
         return (defined('TYPO3_MODE') && TYPO3_MODE === 'FE') ?: false;
     }
@@ -35,7 +37,7 @@ class EnvironmentService implements \TYPO3\CMS\Core\SingletonInterface
      *
      * @return bool
      */
-    public function isEnvironmentInBackendMode()
+    public function isEnvironmentInBackendMode(): bool
     {
         return (defined('TYPO3_MODE') && TYPO3_MODE === 'BE') ?: false;
     }
@@ -43,7 +45,7 @@ class EnvironmentService implements \TYPO3\CMS\Core\SingletonInterface
     /**
      * @return string
      */
-    public function getServerRequestMethod()
+    public function getServerRequestMethod(): string
     {
         return isset($_SERVER['REQUEST_METHOD']) && is_string($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
     }