[CLEANUP] Extbase reflection classes 44/29444/7
authorMarkus Klein <klein.t3@mfc-linz.at>
Sun, 13 Apr 2014 15:11:48 +0000 (17:11 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 1 Jul 2014 19:44:41 +0000 (21:44 +0200)
Remove unnessessary full qualified class names.
Cleanup docheaders.

Resolves: #57878
Releases: 6.3
Change-Id: I5bcdb80c27da1698fd1446a001907d83c6845507
Reviewed-on: https://review.typo3.org/29444
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/extbase/Classes/Reflection/ClassReflection.php
typo3/sysext/extbase/Classes/Reflection/MethodReflection.php
typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php
typo3/sysext/extbase/Classes/Reflection/ParameterReflection.php
typo3/sysext/extbase/Classes/Reflection/PropertyReflection.php
typo3/sysext/extbase/Classes/Reflection/ReflectionService.php

index 857f560..2b22294 100644 (file)
@@ -19,32 +19,23 @@ namespace TYPO3\CMS\Extbase\Reflection;
 class ClassReflection extends \ReflectionClass {
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\DocCommentParser Holds an instance of the doc comment parser for this class
+        * @var DocCommentParser Holds an instance of the doc comment parser for this class
         */
        protected $docCommentParser;
 
-       /**
-        * The constructor - initializes the class
-        *
-        * @param string $className Name of the class \TYPO3\CMS\Extbase\Reflection to reflect
-        */
-       public function __construct($className) {
-               parent::__construct($className);
-       }
-
        /**
         * Replacement for the original getMethods() method which makes sure
         * that \TYPO3\CMS\Extbase\Reflection\MethodReflection objects are returned instead of the
-        * orginal ReflectionMethod instances.
+        * original ReflectionMethod instances.
         *
         * @param integer|NULL $filter A filter mask
-        * @return \TYPO3\CMS\Extbase\Reflection\MethodReflection Method reflection objects of the methods in this class
+        * @return MethodReflection[] Method reflection objects of the methods in this class
         */
        public function getMethods($filter = NULL) {
                $extendedMethods = array();
                $methods = $filter === NULL ? parent::getMethods() : parent::getMethods($filter);
                foreach ($methods as $method) {
-                       $extendedMethods[] = new \TYPO3\CMS\Extbase\Reflection\MethodReflection($this->getName(), $method->getName());
+                       $extendedMethods[] = new MethodReflection($this->getName(), $method->getName());
                }
                return $extendedMethods;
        }
@@ -52,47 +43,47 @@ class ClassReflection extends \ReflectionClass {
        /**
         * Replacement for the original getMethod() method which makes sure
         * that \TYPO3\CMS\Extbase\Reflection\MethodReflection objects are returned instead of the
-        * orginal ReflectionMethod instances.
+        * original ReflectionMethod instances.
         *
         * @param string $name
-        * @return \TYPO3\CMS\Extbase\Reflection\MethodReflection Method reflection object of the named method
+        * @return MethodReflection Method reflection object of the named method
         */
        public function getMethod($name) {
                $parentMethod = parent::getMethod($name);
                if (!is_object($parentMethod)) {
                        return $parentMethod;
                }
-               return new \TYPO3\CMS\Extbase\Reflection\MethodReflection($this->getName(), $parentMethod->getName());
+               return new MethodReflection($this->getName(), $parentMethod->getName());
        }
 
        /**
         * Replacement for the original getConstructor() method which makes sure
         * that \TYPO3\CMS\Extbase\Reflection\MethodReflection objects are returned instead of the
-        * orginal ReflectionMethod instances.
+        * original ReflectionMethod instances.
         *
-        * @return \TYPO3\CMS\Extbase\Reflection\MethodReflection Method reflection object of the constructor method
+        * @return MethodReflection Method reflection object of the constructor method
         */
        public function getConstructor() {
                $parentConstructor = parent::getConstructor();
                if (!is_object($parentConstructor)) {
                        return $parentConstructor;
                }
-               return new \TYPO3\CMS\Extbase\Reflection\MethodReflection($this->getName(), $parentConstructor->getName());
+               return new MethodReflection($this->getName(), $parentConstructor->getName());
        }
 
        /**
         * Replacement for the original getProperties() method which makes sure
         * that \TYPO3\CMS\Extbase\Reflection\PropertyReflection objects are returned instead of the
-        * orginal ReflectionProperty instances.
+        * original ReflectionProperty instances.
         *
         * @param integer|NULL $filter A filter mask
-        * @return array of \TYPO3\CMS\Extbase\Reflection\PropertyReflection Property reflection objects of the properties in this class
+        * @return PropertyReflection[] Property reflection objects of the properties in this class
         */
        public function getProperties($filter = NULL) {
                $extendedProperties = array();
                $properties = $filter === NULL ? parent::getProperties() : parent::getProperties($filter);
                foreach ($properties as $property) {
-                       $extendedProperties[] = new \TYPO3\CMS\Extbase\Reflection\PropertyReflection($this->getName(), $property->getName());
+                       $extendedProperties[] = new PropertyReflection($this->getName(), $property->getName());
                }
                return $extendedProperties;
        }
@@ -100,27 +91,27 @@ class ClassReflection extends \ReflectionClass {
        /**
         * Replacement for the original getProperty() method which makes sure
         * that a \TYPO3\CMS\Extbase\Reflection\PropertyReflection object is returned instead of the
-        * orginal ReflectionProperty instance.
+        * original ReflectionProperty instance.
         *
         * @param string $name Name of the property
-        * @return \TYPO3\CMS\Extbase\Reflection\PropertyReflection Property reflection object of the specified property in this class
+        * @return PropertyReflection Property reflection object of the specified property in this class
         */
        public function getProperty($name) {
-               return new \TYPO3\CMS\Extbase\Reflection\PropertyReflection($this->getName(), $name);
+               return new PropertyReflection($this->getName(), $name);
        }
 
        /**
         * Replacement for the original getInterfaces() method which makes sure
         * that \TYPO3\CMS\Extbase\Reflection\ClassReflection objects are returned instead of the
-        * orginal ReflectionClass instances.
+        * original ReflectionClass instances.
         *
-        * @return array of \TYPO3\CMS\Extbase\Reflection\ClassReflection Class reflection objects of the properties in this class
+        * @return ClassReflection[] Class reflection objects of the properties in this class
         */
        public function getInterfaces() {
                $extendedInterfaces = array();
                $interfaces = parent::getInterfaces();
                foreach ($interfaces as $interface) {
-                       $extendedInterfaces[] = new \TYPO3\CMS\Extbase\Reflection\ClassReflection($interface->getName());
+                       $extendedInterfaces[] = new ClassReflection($interface->getName());
                }
                return $extendedInterfaces;
        }
@@ -128,13 +119,13 @@ class ClassReflection extends \ReflectionClass {
        /**
         * Replacement for the original getParentClass() method which makes sure
         * that a \TYPO3\CMS\Extbase\Reflection\ClassReflection object is returned instead of the
-        * orginal ReflectionClass instance.
+        * original ReflectionClass instance.
         *
-        * @return \TYPO3\CMS\Extbase\Reflection\ClassReflection Reflection of the parent class - if any
+        * @return ClassReflection Reflection of the parent class - if any
         */
        public function getParentClass() {
                $parentClass = parent::getParentClass();
-               return $parentClass === FALSE ? FALSE : new \TYPO3\CMS\Extbase\Reflection\ClassReflection($parentClass->getName());
+               return $parentClass === FALSE ? FALSE : new ClassReflection($parentClass->getName());
        }
 
        /**
@@ -172,11 +163,11 @@ class ClassReflection extends \ReflectionClass {
         * Returns an instance of the doc comment parser and
         * runs the parse() method.
         *
-        * @return \TYPO3\CMS\Extbase\Reflection\DocCommentParser
+        * @return DocCommentParser
         */
        protected function getDocCommentParser() {
                if (!is_object($this->docCommentParser)) {
-                       $this->docCommentParser = new \TYPO3\CMS\Extbase\Reflection\DocCommentParser();
+                       $this->docCommentParser = new DocCommentParser();
                        $this->docCommentParser->parseDocComment($this->getDocComment());
                }
                return $this->docCommentParser;
index 3334c82..528adf3 100644 (file)
@@ -23,23 +23,13 @@ class MethodReflection extends \ReflectionMethod {
         */
        protected $docCommentParser;
 
-       /**
-        * The constructor, initializes the reflection class
-        *
-        * @param string $className Name of the method's class
-        * @param string $methodName Name of the method to reflect
-        */
-       public function __construct($className, $methodName) {
-               parent::__construct($className, $methodName);
-       }
-
        /**
         * Returns the declaring class
         *
-        * @return \TYPO3\CMS\Extbase\Reflection\ClassReflection The declaring class
+        * @return ClassReflection The declaring class
         */
        public function getDeclaringClass() {
-               return new \TYPO3\CMS\Extbase\Reflection\ClassReflection(parent::getDeclaringClass()->getName());
+               return new ClassReflection(parent::getDeclaringClass()->getName());
        }
 
        /**
@@ -47,12 +37,12 @@ class MethodReflection extends \ReflectionMethod {
         * that \TYPO3\CMS\Extbase\Reflection\ParameterReflection objects are returned instead of the
         * orginal ReflectionParameter instances.
         *
-        * @return array of \TYPO3\CMS\Extbase\Reflection\ParameterReflection Parameter reflection objects of the parameters of this method
+        * @return ParameterReflection[] Parameter reflection objects of the parameters of this method
         */
        public function getParameters() {
                $extendedParameters = array();
                foreach (parent::getParameters() as $parameter) {
-                       $extendedParameters[] = new \TYPO3\CMS\Extbase\Reflection\ParameterReflection(array($this->getDeclaringClass()->getName(), $this->getName()), $parameter->getName());
+                       $extendedParameters[] = new ParameterReflection(array($this->getDeclaringClass()->getName(), $this->getName()), $parameter->getName());
                }
                return $extendedParameters;
        }
@@ -101,11 +91,11 @@ class MethodReflection extends \ReflectionMethod {
         * Returns an instance of the doc comment parser and
         * runs the parse() method.
         *
-        * @return \TYPO3\CMS\Extbase\Reflection\DocCommentParser
+        * @return DocCommentParser
         */
        protected function getDocCommentParser() {
                if (!is_object($this->docCommentParser)) {
-                       $this->docCommentParser = new \TYPO3\CMS\Extbase\Reflection\DocCommentParser();
+                       $this->docCommentParser = new DocCommentParser();
                        $this->docCommentParser->parseDocComment($this->getDocComment());
                }
                return $this->docCommentParser;
index 773a6e6..a7e916c 100644 (file)
@@ -62,7 +62,7 @@ class ObjectAccess {
                if ($propertyExists === TRUE) {
                        return $propertyValue;
                }
-               throw new \TYPO3\CMS\Extbase\Reflection\Exception\PropertyNotAccessibleException('The property "' . $propertyName . '" on the subject was not accessible.', 1263391473);
+               throw new Exception\PropertyNotAccessibleException('The property "' . $propertyName . '" on the subject was not accessible.', 1263391473);
        }
 
        /**
@@ -95,12 +95,12 @@ class ObjectAccess {
                }
                if ($forceDirectAccess === TRUE) {
                        if (property_exists(get_class($subject), $propertyName)) {
-                               $propertyReflection = new \TYPO3\CMS\Extbase\Reflection\PropertyReflection(get_class($subject), $propertyName);
+                               $propertyReflection = new PropertyReflection(get_class($subject), $propertyName);
                                return $propertyReflection->getValue($subject);
                        } elseif (property_exists($subject, $propertyName)) {
                                return $subject->{$propertyName};
                        } else {
-                               throw new \TYPO3\CMS\Extbase\Reflection\Exception\PropertyNotAccessibleException('The property "' . $propertyName . '" on the subject does not exist.', 1302855001);
+                               throw new Exception\PropertyNotAccessibleException('The property "' . $propertyName . '" on the subject does not exist.', 1302855001);
                        }
                }
                if ($subject instanceof \SplObjectStorage || $subject instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage) {
@@ -190,7 +190,7 @@ class ObjectAccess {
                }
                if ($forceDirectAccess === TRUE) {
                        if (property_exists(get_class($subject), $propertyName)) {
-                               $propertyReflection = new \TYPO3\CMS\Extbase\Reflection\PropertyReflection(get_class($subject), $propertyName);
+                               $propertyReflection = new PropertyReflection(get_class($subject), $propertyName);
                                $propertyReflection->setAccessible(TRUE);
                                $propertyReflection->setValue($subject, $propertyValue);
                        } else {
index 5c5ca12..9476d8f 100644 (file)
@@ -18,29 +18,19 @@ namespace TYPO3\CMS\Extbase\Reflection;
  */
 class ParameterReflection extends \ReflectionParameter {
 
-       /**
-        * The constructor, initializes the reflection parameter
-        *
-        * @param string $function
-        * @param string $parameterName
-        */
-       public function __construct($function, $parameterName) {
-               parent::__construct($function, $parameterName);
-       }
-
        /**
         * Returns the declaring class
         *
-        * @return \TYPO3\CMS\Extbase\Reflection\ClassReflection The declaring class
+        * @return ClassReflection The declaring class
         */
        public function getDeclaringClass() {
-               return new \TYPO3\CMS\Extbase\Reflection\ClassReflection(parent::getDeclaringClass()->getName());
+               return new ClassReflection(parent::getDeclaringClass()->getName());
        }
 
        /**
         * Returns the parameter class
         *
-        * @return \TYPO3\CMS\Extbase\Reflection\ClassReflection The parameter class
+        * @return ClassReflection The parameter class
         */
        public function getClass() {
                try {
@@ -48,6 +38,6 @@ class ParameterReflection extends \ReflectionParameter {
                } catch (\Exception $e) {
                        return NULL;
                }
-               return is_object($class) ? new \TYPO3\CMS\Extbase\Reflection\ClassReflection($class->getName()) : NULL;
+               return is_object($class) ? new ClassReflection($class->getName()) : NULL;
        }
 }
index 7a04c7e..dffbd41 100644 (file)
@@ -19,20 +19,10 @@ namespace TYPO3\CMS\Extbase\Reflection;
 class PropertyReflection extends \ReflectionProperty {
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\DocCommentParser An instance of the doc comment parser
+        * @var DocCommentParser An instance of the doc comment parser
         */
        protected $docCommentParser;
 
-       /**
-        * The constructor, initializes the reflection class
-        *
-        * @param string $className Name of the property's class
-        * @param string $propertyName Name of the property to reflect
-        */
-       public function __construct($className, $propertyName) {
-               parent::__construct($className, $propertyName);
-       }
-
        /**
         * Checks if the doc comment of this property is tagged with
         * the specified tag
@@ -69,18 +59,18 @@ class PropertyReflection extends \ReflectionProperty {
         *
         * @param object $object Instance of the declaring class \TYPO3\CMS\Extbase\Reflection to read the value from
         * @return mixed Value of the property
-        * @throws \TYPO3\CMS\Extbase\Reflection\Exception
+        * @throws Exception
         * @todo Maybe support private properties as well, as of PHP 5.3.0 we can do
         */
        public function getValue($object = NULL) {
                if (!is_object($object)) {
-                       throw new \TYPO3\CMS\Extbase\Reflection\Exception('$object is of type ' . gettype($object) . ', instance of class ' . $this->class . ' expected.', 1210859212);
+                       throw new Exception('$object is of type ' . gettype($object) . ', instance of class ' . $this->class . ' expected.', 1210859212);
                }
                if ($this->isPublic()) {
                        return parent::getValue($object);
                }
                if ($this->isPrivate()) {
-                       throw new \TYPO3\CMS\Extbase\Reflection\Exception('Cannot return value of private property "' . $this->name . '.', 1210859206);
+                       throw new Exception('Cannot return value of private property "' . $this->name . '.', 1210859206);
                }
                parent::setAccessible(TRUE);
                return parent::getValue($object);
@@ -90,11 +80,11 @@ class PropertyReflection extends \ReflectionProperty {
         * Returns an instance of the doc comment parser and
         * runs the parse() method.
         *
-        * @return \TYPO3\CMS\Extbase\Reflection\DocCommentParser
+        * @return DocCommentParser
         */
        protected function getDocCommentParser() {
                if (!is_object($this->docCommentParser)) {
-                       $this->docCommentParser = new \TYPO3\CMS\Extbase\Reflection\DocCommentParser();
+                       $this->docCommentParser = new DocCommentParser();
                        $this->docCommentParser->parseDocComment($this->getDocComment());
                }
                return $this->docCommentParser;
index 2ce5a7f..bef7a4f 100644 (file)
@@ -162,7 +162,7 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
         */
        public function initialize() {
                if ($this->initialized) {
-                       throw new \TYPO3\CMS\Extbase\Reflection\Exception('The Reflection Service can only be initialized once.', 1232044696);
+                       throw new Exception('The Reflection Service can only be initialized once.', 1232044696);
                }
                $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                $this->cacheIdentifier = 'ReflectionData_' . $frameworkConfiguration['extensionName'];
@@ -208,7 +208,7 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
         * Returns the class schema for the given class
         *
         * @param mixed $classNameOrObject The class name or an object
-        * @return \TYPO3\CMS\Extbase\Reflection\ClassSchema
+        * @return ClassSchema
         */
        public function getClassSchema($classNameOrObject) {
                $className = is_object($classNameOrObject) ? get_class($classNameOrObject) : $classNameOrObject;
@@ -230,7 +230,7 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
        public function hasMethod($className, $methodName) {
                try {
                        if (!array_key_exists($className, $this->methodReflections) || !array_key_exists($methodName, $this->methodReflections[$className])) {
-                               $this->methodReflections[$className][$methodName] = new \TYPO3\CMS\Extbase\Reflection\MethodReflection($className, $methodName);
+                               $this->methodReflections[$className][$methodName] = new MethodReflection($className, $methodName);
                                $this->dataCacheNeedsUpdate = TRUE;
                        }
                } catch (\ReflectionException $e) {
@@ -377,7 +377,7 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
         * @return void
         */
        protected function reflectClass($className) {
-               $class = new \TYPO3\CMS\Extbase\Reflection\ClassReflection($className);
+               $class = new ClassReflection($className);
                $this->reflectedClassNames[$className] = time();
                foreach ($class->getTagsValues() as $tag => $values) {
                        if (array_search($tag, $this->ignoredTags) === FALSE) {
@@ -414,21 +414,21 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
         *
         * @param string $className
         * @throws Exception\UnknownClassException
-        * @return \TYPO3\CMS\Extbase\Reflection\ClassSchema The class schema
+        * @return ClassSchema The class schema
         */
        protected function buildClassSchema($className) {
                if (!class_exists($className)) {
-                       throw new \TYPO3\CMS\Extbase\Reflection\Exception\UnknownClassException('The classname "' . $className . '" was not found and thus can not be reflected.', 1278450972);
+                       throw new Exception\UnknownClassException('The classname "' . $className . '" was not found and thus can not be reflected.', 1278450972);
                }
                $classSchema = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ClassSchema', $className);
                if (is_subclass_of($className, 'TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity')) {
-                       $classSchema->setModelType(\TYPO3\CMS\Extbase\Reflection\ClassSchema::MODELTYPE_ENTITY);
+                       $classSchema->setModelType(ClassSchema::MODELTYPE_ENTITY);
                        $possibleRepositoryClassName = ClassNamingUtility::translateModelNameToRepositoryName($className);
                        if (class_exists($possibleRepositoryClassName)) {
                                $classSchema->setAggregateRoot(TRUE);
                        }
                } elseif (is_subclass_of($className, 'TYPO3\\CMS\\Extbase\\DomainObject\\AbstractValueObject')) {
-                       $classSchema->setModelType(\TYPO3\CMS\Extbase\Reflection\ClassSchema::MODELTYPE_VALUEOBJECT);
+                       $classSchema->setModelType(ClassSchema::MODELTYPE_VALUEOBJECT);
                }
                foreach ($this->getClassPropertyNames($className) as $propertyName) {
                        if (!$this->isPropertyTaggedWith($className, $propertyName, 'transient') && $this->isPropertyTaggedWith($className, $propertyName, 'var')) {
@@ -450,12 +450,12 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * Converts the given parameter reflection into an information array
         *
-        * @param \ReflectionParameter $parameter The parameter to reflect
+        * @param ParameterReflection $parameter The parameter to reflect
         * @param integer $parameterPosition
-        * @param \ReflectionMethod|NULL $method
+        * @param MethodReflection|NULL $method
         * @return array Parameter information array
         */
-       protected function convertParameterReflectionToArray(\ReflectionParameter $parameter, $parameterPosition, \ReflectionMethod $method = NULL) {
+       protected function convertParameterReflectionToArray(ParameterReflection $parameter, $parameterPosition, MethodReflection $method = NULL) {
                $parameterInformation = array(
                        'position' => $parameterPosition,
                        'byReference' => $parameter->isPassedByReference(),
@@ -490,11 +490,11 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
         *
         * @param string $className Name of the class containing the method
         * @param string $methodName Name of the method to return the Reflection for
-        * @return \TYPO3\CMS\Extbase\Reflection\MethodReflection the method Reflection object
+        * @return MethodReflection the method Reflection object
         */
        protected function getMethodReflection($className, $methodName) {
                if (!isset($this->methodReflections[$className][$methodName])) {
-                       $this->methodReflections[$className][$methodName] = new \TYPO3\CMS\Extbase\Reflection\MethodReflection($className, $methodName);
+                       $this->methodReflections[$className][$methodName] = new MethodReflection($className, $methodName);
                        $this->dataCacheNeedsUpdate = TRUE;
                }
                return $this->methodReflections[$className][$methodName];
@@ -522,7 +522,7 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
         */
        protected function saveToCache() {
                if (!is_object($this->dataCache)) {
-                       throw new \TYPO3\CMS\Extbase\Reflection\Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
+                       throw new Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
                }
                $data = array();
                $propertyNames = array(