[TASK] Harden \TYPO3\CMS\Extbase\Reflection\ClassSchema 77/60277/2
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Sun, 17 Mar 2019 08:15:18 +0000 (08:15 +0000)
committerBenni Mack <benni@typo3.org>
Mon, 18 Mar 2019 13:54:28 +0000 (14:54 +0100)
- Use strict type mode
- Use type hints whereever possible

Releases: master
Resolves: #87940
Change-Id: I3f349d1cbb4ceec408de7e5d18cd1f0fc5cf4c7b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60277
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/extbase/Classes/Reflection/ClassSchema.php

index b53e32e..856e6eb 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+declare(strict_types = 1);
+
 namespace TYPO3\CMS\Extbase\Reflection;
 
 /*
@@ -121,7 +123,7 @@ class ClassSchema
      * @throws InvalidValidationConfigurationException
      * @throws \ReflectionException
      */
-    public function __construct($className)
+    public function __construct(string $className)
     {
         $this->className = $className;
         $this->bitSet = new BitSet();
@@ -192,7 +194,7 @@ class ClassSchema
      * @throws \Doctrine\Common\Annotations\AnnotationException
      * @throws \TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException
      */
-    protected function reflectProperties(\ReflectionClass $reflectionClass)
+    protected function reflectProperties(\ReflectionClass $reflectionClass): void
     {
         $annotationReader = new AnnotationReader();
 
@@ -301,7 +303,7 @@ class ClassSchema
      * @throws \ReflectionException
      * @throws \TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException
      */
-    protected function reflectMethods(\ReflectionClass $reflectionClass)
+    protected function reflectMethods(\ReflectionClass $reflectionClass): void
     {
         $annotationReader = new AnnotationReader();
 
@@ -409,7 +411,7 @@ class ClassSchema
                     if (isset($params[$parameterPosition])) {
                         /** @var Param $param */
                         $param = $params[$parameterPosition];
-                        $this->methods[$methodName]['params'][$parameterName]['type'] = ltrim($param->getType(), '\\');
+                        $this->methods[$methodName]['params'][$parameterName]['type'] = ltrim((string)$param->getType(), '\\');
                     }
                 }
 
@@ -516,7 +518,7 @@ class ClassSchema
      * @param string $propertyName Name of the property
      * @return bool
      */
-    public function hasProperty($propertyName): bool
+    public function hasProperty(string $propertyName): bool
     {
         return array_key_exists($propertyName, $this->properties);
     }