* @param int $versionInteger Integer representation of version number
* @return string Version number as format x.x.x
* @throws \InvalidArgumentException if $versionInteger is not an integer
+ * @deprecated
*/
public static function convertIntegerToVersionNumber($versionInteger)
{
+ trigger_error('Method ' . __METHOD__ . ' will be removed in TYPO3 11.0', E_USER_DEPRECATED);
+
if (!is_int($versionInteger)) {
throw new \InvalidArgumentException(\TYPO3\CMS\Core\Utility\VersionNumberUtility::class . '::convertIntegerToVersionNumber() supports an integer argument only!', 1334072223);
}
*
* @param string $version A string with a version range.
* @return array
+ * @deprecated
*/
public static function splitVersionRange($version)
{
+ trigger_error('Method ' . __METHOD__ . ' will be removed in TYPO3 11.0', E_USER_DEPRECATED);
+
$versionRange = [];
if (strstr($version, '-')) {
$versionRange = explode('-', $version, 2);
* @param string $version (like 4.1.20)
* @return string
* @throws \TYPO3\CMS\Core\Exception
+ * @deprecated
*/
public static function raiseVersionNumber($raise, $version)
{
+ trigger_error('Method ' . __METHOD__ . ' will be removed in TYPO3 11.0', E_USER_DEPRECATED);
+
if (!in_array($raise, ['main', 'sub', 'dev'])) {
throw new \TYPO3\CMS\Core\Exception('RaiseVersionNumber expects one of "main", "sub" or "dev".', 1342639555);
}
--- /dev/null
+.. include:: ../../Includes.txt
+
+================================================================
+Deprecation: #88554 - Deprecated methods in VersionNumberUtility
+================================================================
+
+See :issue:`88554`
+
+Description
+===========
+
+The following methods of :php:\TYPO3\CMS\Core\Utility\VersionNumberUtility` have been deprecated and will be removed in
+TYPO3 11.0:
+
+- :php:`convertIntegerToVersionNumber`
+- :php:`splitVersionRange`
+- :php:`raiseVersionNumber`
+
+
+Impact
+======
+
+Calling the methods :php:`convertIntegerToVersionNumber`, :php:`splitVersionRange` or :php:`raiseVersionNumber` of
+:php:\TYPO3\CMS\Core\Utility\VersionNumberUtility` will trigger a deprecation message.
+
+
+Affected Installations
+======================
+
+All installations that call the mentioned methods.
+
+
+Migration
+=========
+
+Implement the methods in your custom code.
+
+.. index:: PHP-API, FullyScanned, ext:core
*/
class VersionNumberUtilityTest extends UnitTestCase
{
- /**
- * Data Provider for convertVersionNumberToIntegerConvertsVersionNumbersToIntegers
- *
- * @return array
- */
- public function validVersionNumberDataProvider()
- {
- return [
- ['4003003', '4.3.3'],
- ['4012003', '4.12.3'],
- ['5000000', '5.0.0'],
- ['5000001', '5.0.1'],
- ['3008001', '3.8.1'],
- ['1012', '0.1.12']
- ];
- }
-
- /**
- * Data Provider for convertIntegerToVersionNumberConvertsOtherTypesAsIntegerToVersionNumber
- *
- * @see http://php.net/manual/en/language.types.php
- * @return array
- */
- public function invalidVersionNumberDataProvider()
- {
- return [
- 'boolean' => [true],
- 'float' => [5.4],
- 'array' => [[]],
- 'string' => ['300ABCD'],
- 'object' => [new \stdClass()],
- 'NULL' => [null],
- 'function' => [function () {
- }]
- ];
- }
-
- /**
- * @test
- * @dataProvider validVersionNumberDataProvider
- */
- public function convertVersionNumberToIntegerConvertsVersionNumbersToIntegers($expected, $version)
- {
- $this->assertEquals($expected, VersionNumberUtility::convertVersionNumberToInteger($version));
- }
-
- /**
- * @test
- * @dataProvider validVersionNumberDataProvider
- */
- public function convertIntegerToVersionNumberConvertsIntegerToVersionNumber($versionNumber, $expected)
- {
- // Make sure incoming value is an integer
- $versionNumber = (int)$versionNumber;
- $this->assertEquals($expected, VersionNumberUtility::convertIntegerToVersionNumber($versionNumber));
- }
-
- /**
- * @test
- * @dataProvider invalidVersionNumberDataProvider
- */
- public function convertIntegerToVersionNumberConvertsOtherTypesAsIntegerToVersionNumber($version)
- {
- $this->expectException(\InvalidArgumentException::class);
- $this->expectExceptionCode(1334072223);
- VersionNumberUtility::convertIntegerToVersionNumber($version);
- }
/**
* @return array
--- /dev/null
+<?php
+namespace TYPO3\CMS\Core\Tests\UnitDeprecated\Utility;
+
+/*
+ * 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\Core\Utility\VersionNumberUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
+
+/**
+ * Testcase for class \TYPO3\CMS\Core\Utility\VersionNumberUtility
+ */
+class VersionNumberUtilityTest extends UnitTestCase
+{
+
+ /**
+ * Data Provider for convertVersionNumberToIntegerConvertsVersionNumbersToIntegers
+ *
+ * @return array
+ */
+ public function validVersionNumberDataProvider()
+ {
+ return [
+ ['4003003', '4.3.3'],
+ ['4012003', '4.12.3'],
+ ['5000000', '5.0.0'],
+ ['5000001', '5.0.1'],
+ ['3008001', '3.8.1'],
+ ['1012', '0.1.12']
+ ];
+ }
+
+ /**
+ * Data Provider for convertIntegerToVersionNumberConvertsOtherTypesAsIntegerToVersionNumber
+ *
+ * @see http://php.net/manual/en/language.types.php
+ * @return array
+ */
+ public function invalidVersionNumberDataProvider()
+ {
+ return [
+ 'boolean' => [true],
+ 'float' => [5.4],
+ 'array' => [[]],
+ 'string' => ['300ABCD'],
+ 'object' => [new \stdClass()],
+ 'NULL' => [null],
+ 'function' => [function () {
+ }]
+ ];
+ }
+
+ /**
+ * @test
+ * @dataProvider validVersionNumberDataProvider
+ */
+ public function convertVersionNumberToIntegerConvertsVersionNumbersToIntegers($expected, $version)
+ {
+ $this->assertEquals($expected, VersionNumberUtility::convertVersionNumberToInteger($version));
+ }
+
+ /**
+ * @test
+ * @dataProvider validVersionNumberDataProvider
+ */
+ public function convertIntegerToVersionNumberConvertsIntegerToVersionNumber($versionNumber, $expected)
+ {
+ // Make sure incoming value is an integer
+ $versionNumber = (int)$versionNumber;
+ $this->assertEquals($expected, VersionNumberUtility::convertIntegerToVersionNumber($versionNumber));
+ }
+
+ /**
+ * @test
+ * @dataProvider invalidVersionNumberDataProvider
+ */
+ public function convertIntegerToVersionNumberConvertsOtherTypesAsIntegerToVersionNumber($version)
+ {
+ $this->expectException(\InvalidArgumentException::class);
+ $this->expectExceptionCode(1334072223);
+ VersionNumberUtility::convertIntegerToVersionNumber($version);
+ }
+}
'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
],
],
+ 'TYPO3\CMS\Core\Utility\VersionNumberUtility::splitVersionRange' => [
+ 'numberOfMandatoryArguments' => 1,
+ 'maximumNumberOfArguments' => 1,
+ 'restFiles' => [
+ 'Deprecation-88554-DeprecatedMethodsInVersionNumberUtility.rst',
+ ],
+ ],
+ 'TYPO3\CMS\Core\Utility\VersionNumberUtility::raiseVersionNumber' => [
+ 'numberOfMandatoryArguments' => 2,
+ 'maximumNumberOfArguments' => 2,
+ 'restFiles' => [
+ 'Deprecation-88554-DeprecatedMethodsInVersionNumberUtility.rst',
+ ],
+ ],
+ 'TYPO3\CMS\Core\Utility\VersionNumberUtility::convertIntegerToVersionNumber' => [
+ 'numberOfMandatoryArguments' => 2,
+ 'maximumNumberOfArguments' => 2,
+ 'restFiles' => [
+ 'Deprecation-88554-DeprecatedMethodsInVersionNumberUtility.rst',
+ ],
+ ],
];