Skip to content

Commit

Permalink
removed always true condition (#5359)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Oct 9, 2022
1 parent e4f5848 commit 6c491a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .tools/phpstan/baseline.neon
Expand Up @@ -820,11 +820,6 @@ parameters:
count: 1
path: ../../redaxo/src/addons/mediapool/lib/media_category.php

-
message: "#^Left side of && is always true\\.$#"
count: 1
path: ../../redaxo/src/addons/mediapool/lib/media_category_select.php

-
message: "#^Method rex_media_category_select\\:\\:__construct\\(\\) has parameter \\$checkPerms with no type specified\\.$#"
count: 1
Expand Down Expand Up @@ -1802,7 +1797,7 @@ parameters:

-
message: "#^Left side of && is always true\\.$#"
count: 3
count: 1
path: ../../redaxo/src/addons/structure/lib/select_category.php

-
Expand Down Expand Up @@ -1840,6 +1835,11 @@ parameters:
count: 1
path: ../../redaxo/src/addons/structure/lib/select_category.php

-
message: "#^Right side of && is always false\\.$#"
count: 1
path: ../../redaxo/src/addons/structure/lib/select_category.php

-
message: "#^Method rex_article_service\\:\\:addArticle\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
Expand Down
3 changes: 1 addition & 2 deletions redaxo/src/addons/mediapool/lib/media_category_select.php
Expand Up @@ -65,8 +65,7 @@ protected function addCatOptions()
*/
protected function addCatOption(rex_media_category $mediacat, int $parentId = 0)
{
if (!$this->checkPerms ||
$this->checkPerms && rex::getUser()->getComplexPerm('media')->hasCategoryPerm($mediacat->getId())
if (!$this->checkPerms || rex::getUser()->getComplexPerm('media')->hasCategoryPerm($mediacat->getId())
) {
$mid = $mediacat->getId();
$mname = $mediacat->getName();
Expand Down
7 changes: 3 additions & 4 deletions redaxo/src/addons/structure/lib/select_category.php
Expand Up @@ -87,8 +87,7 @@ protected function addCatOptions()
*/
protected function addCatOption(rex_category $cat, $group = null)
{
if (!$this->checkPerms ||
$this->checkPerms && rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($cat->getId())
if (!$this->checkPerms || rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($cat->getId())
) {
$cid = $cat->getId();
$cname = $cat->getName() . ' [' . $cid . ']';
Expand Down Expand Up @@ -133,9 +132,9 @@ protected function outGroup($parentId, $level = 0)
$name = $option[0];
$value = $option[1];
$id = $option[2];
if (0 == $id || !$this->checkPerms || ($this->checkPerms && rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($option[2]))) {
if (0 == $id || !$this->checkPerms || rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($option[2])) {
$ausgabe .= $this->outOption($name, $value, $level);
} elseif (($this->checkPerms && rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($option[2]))) {
} elseif ($this->checkPerms && rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($option[2])) {
--$level;
}

Expand Down

0 comments on commit 6c491a9

Please sign in to comment.