Skip to content

Commit

Permalink
[TASK] Simplify a condition in the workspaces DataHandlerHook
Browse files Browse the repository at this point in the history
a || (b && !a)

can be simplified to

a || b

(because the second sub-condition is only evaluated if a is false).

Resolves: #97421
Releases: main, 11.5
Change-Id: I04d62fd46736bb4a0b9dfce54851aaa8f99d20e1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74468
Tested-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
  • Loading branch information
oliverklee authored and sbuerk committed May 5, 2022
1 parent d77c966 commit 77253e4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions Build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5860,11 +5860,6 @@ parameters:
count: 1
path: ../../typo3/sysext/workspaces/Classes/Domain/Record/WorkspaceRecord.php

-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: ../../typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php

-
message: "#^Offset 0 does not exist on non\\-empty\\-array\\<string, mixed\\>\\.$#"
count: 2
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public function moveRecord($table, $uid, $destPid, array $propArr, array $moveRe
// Workspace destination check:
// All records can be inserted if $recordMustNotBeVersionized is true.
// Only new versions can be inserted if $recordMustNotBeVersionized is FALSE.
if (!($recordMustNotBeVersionized || $canMoveRecord && !$recordMustNotBeVersionized)) {
if (!($recordMustNotBeVersionized || $canMoveRecord)) {
$workspaceAccessBlocked['dest1'] = 'Could not insert record from table "' . $table . '" in destination PID "' . $resolvedPid . '" ';
}

Expand Down

0 comments on commit 77253e4

Please sign in to comment.