[!!!][TASK] Remove deprecated TypeHandlingService 11/32911/5
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 21 Sep 2014 21:16:59 +0000 (23:16 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Tue, 23 Sep 2014 10:28:11 +0000 (12:28 +0200)
Resolves: #61786
Releases: master
Change-Id: Ib30130a238fd07a5937328e242e41f4643267ffa
Reviewed-on: http://review.typo3.org/32911
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Documentation/Changelog/master/Breaking-61786-ExtbaseDeprecatedTypeHandlingServiceRemoved.rst [new file with mode: 0644]
typo3/sysext/core/Migrations/Code/LegacyClassesForIde.php
typo3/sysext/extbase/Classes/Reflection/ClassSchema.php
typo3/sysext/extbase/Classes/Service/TypeHandlingService.php [deleted file]
typo3/sysext/extbase/Migrations/Code/ClassAliasMap.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapperTest.php
typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php
typo3/sysext/extbase/Tests/Unit/Service/TypeHandlingServiceTest.php [deleted file]

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-61786-ExtbaseDeprecatedTypeHandlingServiceRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-61786-ExtbaseDeprecatedTypeHandlingServiceRemoved.rst
new file mode 100644 (file)
index 0000000..4772125
--- /dev/null
@@ -0,0 +1,26 @@
+===================================================================
+Breaking: #61786 - remove deprecated TypeHandlingService in extbase
+===================================================================
+
+Description
+===========
+
+The TypeHandlingService class is removed from the extbase extension.
+
+
+Impact
+======
+
+Extensions that still use \TYPO3\CMS\Extbase\Service\TypeHandlingService won't work.
+
+
+Affected installations
+======================
+
+A TYPO3 instance is affected if a 3rd party extension uses the removed class \TYPO3\CMS\Extbase\Service\TypeHandlingService.
+
+
+Migration
+=========
+
+Replace all calls to \TYPO3\CMS\Extbase\Service\TypeHandlingService functions to their new static functions in \TYPO3\CMS\Extbase\Utility\TypeHandlingUtility
\ No newline at end of file
index 0040698..8db8102 100644 (file)
@@ -2799,11 +2799,6 @@ class Tx_Extbase_Service_FlexFormService extends \TYPO3\CMS\Extbase\Service\Flex
 /**
  * @deprecated since 6.0 will be removed in 7.0
  */
-class Tx_Extbase_Service_TypeHandlingService extends \TYPO3\CMS\Extbase\Service\TypeHandlingService {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
 class Tx_Extbase_Service_TypoScriptService extends \TYPO3\CMS\Extbase\Service\TypoScriptService {}
 
 /**
index 9735424..4a04cc3 100644 (file)
@@ -13,6 +13,9 @@ namespace TYPO3\CMS\Extbase\Reflection;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
+use TYPO3\CMS\Extbase\Utility\TypeHandlingUtility;
+
 /**
  * A class schema
  *
@@ -69,12 +72,6 @@ class ClassSchema {
        protected $identityProperties = array();
 
        /**
-        * @var \TYPO3\CMS\Extbase\Service\TypeHandlingService
-        * @inject
-        */
-       protected $typeHandlingService;
-
-       /**
         * Constructs this class schema
         *
         * @param string $className Name of the class this schema is referring to
@@ -102,7 +99,7 @@ class ClassSchema {
         * @return void
         */
        public function addProperty($name, $type, $lazy = FALSE, $cascade = '') {
-               $type = $this->typeHandlingService->parseType($type);
+               $type = TypeHandlingUtility::parseType($type);
                $this->properties[$name] = array(
                        'type' => $type['type'],
                        'elementType' => $type['elementType'],
diff --git a/typo3/sysext/extbase/Classes/Service/TypeHandlingService.php b/typo3/sysext/extbase/Classes/Service/TypeHandlingService.php
deleted file mode 100644 (file)
index bd8f36f..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Service;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Extbase\Utility\TypeHandlingUtility;
-
-/**
- * PHP type handling functions
- * @deprecated since 6.1, will be removed two versions later
- */
-class TypeHandlingService implements \TYPO3\CMS\Core\SingletonInterface {
-
-       /**
-        * A property type parse pattern.
-        */
-       const PARSE_TYPE_PATTERN = TypeHandlingUtility::PARSE_TYPE_PATTERN;
-
-       /**
-        * A type pattern to detect literal types.
-        */
-       const LITERAL_TYPE_PATTERN = TypeHandlingUtility::LITERAL_TYPE_PATTERN;
-
-       /**
-        * Adds (defines) a specific property and its type.
-        *
-        * @param string $type Type of the property (see PARSE_TYPE_PATTERN)
-        * @throws \InvalidArgumentException
-        * @return array An array with information about the type
-        */
-       public function parseType($type) {
-               return TypeHandlingUtility::parseType($type);
-       }
-
-       /**
-        * Normalize data types so they match the PHP type names:
-        * int -> integer
-        * float -> double
-        * bool -> boolean
-        *
-        * @param string $type Data type to unify
-        * @return string unified data type
-        */
-       public function normalizeType($type) {
-               return TypeHandlingUtility::normalizeType($type);
-       }
-
-       /**
-        * Returns TRUE if the $type is a literal.
-        *
-        * @param string $type
-        * @return boolean
-        */
-       public function isLiteral($type) {
-               return TypeHandlingUtility::isLiteral($type);
-       }
-
-       /**
-        * Returns TRUE if the $type is a simple type.
-        *
-        * @param string $type
-        * @return boolean
-        */
-       public function isSimpleType($type) {
-               return TypeHandlingUtility::isSimpleType($type);
-       }
-}
index 65d3537..a88b56b 100644 (file)
@@ -268,7 +268,6 @@ return array(
        'Tx_Extbase_Service_CacheService' => 'TYPO3\\CMS\\Extbase\\Service\\CacheService',
        'Tx_Extbase_Service_ExtensionService' => 'TYPO3\\CMS\\Extbase\\Service\\ExtensionService',
        'Tx_Extbase_Service_FlexFormService' => 'TYPO3\\CMS\\Extbase\\Service\\FlexFormService',
-       'Tx_Extbase_Service_TypeHandlingService' => 'TYPO3\\CMS\\Extbase\\Service\\TypeHandlingService',
        'Tx_Extbase_Service_TypoScriptService' => 'TYPO3\\CMS\\Extbase\\Service\\TypoScriptService',
        'Tx_Extbase_SignalSlot_Dispatcher' => 'TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher',
        'Tx_Extbase_SignalSlot_Exception_InvalidSlotException' => 'TYPO3\\CMS\\Extbase\\SignalSlot\\Exception\\InvalidSlotException',
index bcb6c24..b8590c8 100644 (file)
@@ -83,7 +83,6 @@ class DataMapperTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                );
                /** @var AccessibleObjectInterface|\TYPO3\CMS\Extbase\Reflection\ClassSchema $classSchema */
                $classSchema = $this->getAccessibleMock('TYPO3\CMS\Extbase\Reflection\ClassSchema', array('dummy'), array($classNameWithNS));
-               $classSchema->_set('typeHandlingService', new \TYPO3\CMS\Extbase\Service\TypeHandlingService());
                $classSchema->addProperty('pid', 'integer');
                $classSchema->addProperty('uid', 'integer');
                $classSchema->addProperty('firstProperty', 'string');
@@ -174,11 +173,9 @@ class DataMapperTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                eval('namespace ' . __NAMESPACE__ . '; class ' . $className2 . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity { }');
                $child = new $className2WithNS();
                $classSchema2 = $this->getAccessibleMock('TYPO3\CMS\Extbase\Reflection\ClassSchema', array('dummy'), array($className2WithNS));
-               $classSchema2->_set('typeHandlingService', new \TYPO3\CMS\Extbase\Service\TypeHandlingService());
 
                /** @var \TYPO3\CMS\Extbase\Reflection\ClassSchema|AccessibleObjectInterface|\PHPUnit_Framework_MockObject_MockObject $classSchema1 */
                $classSchema1 = $this->getAccessibleMock('TYPO3\CMS\Extbase\Reflection\ClassSchema', array('dummy'), array($classNameWithNS));
-               $classSchema1->_set('typeHandlingService', new \TYPO3\CMS\Extbase\Service\TypeHandlingService());
                $classSchema1->addProperty('relationProperty', $className2WithNS);
                $identifier = 1;
 
index 9cf8bfe..e72b61b 100644 (file)
@@ -36,7 +36,6 @@ class ClassSchemaTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
                $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
                $mockClassSchema = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Reflection\\ClassSchema', array('dummy'), array('Foo\\Bar\\Domain\\Model\\' . $className));
-               $mockClassSchema->_set('typeHandlingService', $this->getMock('TYPO3\\CMS\\Extbase\\Service\\TypeHandlingService'));
                $objectManager->expects($this->once())->method('get')->will($this->returnValue($mockClassSchema));
 
                /** @var \TYPO3\CMS\Extbase\Reflection\ReflectionService $service */
@@ -61,7 +60,6 @@ class ClassSchemaTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
                $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
                $mockClassSchema = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Reflection\\ClassSchema', array('dummy'), array('Foo_Bar_Domain_Model_' . $className));
-               $mockClassSchema->_set('typeHandlingService', $this->getMock('TYPO3\\CMS\\Extbase\\Service\\TypeHandlingService'));
                $objectManager->expects($this->once())->method('get')->will($this->returnValue($mockClassSchema));
 
                $service = $this->getAccessibleMock('TYPO3\CMS\Extbase\Reflection\ReflectionService', array('dummy'));
diff --git a/typo3/sysext/extbase/Tests/Unit/Service/TypeHandlingServiceTest.php b/typo3/sysext/extbase/Tests/Unit/Service/TypeHandlingServiceTest.php
deleted file mode 100644 (file)
index e6f1d9e..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Service;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Test case
- */
-class TypeHandlingServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Service\TypeHandlingService
-        */
-       protected $typeHandlingService;
-
-       public function setUp() {
-               $this->typeHandlingService = new \TYPO3\CMS\Extbase\Service\TypeHandlingService();
-       }
-
-       /**
-        * @test
-        * @expectedException \TYPO3\CMS\Extbase\Utility\Exception\InvalidTypeException
-        */
-       public function parseTypeThrowsExceptionOnInvalidType() {
-               $this->typeHandlingService->parseType('something not a type');
-       }
-
-       /**
-        * @test
-        * @expectedException \TYPO3\CMS\Extbase\Utility\Exception\InvalidTypeException
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        */
-       public function parseTypeThrowsExceptionOnInvalidElementTypeHint() {
-               $this->typeHandlingService->parseType('string<integer>');
-       }
-
-       /**
-        * data provider for parseTypeReturnsArrayWithInformation
-        *
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        * @return array
-        */
-       public function types() {
-               return array(
-                       array('int', array('type' => 'integer', 'elementType' => NULL)),
-                       array('string', array('type' => 'string', 'elementType' => NULL)),
-                       array('DateTime', array('type' => 'DateTime', 'elementType' => NULL)),
-                       array('\DateTime', array('type' => 'DateTime', 'elementType' => NULL)),
-                       array('Tx_Extbase_Bar', array('type' => 'Tx_Extbase_Bar', 'elementType' => NULL)),
-                       array('\\ExtbaseTeam\\BlogExample\\Foo\\Bar', array('type' => 'ExtbaseTeam\\BlogExample\\Foo\\Bar', 'elementType' => NULL)),
-                       array('array<integer>', array('type' => 'array', 'elementType' => 'integer')),
-                       array('ArrayObject<string>', array('type' => 'ArrayObject', 'elementType' => 'string')),
-                       array('SplObjectStorage<Tx_Extbase_Bar>', array('type' => 'SplObjectStorage', 'elementType' => 'Tx_Extbase_Bar')),
-                       array('SplObjectStorage<\\ExtbaseTeam\\BlogExample\\Foo\\Bar>', array('type' => 'SplObjectStorage', 'elementType' => 'ExtbaseTeam\\BlogExample\\Foo\\Bar')),
-                       array('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage<Tx_Extbase_Bar>', array('type' => 'TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', 'elementType' => 'Tx_Extbase_Bar')),
-                       array('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage<\\ExtbaseTeam\\BlogExample\\Foo\\Bar>', array('type' => 'TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', 'elementType' => 'ExtbaseTeam\\BlogExample\\Foo\\Bar')),
-                       array('Tx_Extbase_Persistence_ObjectStorage<Tx_Extbase_Bar>', array('type' => 'Tx_Extbase_Persistence_ObjectStorage', 'elementType' => 'Tx_Extbase_Bar')),
-                       array('Tx_Extbase_Persistence_ObjectStorage<\\ExtbaseTeam\\BlogExample\\Foo\\Bar>', array('type' => 'Tx_Extbase_Persistence_ObjectStorage', 'elementType' => 'ExtbaseTeam\\BlogExample\\Foo\\Bar')),
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider types
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        * @param mixed $type
-        * @param mixed $expectedResult
-        */
-       public function parseTypeReturnsArrayWithInformation($type, $expectedResult) {
-               $this->assertEquals($expectedResult, $this->typeHandlingService->parseType($type));
-       }
-
-       /**
-        * data provider for normalizeTypesReturnsNormalizedType
-        *
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        * @return array
-        */
-       public function normalizeTypes() {
-               return array(
-                       array('int', 'integer'),
-                       array('double', 'float'),
-                       array('bool', 'boolean'),
-                       array('string', 'string')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider normalizeTypes
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        * @param mixed $type
-        * @param mixed $normalized
-        */
-       public function normalizeTypesReturnsNormalizedType($type, $normalized) {
-               $this->assertEquals($this->typeHandlingService->normalizeType($type), $normalized);
-       }
-
-       /**
-        * data provider for isLiteralReturnsFalseForNonLiteralTypes
-        *
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        * @return array
-        */
-       public function nonLiteralTypes() {
-               return array(
-                       array('DateTime'),
-                       array('\\Foo\\Bar'),
-                       array('array'),
-                       array('ArrayObject'),
-                       array('stdClass')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider nonliteralTypes
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        * @param mixed $type
-        */
-       public function isLiteralReturnsFalseForNonLiteralTypes($type) {
-               $this->assertFalse($this->typeHandlingService->isLiteral($type));
-       }
-
-       /**
-        * data provider for isLiteralReturnsTrueForLiteralType
-        *
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        * @return array
-        */
-       public function literalTypes() {
-               return array(
-                       array('integer'),
-                       array('int'),
-                       array('float'),
-                       array('double'),
-                       array('boolean'),
-                       array('bool'),
-                       array('string')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider literalTypes
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        * @param mixed $type
-        */
-       public function isLiteralReturnsTrueForLiteralType($type) {
-               $this->assertTrue($this->typeHandlingService->isLiteral($type));
-       }
-
-       /**
-        * data provider for isSimpleTypeReturnsTrueForSimpleTypes
-        *
-        * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
-        * @return array
-        */
-       public function simpleTypes() {
-               return array(
-                       array('integer', TRUE),
-                       array('int', TRUE),
-                       array('float', TRUE),
-                       array('double', TRUE),
-                       array('boolean', TRUE),
-                       array('bool', TRUE),
-                       array('string', TRUE),
-                       array('DateTime', FALSE),
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider simpleTypes
-        * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
-        * @param string $type
-        * @param boolean $result
-        */
-       public function isSimpleTypeReturnsOnlyTrueForSimpleTypes($type, $result) {
-               $this->assertSame($result, $this->typeHandlingService->isSimpleType($type));
-       }
-}