From 401da155ec9e4b6a2bfcc0400c46549cf6816ba0 Mon Sep 17 00:00:00 2001
From: Alexander Schnitzler <git@alexanderschnitzler.de>
Date: Mon, 30 Mar 2020 17:14:32 +0200
Subject: [PATCH] [TASK] Enable phpstan InvalidUnaryOperationRule

Releases: master
Resolves: #90891
Change-Id: Ie0a00688422d7088816f80364e68cac7f7232950
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64016
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
---
 Build/phpstan.level2.neon                                    | 2 +-
 .../Classes/DataHandling/Localization/DataMapProcessor.php   | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Build/phpstan.level2.neon b/Build/phpstan.level2.neon
index 4d602ad875eb..514b6d12b2c2 100644
--- a/Build/phpstan.level2.neon
+++ b/Build/phpstan.level2.neon
@@ -20,7 +20,7 @@ rules:
 	- PHPStan\Rules\Generics\TraitTemplateTypeRule
 	- PHPStan\Rules\Methods\IncompatibleDefaultParameterTypeRule
 	- PHPStan\Rules\Operators\InvalidBinaryOperationRule
-#	- PHPStan\Rules\Operators\InvalidUnaryOperationRule
+	- PHPStan\Rules\Operators\InvalidUnaryOperationRule
 	- PHPStan\Rules\Operators\InvalidComparisonOperationRule
 	- PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeRule
 	- PHPStan\Rules\PhpDoc\IncompatiblePropertyPhpDocTypeRule
diff --git a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php
index a3bd23a69ae6..2eae23efd25a 100644
--- a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php
+++ b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php
@@ -1152,16 +1152,17 @@ class DataMapProcessor
      * Return only ids that are integer - so no "NEW..." values
      *
      * @param string[]|int[] $ids
-     * @return int[]|string[]
+     * @return int[]
      */
     protected function filterNumericIds(array $ids)
     {
-        return array_filter(
+        $ids = array_filter(
             $ids,
             function ($id) {
                 return MathUtility::canBeInterpretedAsInteger($id);
             }
         );
+        return array_map('intval', $ids);
     }
 
     /**
-- 
GitLab