diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index a39ba5db..1afab674 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -24,6 +24,12 @@ parameters: count: 1 path: ../../Classes/Core/Functional/Framework/Constraint/RequestSection/HasRecordConstraint.php + - + message: '#^Call to function property_exists\(\) with TYPO3\\CMS\\Core\\DataHandling\\DataHandler and ''copyTree'' will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 + path: ../../Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerWriter.php + - message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#' identifier: staticMethod.alreadyNarrowedType diff --git a/Classes/Core/Functional/Framework/DataHandling/ActionService.php b/Classes/Core/Functional/Framework/DataHandling/ActionService.php index bb8fc716..ceb4c778 100644 --- a/Classes/Core/Functional/Framework/DataHandling/ActionService.php +++ b/Classes/Core/Functional/Framework/DataHandling/ActionService.php @@ -559,7 +559,7 @@ protected function createDataHandler(): DataHandler { $this->dataHandler = GeneralUtility::makeInstance(DataHandler::class); $backendUser = $this->getBackendUser(); - if (isset($backendUser->uc['copyLevels'])) { + if (isset($backendUser->uc['copyLevels']) && property_exists($this->dataHandler, 'copyTree')) { $this->dataHandler->copyTree = $backendUser->uc['copyLevels']; } return $this->dataHandler; diff --git a/Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerWriter.php b/Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerWriter.php index 072559a3..bc03aab4 100644 --- a/Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerWriter.php +++ b/Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerWriter.php @@ -33,7 +33,7 @@ final public function __construct( public static function withBackendUser(BackendUserAuthentication $backendUser): self { $dataHandler = GeneralUtility::makeInstance(DataHandler::class); - if (isset($backendUser->uc['copyLevels'])) { + if (isset($backendUser->uc['copyLevels']) && property_exists($dataHandler, 'copyTree')) { $dataHandler->copyTree = $backendUser->uc['copyLevels']; } return new static($dataHandler, $backendUser);