Skip to content

Commit

Permalink
fix phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Jan 8, 2025
1 parent cbeaf49 commit 2699327
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/Document/Editable/ConfigParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private function getSelectedValue(?Info $info, array $config, mixed $defaultConf

// force default (only if it returns false)
// checkboxes may return an empty string and are impossible to track into default mode
if (!empty($defaultConfigValue) && (method_exists($el, 'isEmpty') && $el->isEmpty() === true)) {
if (!empty($defaultConfigValue) && $el->isEmpty() === true) {
$el->setDataFromResource($defaultConfigValue);
}

Expand Down
4 changes: 0 additions & 4 deletions src/Model/Document/Editable/GoogleMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ public function getId(): ?string

protected function buildMapAttributes(): array
{
if (!is_array($this->config)) {
$this->config = [];
}

$dataAttr = [];
$dataAttr['data-locations'] = htmlspecialchars(json_encode($this->validateLocationValues($this->data)), ENT_QUOTES, 'UTF-8');
$dataAttr['data-show-info-window-on-load'] = $this->config['iwOnInit'] ?? true;
Expand Down
20 changes: 9 additions & 11 deletions src/Model/Document/Editable/ParallaxImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getDataEditmode(): array
$this->setElements();
$return = [];

if (is_array($this->elements) && count($this->elements) > 0) {
if (count($this->elements) > 0) {
foreach ($this->elements as $index => $element) {
if ($element instanceof DataObject\Concrete) {
$return[] = [
Expand Down Expand Up @@ -101,7 +101,7 @@ public function frontend(): string
$this->setElements();
$return = '';

if (is_array($this->elements) && count($this->elements) > 0) {
if (count($this->elements) > 0) {
foreach ($this->elements as $element) {
$return .= Element\Service::getElementType($element['obj']) . ': ' . $element['obj']->getFullPath() . '<br />';
}
Expand All @@ -115,16 +115,14 @@ public function resolveDependencies(): array
$this->setElements();
$dependencies = [];

if (is_array($this->elements) && count($this->elements) > 0) {
if (count($this->elements) > 0) {
foreach ($this->elements as $element) {
if ($element instanceof Element\ElementInterface) {
$elementType = Element\Service::getElementType($element);
$key = $elementType . '_' . $element->getId();
$dependencies[$key] = [
'id' => $element->getId(),
'type' => $elementType
];
}
$elementType = Element\Service::getElementType($element);
$key = $elementType . '_' . $element->getId();
$dependencies[$key] = [
'id' => $element->getId(),
'type' => $elementType
];
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/Model/Document/Editable/Vhs.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public function getShowAsLightBox(): bool

public function getVideoParameter(): array
{
if (!is_array($this->videoParameter)) {
return [];
}

$parsedParameter = [];
foreach ($this->videoParameter as $parameter) {
$parsedParameter[$parameter['key']] = $parameter['value'];
Expand Down Expand Up @@ -76,7 +72,7 @@ public function setDataFromEditmode(mixed $data): static
$this->showAsLightBox = $data['showAsLightbox'];
}

if (isset($data['videoParameter'])) {
if (isset($data['videoParameter']) && is_array($data['videoParameter'])) {
$this->videoParameter = $data['videoParameter'];
}

Expand Down

0 comments on commit 2699327

Please sign in to comment.