Skip to content

Commit 4ffd12d

Browse files
committed
Fix PHPCQ
1 parent 48a33d6 commit 4ffd12d

4 files changed

Lines changed: 15 additions & 17 deletions

File tree

src/CoreBundle/EventListener/DcGeneral/Breadcrumb/BreadcrumbDcaSettingConditionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private function getConditionAttribute($settingId)
111111
} else {
112112
$title = StringUtil::deserialize($setting->legendtitle, true);
113113
// @deprecated usage of TL_LANGUAGE - remove for Contao 5.0.
114-
return ($title[LocaleUtil::formatAsLocale($GLOBALS['TL_LANGUAGE'])] ?? current($title));
114+
return ($title[LocaleUtil::formatAsLocale($GLOBALS['TL_LANGUAGE'])] ?? (string) current($title));
115115
}
116116

117117
return 'unknown ' . $setting->dcatype;

src/FrontendIntegration/FrontendFilter.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,11 +634,7 @@ private function getBaseParameters(array $values): array
634634
return [];
635635
}
636636

637-
if (null === ($filterSetting = $this->objFilterConfig->getFilterCollection())) {
638-
throw new RuntimeException(
639-
'Error: no filter object defined, call setFilterSettings() before setFilterParameters().'
640-
);
641-
}
637+
$filterSetting = $this->objFilterConfig->getFilterCollection();
642638

643639
$presetNames = $filterSetting->getParameters();
644640
$filterParamKeys = \array_keys($filterSetting->getParameterFilterNames());

src/FrontendIntegration/MetaModelHybrid.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@
4141
/**
4242
* Base implementation of a MetaModel Hybrid element.
4343
*
44-
* @property string $id The id of the element.
45-
* @property string $name The module name to use (if type is module).
46-
* @property string $metamodel The id of the MetaModel to use.
47-
* @property string $metamodel_filtering The id of the MetaModel filter setting to use.
48-
* @property string $metamodel_rendersettings The id of the MetaModel render setting to use.
49-
* @property bool $metamodel_sort_override The flag to override sorting.
44+
* @property string $id The id of the element.
45+
* @property string $name The module name to use (if type is module).
46+
* @property string $metamodel The id of the MetaModel to use.
47+
* @property string $metamodel_filtering The id of the MetaModel filter setting to use.
48+
* @property string $metamodel_rendersettings The id of the MetaModel render setting to use.
49+
* @property bool $metamodel_sort_override The flag to override sorting.
50+
* @property list<string> $cssID The CSS id and classes.
5051
*
5152
* @psalm-type TDatabaseResult=object{
5253
* cssID: string,
@@ -155,7 +156,7 @@ protected function getConnection()
155156
* Create a new instance.
156157
*
157158
* @param Result|TDatabaseResult $objElement The object from the database.
158-
* @param string $strColumn The column the element is displayed within.
159+
* @param string $strColumn The column the element is displayed within.
159160
*/
160161
public function __construct($objElement, $strColumn = 'main')
161162
{
@@ -165,6 +166,7 @@ public function __construct($objElement, $strColumn = 'main')
165166
$this->arrData = \method_exists($objElement, 'row') ? $objElement->row() : (array) $objElement;
166167

167168
// Get CSS ID and headline from the parent element (!).
169+
/** @psalm-suppress PropertyTypeCoercion */
168170
$this->cssID = StringUtil::deserialize($objElement->cssID, true);
169171
$this->typePrefix = $objElement->typePrefix ?? '';
170172
$this->strKey = $objElement->type;

src/Widgets/SubDcaWidget.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class SubDcaWidget extends Widget
9797
/**
9898
* The prepared widgets.
9999
*
100-
* @var array
100+
* @var list<list<Widget>>
101101
*/
102102
protected $arrWidgets = [];
103103

@@ -567,9 +567,9 @@ protected function buildOptions()
567567
$options = [];
568568
foreach ($this->arrWidgets as $widgetRow) {
569569
$columns = [];
570-
foreach ((array) $widgetRow as $widget) {
571-
/** @var Widget $widget */
572-
$rawValign = (string) ($widget->valign ?? '');
570+
foreach ($widgetRow as $widget) {
571+
/** @psalm-suppress UndefinedMagicPropertyFetch */
572+
$rawValign = ((string) $widget->valign) ?: '';
573573
$valign = ($rawValign !== '' ? ' valign="' . $rawValign . '"' : '');
574574
$rawClass = $widget->class;
575575
$class = ($rawClass !== '' ? ' class="' . $rawClass . '"' : '');

0 commit comments

Comments
 (0)