[TASK] Deprecate `MathUtility::convertToPositiveInteger()`
TYPO3 has a method to ensure an integer is always positive: `MathUtility::convertToPositiveInteger()`. However, the method is rather "heavy" as it internally calls `MU::forceIntegerInRange()` and therefore misuses a clamp mechanism to convert the integer to a positive number. Also, the method name doesn't reflect what it actually does. Negative numbers are not converted to their positive counterpart, but are swapped with `0`. Due to the naming issue and the fact that the method can be superseded by a simple `max()` call, the method is therefore deprecated. Resolves: #103785 Releases: main Change-Id: I4fd0548ec6bc7289008057ade4e64f9437c2da7b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84141 Tested-by:Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by:
Torben Hansen <derhansen@gmail.com> Tested-by:
Torben Hansen <derhansen@gmail.com> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by:
Benjamin Franzke <ben@bnf.dev> Tested-by:
Andreas Kienast <a.fernandez@scripting-base.de> Reviewed-by:
Andreas Kienast <a.fernandez@scripting-base.de>
Showing
- typo3/sysext/backend/Classes/Controller/EditDocumentController.php 2 additions, 2 deletions...ext/backend/Classes/Controller/EditDocumentController.php
- typo3/sysext/core/Classes/Utility/MathUtility.php 5 additions, 0 deletionstypo3/sysext/core/Classes/Utility/MathUtility.php
- typo3/sysext/core/Documentation/Changelog/13.2/Deprecation-103785-DeprecateMathUtilityConvertToPositiveInteger.rst 45 additions, 0 deletions...n-103785-DeprecateMathUtilityConvertToPositiveInteger.rst
- typo3/sysext/core/Tests/Unit/Utility/MathUtilityTest.php 0 additions, 12 deletionstypo3/sysext/core/Tests/Unit/Utility/MathUtilityTest.php
- typo3/sysext/core/Tests/UnitDeprecated/Utility/MathUtilityTest.php 37 additions, 0 deletions...ext/core/Tests/UnitDeprecated/Utility/MathUtilityTest.php
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php 7 additions, 0 deletions...guration/ExtensionScanner/Php/MethodCallStaticMatcher.php
Please register or sign in to comment