Skip to content

Commit

Permalink
Any fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
e-spin committed Mar 11, 2024
1 parent 2e5aa46 commit 3a06667
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
29 changes: 18 additions & 11 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorLevel="3"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="src/Resources"/>
</ignoreFiles>
</projectFiles>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="src/Resources"/>
</ignoreFiles>
</projectFiles>
<issueHandlers>
<TooManyArguments>
<errorLevel type="suppress">
<referencedFunction name="Doctrine\DBAL\Query\QueryBuilder::select"/>
</errorLevel>
</TooManyArguments>
</issueHandlers>
</psalm>
23 changes: 11 additions & 12 deletions src/View/EditMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general-contao-frontend.
*
* (c) 2015-2023 Contao Community Alliance.
* (c) 2015-2024 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -15,7 +15,7 @@
* @author Richard Henkenjohann <[email protected]>
* @author Sven Baumann <[email protected]>
* @author Ingolf Steinhardt <[email protected]>
* @copyright 2015-2023 Contao Community Alliance.
* @copyright 2015-2024 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general-contao-frontend/blob/master/LICENSE LGPL-3.0
* @filesource
*/
Expand All @@ -28,6 +28,7 @@
use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetEditModeButtonsEvent;
use ContaoCommunityAlliance\DcGeneral\Controller\ControllerInterface;
use ContaoCommunityAlliance\DcGeneral\DataDefinition\ContainerInterface;
use ContaoCommunityAlliance\DcGeneral\DataDefinition\DataProviderInformationInterface;
use ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\PropertiesDefinitionInterface;
use ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface;
use ContaoCommunityAlliance\DcGeneral\Data\DataProviderInterface;
Expand Down Expand Up @@ -86,9 +87,9 @@ class EditMask
/**
* The data provider of the model being edited.
*
* @var DataProviderInterface
* @var DataProviderInformationInterface
*/
private DataProviderInterface $modelProvider;
private DataProviderInformationInterface $modelProvider;

/**
* The model to be manipulated.
Expand Down Expand Up @@ -156,7 +157,6 @@ public function __construct($environment, $model, $originalModel, $preFunction,
* @return string
*
* @throws DcGeneralRuntimeException If the data container is not editable, closed.
*
* @throws DcGeneralInvalidArgumentException If an unknown property is encountered in the palette.
*/
public function execute()
Expand All @@ -177,8 +177,7 @@ public function execute()
$palette = $palettesDefinition->findPalette($this->model);

$propertyValues = $this->processInput($widgetManager);
assert($propertyValues instanceof PropertyValueBag);
if ($isSubmitted) {
if ($isSubmitted && null !== $propertyValues) {
// Pass 2: Determine the real palette we want to work on if we have some data submitted.
$palette = $palettesDefinition->findPalette($this->model, $propertyValues);

Expand Down Expand Up @@ -365,9 +364,9 @@ private function getEditButtons(): array
/**
* Build the field sets.
*
* @param WidgetManager $widgetManager The widget manager in use.
* @param PaletteInterface $palette The palette to use.
* @param PropertyValueBag $propertyValues The property values.
* @param WidgetManager $widgetManager The widget manager in use.
* @param PaletteInterface $palette The palette to use.
* @param PropertyValueBag|null $propertyValues The property values.
*
* @return array
*
Expand All @@ -379,7 +378,7 @@ private function getEditButtons(): array
private function buildFieldSet(
WidgetManager $widgetManager,
PaletteInterface $palette,
PropertyValueBag $propertyValues
?PropertyValueBag $propertyValues
): array {
$propertyDefinitions = $this->definition->getPropertiesDefinition();

Expand Down Expand Up @@ -470,7 +469,7 @@ private function ensurePropertyExists(string $property, PropertiesDefinitionInte
*/
private function storeVersion(ModelInterface $model): void
{
if (!$this->modelProvider->isVersioningEnabled() || null === $model) {
if (!$this->modelProvider->isVersioningEnabled()) {
return;
}

Expand Down
7 changes: 4 additions & 3 deletions src/View/WidgetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general-contao-frontend.
*
* (c) 2015-2023 Contao Community Alliance.
* (c) 2015-2024 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -14,7 +14,7 @@
* @author Christian Schiffler <[email protected]>
* @author Richard Henkenjohann <[email protected]>
* @author Ingolf Steinhardt <[email protected]>
* @copyright 2015-2023 Contao Community Alliance.
* @copyright 2015-2024 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general-contao-frontend/blob/master/LICENSE LGPL-3.0
* @filesource
*/
Expand All @@ -27,6 +27,7 @@
use ContaoCommunityAlliance\DcGeneral\ContaoFrontend\Event\BuildWidgetEvent;
use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\EncodePropertyValueFromWidgetEvent;
use ContaoCommunityAlliance\DcGeneral\ContaoFrontend\Event\DcGeneralFrontendEvents;
use ContaoCommunityAlliance\DcGeneral\Controller\ControllerInterface;
use ContaoCommunityAlliance\DcGeneral\Data\ModelInterface;
use ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag;
use ContaoCommunityAlliance\DcGeneral\DataDefinition\ContainerInterface;
Expand Down Expand Up @@ -104,7 +105,7 @@ public function getWidget($property, PropertyValueBag $valueBag = null)
$values = new PropertyValueBag($valueBag->getArrayCopy());

$controller = $this->environment->getController();
assert($controller instanceof ContainerInterface);
assert($controller instanceof ControllerInterface);

$controller->updateModelFromPropertyBag($model, $values);
}
Expand Down

0 comments on commit 3a06667

Please sign in to comment.