diff --git a/psalm.xml b/psalm.xml
index 9dd9aef..034092e 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -1,6 +1,6 @@
-
\ No newline at end of file
+
diff --git a/src/View/EditMask.php b/src/View/EditMask.php
index a5e8abe..0437e07 100644
--- a/src/View/EditMask.php
+++ b/src/View/EditMask.php
@@ -26,6 +26,7 @@
use ContaoCommunityAlliance\DcGeneral\ContaoFrontend\Event\HandleSubmitEvent;
use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetEditMaskSubHeadlineEvent;
use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetEditModeButtonsEvent;
+use ContaoCommunityAlliance\DcGeneral\Controller\ControllerInterface;
use ContaoCommunityAlliance\DcGeneral\DataDefinition\ContainerInterface;
use ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\PropertiesDefinitionInterface;
use ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface;
@@ -180,7 +181,7 @@ public function execute()
// Update the model - the model might add some more errors to the propertyValueBag via exceptions.
$controller = $this->environment->getController();
- assert($controller instanceof ContainerInterface);
+ assert($controller instanceof ControllerInterface);
$controller->updateModelFromPropertyBag($this->model, $propertyValues);
}
@@ -235,7 +236,7 @@ private function processInput($widgetManager): ?PropertyValueBag
if ($input->getValue('FORM_SUBMIT') === $this->definition->getName()) {
$propertyValues = new PropertyValueBag();
- $propertyNames = array_intersect(
+ $propertyNames = \array_intersect(
$this->definition->getPropertiesDefinition()->getPropertyNames(),
(array) $input->getValue('FORM_INPUTS')
);
@@ -330,7 +331,7 @@ private function getEditButtons(): array
$button = '';
$buttons = [];
- $buttons['save'] = sprintf(
+ $buttons['save'] = \sprintf(
$button,
'save',
'save',
@@ -340,7 +341,7 @@ private function getEditButtons(): array
);
if ($this->definition->getBasicDefinition()->isCreatable()) {
- $buttons['saveNcreate'] = sprintf(
+ $buttons['saveNcreate'] = \sprintf(
$button,
'saveNcreate',
'saveNcreate',
@@ -469,9 +470,9 @@ private function storeVersion(ModelInterface $model): void
return;
}
- $environment = $this->environment;
- $modelId = $model->getId();
- $dataProvider = $environment->getDataProvider($this->model->getProviderName());
+ $environment = $this->environment;
+ $modelId = $model->getId();
+ $dataProvider = $environment->getDataProvider($this->model->getProviderName());
assert($dataProvider instanceof DataProviderInterface);
$currentVersion = $dataProvider->getActiveVersion($modelId);
diff --git a/src/View/WidgetManager.php b/src/View/WidgetManager.php
index 183b444..e036b86 100644
--- a/src/View/WidgetManager.php
+++ b/src/View/WidgetManager.php
@@ -23,6 +23,7 @@
use Contao\FormTextArea;
use Contao\Input;
+use Contao\Widget;
use ContaoCommunityAlliance\DcGeneral\ContaoFrontend\Event\BuildWidgetEvent;
use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\EncodePropertyValueFromWidgetEvent;
use ContaoCommunityAlliance\DcGeneral\ContaoFrontend\Event\DcGeneralFrontendEvents;
@@ -114,7 +115,7 @@ public function getWidget($property, PropertyValueBag $valueBag = null)
$dispatcher->dispatch($event, DcGeneralFrontendEvents::BUILD_WIDGET);
if (!$event->getWidget()) {
throw new DcGeneralRuntimeException(
- sprintf('Widget was not build for property %s::%s.', $this->model->getProviderName(), $property)
+ \sprintf('Widget was not build for property %s::%s.', $this->model->getProviderName(), $property)
);
}
@@ -174,7 +175,7 @@ public function processInput(PropertyValueBag $valueBag): void
$post = $this->hijackPost($valueBag);
// Now get and validate the widgets.
- foreach (array_keys($valueBag->getArrayCopy()) as $property) {
+ foreach (\array_keys($valueBag->getArrayCopy()) as $property) {
$this->processProperty($valueBag, $property);
}
@@ -198,6 +199,7 @@ private function processProperty(PropertyValueBag $valueBag, string $property):
// native data as in the model.
// Therefore, we do not need to decode them but MUST encode them.
$widget = $this->getWidget($property, $valueBag);
+ assert($widget instanceof Widget);
$widget->validate();
if ($widget->hasErrors()) {
@@ -217,6 +219,7 @@ private function processProperty(PropertyValueBag $valueBag, string $property):
try {
// See https://github.com/contao/contao/blob/7e6bacd4e/core-bundle/src/Resources/contao/forms/FormTextArea.php#L147
if ($widget instanceof FormTextArea) {
+ /** @psalm-suppress UndefinedMagicPropertyFetch */
$valueBag->setPropertyValue($property, $this->encodeValue($property, $widget->rawValue, $valueBag));
return;
}
diff --git a/src/Widgets/UploadOnSteroids.php b/src/Widgets/UploadOnSteroids.php
index d3ec9dd..4f7ca6e 100644
--- a/src/Widgets/UploadOnSteroids.php
+++ b/src/Widgets/UploadOnSteroids.php
@@ -31,6 +31,7 @@
use Contao\Input;
use Contao\StringUtil;
use Contao\System;
+use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;
@@ -447,7 +448,7 @@ private function preOrPostFixFilename(string $filename): string
return $filename;
}
- // We save the default delimeter '-' at prefix and postfix
+ // We save the default delimiter '-' at prefix and postfix
// see https://github.com/ausi/slug-generator/issues/34.
$prefix = $this->prefixFilename;
if ($this->prefixFilename && $this->normalizeFilename) {
@@ -530,7 +531,7 @@ private function addFiles($sortBy): void
)
->from($platform->quoteIdentifier('tl_files'))
->where($builder->expr()->in($platform->quoteIdentifier('uuid'), ':uuids'))
- ->setParameter('uuids', (array) $this->value, Connection::PARAM_STR_ARRAY);
+ ->setParameter('uuids', (array) $this->value, ArrayParameterType::STRING );
$statement = $builder->executeQuery();
if (!$statement->rowCount()) {
@@ -705,11 +706,11 @@ protected function getSlugOptions(): array
*/
private function translator(): TranslatorInterface
{
- if (!$this->filesystem) {
- $this->filesystem = self::getContainer()->get('translator');
+ if (!$this->translator) {
+ $this->translator = self::getContainer()->get('translator');
}
- return $this->filesystem;
+ return $this->translator;
}
/**