diff --git a/.phpcq.yaml.dist b/.phpcq.yaml.dist index 10be43eac..69a969bca 100644 --- a/.phpcq.yaml.dist +++ b/.phpcq.yaml.dist @@ -53,6 +53,7 @@ phpcq: # psalm - 8A03EA3B385DBAA1 - 12CE0F1D262429A5 + - 99BF4D9A33D65E1E # magl@magll.net - D2CCAC42F6295E7D # PHP_CodeSniffer diff --git a/composer.json b/composer.json index e8d5c798d..35a6fd281 100644 --- a/composer.json +++ b/composer.json @@ -92,7 +92,7 @@ }, "extra": { "branch-alias": { - "dev-release/2.4.0": "2.4.x-dev" + "dev-feature/symfony-7": "2.5.x-dev" }, "contao-manager-plugin": "ContaoCommunityAlliance\\DcGeneral\\ContaoManager\\Plugin" } diff --git a/src/Cache/Http/InvalidateCacheTags.php b/src/Cache/Http/InvalidateCacheTags.php index d6b886127..3a9b51481 100644 --- a/src/Cache/Http/InvalidateCacheTags.php +++ b/src/Cache/Http/InvalidateCacheTags.php @@ -75,7 +75,7 @@ class InvalidateCacheTags implements InvalidateCacheTagsInterface public function __construct( string $namespace, EventDispatcherInterface $dispatcher, - CacheInvalidator $cacheManager = null + ?CacheInvalidator $cacheManager = null ) { $this->namespace = $namespace; $this->dispatcher = $dispatcher; diff --git a/src/Contao/Compatibility/DcCompat.php b/src/Contao/Compatibility/DcCompat.php index bafe5cd0e..7c5d0d8ce 100644 --- a/src/Contao/Compatibility/DcCompat.php +++ b/src/Contao/Compatibility/DcCompat.php @@ -61,7 +61,7 @@ class DcCompat extends General * @param ModelInterface|null $model The model within scope (optional). * @param string|null $propertyName The name of the property within scope (optional). */ - public function __construct(EnvironmentInterface $environment, ModelInterface $model = null, $propertyName = null) + public function __construct(EnvironmentInterface $environment, ?ModelInterface $model = null, ?string $propertyName = null) { // Prevent "Recoverable error: Argument X passed to SomClass::someMethod() must be an instance of DataContainer, // instance of ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat given" in callbacks. diff --git a/src/Contao/Dca/Builder/Legacy/LegacyDcaDataDefinitionBuilder.php b/src/Contao/Dca/Builder/Legacy/LegacyDcaDataDefinitionBuilder.php index cf55c9565..1784a7b5c 100644 --- a/src/Contao/Dca/Builder/Legacy/LegacyDcaDataDefinitionBuilder.php +++ b/src/Contao/Dca/Builder/Legacy/LegacyDcaDataDefinitionBuilder.php @@ -1203,6 +1203,10 @@ protected function parseModelOperations(Contao2BackendViewDefinitionInterface $v $collection = $view->getModelCommands(); foreach ($operationsDca as $operationName => $operationDca) { + if (is_string($operationDca)) { + continue; + } + assert(is_array($operationDca)); $command = $this->createCommand($operationName, $operationDca); $collection->addCommand($command); } diff --git a/src/Contao/Picker/AbstractAwarePickerProvider.php b/src/Contao/Picker/AbstractAwarePickerProvider.php index 83e25857c..0350de216 100644 --- a/src/Contao/Picker/AbstractAwarePickerProvider.php +++ b/src/Contao/Picker/AbstractAwarePickerProvider.php @@ -156,7 +156,7 @@ protected function getUser() * * @return array */ - abstract protected function getRouteParameters(PickerConfig $config = null); + abstract protected function getRouteParameters(?PickerConfig $config = null); /** * Generates the URL for the picker. diff --git a/src/Contao/Picker/PagePickerProvider.php b/src/Contao/Picker/PagePickerProvider.php index 62c1175ae..25cfb7901 100644 --- a/src/Contao/Picker/PagePickerProvider.php +++ b/src/Contao/Picker/PagePickerProvider.php @@ -108,7 +108,7 @@ public function supportsValue(PickerConfig $config): bool /** * {@inheritdoc} */ - public function getDcaTable(PickerConfig $config = null): string + public function getDcaTable(?PickerConfig $config = null): string { return 'tl_page'; } diff --git a/src/Contao/Picker/TreePickerProvider.php b/src/Contao/Picker/TreePickerProvider.php index 41ee97365..87972bb0d 100644 --- a/src/Contao/Picker/TreePickerProvider.php +++ b/src/Contao/Picker/TreePickerProvider.php @@ -110,7 +110,7 @@ public function convertDcaValue(PickerConfig $config, mixed $value): int|string /** * {@inheritdoc} */ - protected function getRouteParameters(PickerConfig $config = null) + protected function getRouteParameters(?PickerConfig $config = null) { return ['do' => 'tree']; } diff --git a/src/Contao/Subscriber/FormatModelLabelSubscriber.php b/src/Contao/Subscriber/FormatModelLabelSubscriber.php index 10fc1a424..2916f73fb 100644 --- a/src/Contao/Subscriber/FormatModelLabelSubscriber.php +++ b/src/Contao/Subscriber/FormatModelLabelSubscriber.php @@ -110,7 +110,7 @@ public function handleFormatModelLabel(FormatModelLabelEvent $event) * * @return string */ - private function getFirstSorting(GroupAndSortingDefinitionInterface $sortingDefinition = null) + private function getFirstSorting(?GroupAndSortingDefinitionInterface $sortingDefinition = null) { if (null === $sortingDefinition) { return ''; diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php index 21b77017e..c655f457d 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php @@ -157,8 +157,8 @@ private function process(Action $action, EnvironmentInterface $environment) * @SuppressWarnings(PHPMD.LongVariable) */ protected function handleInvalidPropertyValueBag( - PropertyValueBagInterface $propertyValueBag = null, - ModelInterface $model = null, + ?PropertyValueBagInterface $propertyValueBag, + ?ModelInterface $model, EnvironmentInterface $environment ) { // @codingStandardsIgnoreStart @@ -208,17 +208,17 @@ protected function handleInvalidPropertyValueBag( /** * Handle override of model collection. * - * @param Action $action The action. - * @param \ArrayObject $renderInformation The render information. - * @param PropertyValueBagInterface $propertyValues The property values. - * @param EnvironmentInterface $environment The environment. + * @param Action $action The action. + * @param \ArrayObject $renderInformation The render information. + * @param PropertyValueBagInterface|null $propertyValues The property values. + * @param EnvironmentInterface $environment The environment. * * @return void */ private function handleOverrideCollection( Action $action, \ArrayObject $renderInformation, - PropertyValueBagInterface $propertyValues = null, + ?PropertyValueBagInterface $propertyValues, EnvironmentInterface $environment ) { if (!$propertyValues) { diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/ToggleHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/ToggleHandler.php index 6d497bfd7..29dc1e0df 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/ToggleHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/ToggleHandler.php @@ -112,7 +112,7 @@ public function handleEvent(ActionEvent $event) protected function process( EnvironmentInterface $environment, ToggleCommandInterface $operation, - ModelIdInterface $modelId = null + ?ModelIdInterface $modelId = null ) { $dataProvider = $environment->getDataProvider(); assert($dataProvider instanceof DataProviderInterface); diff --git a/src/Contao/View/Contao2BackendView/ContaoWidgetManager.php b/src/Contao/View/Contao2BackendView/ContaoWidgetManager.php index 22d3fd033..41c287e0c 100644 --- a/src/Contao/View/Contao2BackendView/ContaoWidgetManager.php +++ b/src/Contao/View/Contao2BackendView/ContaoWidgetManager.php @@ -272,8 +272,8 @@ protected function getUniqueId($propertyName) /** * Retrieve the instance of a widget for the given property. * - * @param string $property Name of the property for which the widget shall be retrieved. - * @param PropertyValueBagInterface $inputValues The input values to use (optional) (RAW widget value format). + * @param string $property Name of the property for which the widget shall be retrieved. + * @param PropertyValueBagInterface|null $inputValues The input values to use (optional) (RAW widget value format). * * @return Widget|null * @@ -284,7 +284,7 @@ protected function getUniqueId($propertyName) * @SuppressWarnings(PHPMD.CamelCaseVariableName) * @SuppressWarnings(PHPMD.EmptyCatchBlock) */ - public function getWidget($property, PropertyValueBagInterface $inputValues = null) + public function getWidget($property, ?PropertyValueBagInterface $inputValues = null) { $environment = $this->getEnvironment(); $definition = $environment->getDataDefinition(); @@ -401,16 +401,16 @@ protected function generateHelpText($property, Widget $widget) /** * Render the widget for the named property. * - * @param string $property The name of the property for which the widget shall be rendered. - * @param bool $ignoreErrors Flag if the error property of the widget shall get - * cleared prior rendering. - * @param PropertyValueBagInterface $inputValues The input values to use (optional) (RAW widget value format). + * @param string $property The name of the property for which the widget shall be rendered. + * @param bool $ignoreErrors Flag if the error property of the widget shall get + * cleared prior rendering. + * @param PropertyValueBagInterface|null $inputValues The input values to use (optional) (RAW widget value format). * * @return string * * @throws DcGeneralRuntimeException For unknown properties. */ - public function renderWidget($property, $ignoreErrors = false, PropertyValueBagInterface $inputValues = null) + public function renderWidget($property, $ignoreErrors = false, ?PropertyValueBagInterface $inputValues = null) { /** @var Widget $widget */ $widget = $this->getWidget($property, $inputValues); diff --git a/src/Contao/View/Contao2BackendView/Subscriber/WidgetBuilder.php b/src/Contao/View/Contao2BackendView/Subscriber/WidgetBuilder.php index 1b7150540..b739e615e 100644 --- a/src/Contao/View/Contao2BackendView/Subscriber/WidgetBuilder.php +++ b/src/Contao/View/Contao2BackendView/Subscriber/WidgetBuilder.php @@ -109,7 +109,7 @@ class WidgetBuilder implements EnvironmentAwareInterface public function __construct( EnvironmentInterface $environment, TranslatorInterface $translator, - RequestScopeDeterminator $scopeDeterminator = null + ?RequestScopeDeterminator $scopeDeterminator = null ) { $this->environment = $environment; $this->translator = $translator; diff --git a/src/Controller/ControllerInterface.php b/src/Controller/ControllerInterface.php index a37d036a2..997d49c77 100644 --- a/src/Controller/ControllerInterface.php +++ b/src/Controller/ControllerInterface.php @@ -182,11 +182,11 @@ public function getModelsFromClipboardItems(array $items); * * This will only return models, that are compatible with the current environment. * - * @param ModelIdInterface $parentModelId The optional parent id. If not given, the models must not have a parent. + * @param ModelIdInterface|null $parentModelId The optional parent id. If not given, the models must not have a parent. * * @return CollectionInterface */ - public function getModelsFromClipboard(ModelIdInterface $parentModelId = null); + public function getModelsFromClipboard(?ModelIdInterface $parentModelId = null); /** * Evaluate clipboard items, then return the corresponding models. @@ -201,11 +201,11 @@ public function getModelsFromClipboard(ModelIdInterface $parentModelId = null); * @return CollectionInterface */ public function applyClipboardActions( - ModelIdInterface $source = null, - ModelIdInterface $after = null, - ModelIdInterface $into = null, - ModelIdInterface $parentModelId = null, - FilterInterface $filter = null, + ?ModelIdInterface $source = null, + ?ModelIdInterface $after = null, + ?ModelIdInterface $into = null, + ?ModelIdInterface $parentModelId = null, + ?FilterInterface $filter = null, array &$items = [] ); @@ -218,7 +218,7 @@ public function applyClipboardActions( * * @return void */ - public function pasteTop(CollectionInterface $models, $sortedBy, ModelIdInterface $parentId = null); + public function pasteTop(CollectionInterface $models, $sortedBy, ?ModelIdInterface $parentId = null); /** * Paste the content of the clipboard after the given model. diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index 138a1dd95..20bb8431a 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -275,7 +275,7 @@ public function assembleAllChildrenFrom($model, $providerName = '') protected function assembleSiblingsFor( ModelInterface $model, $sortingProperty = null, - ModelIdInterface $parentId = null + ?ModelIdInterface $parentId = null ) { // @codingStandardsIgnoreStart @trigger_error( @@ -559,7 +559,7 @@ public function getModelsFromClipboardItems(array $items) /** * {@inheritDoc} */ - public function getModelsFromClipboard(ModelIdInterface $parentModelId = null) + public function getModelsFromClipboard(?ModelIdInterface $parentModelId = null) { $environment = $this->getEnvironment(); @@ -588,12 +588,12 @@ public function getModelsFromClipboard(ModelIdInterface $parentModelId = null) * {@inheritDoc} */ public function applyClipboardActions( - ModelIdInterface $source = null, - ModelIdInterface $after = null, - ModelIdInterface $into = null, - ModelIdInterface $parentModelId = null, - FilterInterface $filter = null, - array &$items = [] + ?ModelIdInterface $source = null, + ?ModelIdInterface $after = null, + ?ModelIdInterface $into = null, + ?ModelIdInterface $parentModelId = null, + ?FilterInterface $filter = null, + array &$items = [], ) { if ($source) { $actions = $this->getActionsFromSource($source, $parentModelId); @@ -614,7 +614,7 @@ public function applyClipboardActions( * * @throws InvalidArgumentException When the model id is invalid. */ - private function getActionsFromSource(ModelIdInterface $source, ModelIdInterface $parentModelId = null) + private function getActionsFromSource(ModelIdInterface $source, ?ModelIdInterface $parentModelId = null) { $definition = $this->getEnvironment()->getDataDefinition(); assert($definition instanceof ContainerInterface); @@ -662,7 +662,7 @@ private function getActionsFromSource(ModelIdInterface $source, ModelIdInterface * * @return array */ - private function fetchModelsFromClipboard(FilterInterface $filter = null, ModelIdInterface $parentModelId = null) + private function fetchModelsFromClipboard(?FilterInterface $filter = null, ?ModelIdInterface $parentModelId = null) { $environment = $this->getEnvironment(); assert($environment instanceof EnvironmentInterface); @@ -721,9 +721,9 @@ private function fetchModelsFromClipboard(FilterInterface $filter = null, ModelI */ private function doActions( array $actions, - ModelIdInterface $after = null, - ModelIdInterface $into = null, - ModelIdInterface $parentModelId = null, + ?ModelIdInterface $after = null, + ?ModelIdInterface $into = null, + ?ModelIdInterface $parentModelId = null, array &$items = [] ) { if ($parentModelId) { @@ -765,7 +765,7 @@ private function doActions( * @return void * */ - private function applyAction(array &$action, array &$deepCopyList, ModelInterface $parentModel = null) + private function applyAction(array &$action, array &$deepCopyList, ?ModelInterface $parentModel = null) { /** @var ModelInterface|null $model */ $model = $action['model']; @@ -842,7 +842,7 @@ private function doCloneAction(ModelInterface $model) * * @return void */ - private function ensureSameGrouping(array $actions, ModelIdInterface $after = null) + private function ensureSameGrouping(array $actions, ?ModelIdInterface $after = null) { $environment = $this->getEnvironment(); $groupingMode = ViewHelpers::getGroupingMode($environment); @@ -876,9 +876,9 @@ private function ensureSameGrouping(array $actions, ModelIdInterface $after = nu */ private function sortAndPersistModels( array $actions, - ModelIdInterface $after = null, - ModelIdInterface $into = null, - ModelIdInterface $parentModelId = null, + ?ModelIdInterface $after = null, + ?ModelIdInterface $into = null, + ?ModelIdInterface $parentModelId = null, array &$items = [] ) { $models = $this->createModelCollectionFromActions($actions, $items); @@ -906,7 +906,7 @@ private function sortAndPersistModels( * * @return void */ - private function processPasteAfter(CollectionInterface $models, ModelIdInterface $after = null) + private function processPasteAfter(CollectionInterface $models, ?ModelIdInterface $after = null) { if ($after && $models->count() && $after->getId()) { $manualSorting = ViewHelpers::getManualSortingProperty($this->getEnvironment()); @@ -930,7 +930,7 @@ private function processPasteAfter(CollectionInterface $models, ModelIdInterface * * @return void */ - private function processPasteInto(CollectionInterface $models, ModelIdInterface $into = null) + private function processPasteInto(CollectionInterface $models, ?ModelIdInterface $into = null) { if ($into && $models->count() && $into->getId()) { $manualSorting = ViewHelpers::getManualSortingProperty($this->getEnvironment()); @@ -958,9 +958,9 @@ private function processPasteInto(CollectionInterface $models, ModelIdInterface */ private function processPasteTopWithoutReference( CollectionInterface $models, - ModelIdInterface $after = null, - ModelIdInterface $into = null, - ModelIdInterface $parent = null + ?ModelIdInterface $after = null, + ?ModelIdInterface $into = null, + ?ModelIdInterface $parent = null ) { if ( $models->count() @@ -987,12 +987,12 @@ private function processPasteTopWithoutReference( /** * Process paste the content of the clipboard onto the top after a model. * - * @param CollectionInterface $models The collection of models. - * @param ModelIdInterface $parent The parent model id. + * @param CollectionInterface $models The collection of models. + * @param ModelIdInterface|null $parent The parent model id. * * @return void */ - private function processPasteTopAfterModel(CollectionInterface $models, ModelIdInterface $parent = null) + private function processPasteTopAfterModel(CollectionInterface $models, ?ModelIdInterface $parent = null) { if ($parent && $models->count()) { $manualSorting = ViewHelpers::getManualSortingProperty($this->getEnvironment()); @@ -1177,7 +1177,7 @@ protected function doDeepCopy(array $deepCopyList) /** * {@inheritDoc} */ - public function pasteTop(CollectionInterface $models, $sortedBy, ModelIdInterface $parentId = null) + public function pasteTop(CollectionInterface $models, $sortedBy, ?ModelIdInterface $parentId = null) { $environment = $this->getEnvironment(); diff --git a/src/Controller/ModelCollector.php b/src/Controller/ModelCollector.php index 58719ffd3..6a5882b4a 100644 --- a/src/Controller/ModelCollector.php +++ b/src/Controller/ModelCollector.php @@ -352,7 +352,7 @@ public function searchParentFromHierarchical(ModelInterface $model): ?ModelInter public function collectSiblingsOf( ModelInterface $model, $sortingProperty = null, - ModelIdInterface $parentId = null + ?ModelIdInterface $parentId = null ) { $registry = $this->environment->getBaseConfigRegistry(); assert($registry instanceof BaseConfigRegistryInterface); diff --git a/src/Controller/SortingManager.php b/src/Controller/SortingManager.php index 120cdd39a..363cd5505 100644 --- a/src/Controller/SortingManager.php +++ b/src/Controller/SortingManager.php @@ -96,10 +96,10 @@ class SortingManager * the collection. */ public function __construct( - CollectionInterface $models = null, - CollectionInterface $siblings = null, - string $sortedBy = null, - ModelInterface $previousModel = null + ?CollectionInterface $models = null, + ?CollectionInterface $siblings = null, + ?string $sortedBy = null, + ?ModelInterface $previousModel = null ) { if ($models) { $this->setModels($models); diff --git a/src/DC/General.php b/src/DC/General.php index 6d3c86729..12963a6da 100644 --- a/src/DC/General.php +++ b/src/DC/General.php @@ -76,7 +76,7 @@ class General extends DataContainer implements DataContainerInterface * @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function __construct($tableName, array $module = [], CacheInterface $cache = null) + public function __construct($tableName, array $module = [], ?CacheInterface $cache = null) { // Prevent "Recoverable error: Argument X passed to SomClass::someMethod() must be an instance of DataContainer, // instance of ContaoCommunityAlliance\DcGeneral\DC_General given" in callbacks. diff --git a/src/DataDefinition/Palette/Condition/Palette/DefaultPaletteCondition.php b/src/DataDefinition/Palette/Condition/Palette/DefaultPaletteCondition.php index ffee0956f..d04e0aedb 100644 --- a/src/DataDefinition/Palette/Condition/Palette/DefaultPaletteCondition.php +++ b/src/DataDefinition/Palette/Condition/Palette/DefaultPaletteCondition.php @@ -32,7 +32,7 @@ class DefaultPaletteCondition implements PaletteConditionInterface /** * {@inheritdoc} */ - public function getMatchCount(ModelInterface $model = null, PropertyValueBag $input = null) + public function getMatchCount(?ModelInterface $model = null, ?PropertyValueBag $input = null) { return 0; } diff --git a/src/DataDefinition/Palette/Condition/Palette/PaletteConditionChain.php b/src/DataDefinition/Palette/Condition/Palette/PaletteConditionChain.php index 51e4866af..866783796 100644 --- a/src/DataDefinition/Palette/Condition/Palette/PaletteConditionChain.php +++ b/src/DataDefinition/Palette/Condition/Palette/PaletteConditionChain.php @@ -38,7 +38,7 @@ class PaletteConditionChain extends AbstractConditionChain implements PaletteCon * @throws DcGeneralRuntimeException When a condition that does not implement PaletteConditionInterface * is encountered. */ - public function getMatchCount(ModelInterface $model = null, PropertyValueBag $input = null) + public function getMatchCount(?ModelInterface $model = null, ?PropertyValueBag $input = null) { $totalCount = false; diff --git a/src/DataDefinition/Palette/Condition/Palette/PaletteConditionInterface.php b/src/DataDefinition/Palette/Condition/Palette/PaletteConditionInterface.php index 1e57e5e37..ecb929ba9 100644 --- a/src/DataDefinition/Palette/Condition/Palette/PaletteConditionInterface.php +++ b/src/DataDefinition/Palette/Condition/Palette/PaletteConditionInterface.php @@ -46,7 +46,7 @@ interface PaletteConditionInterface extends ConditionInterface * * @return false|int */ - public function getMatchCount(ModelInterface $model = null, PropertyValueBag $input = null); + public function getMatchCount(?ModelInterface $model = null, ?PropertyValueBag $input = null); /** * Create a deep clone of the condition. diff --git a/src/DataDefinition/Palette/Condition/Palette/PropertyFalseCondition.php b/src/DataDefinition/Palette/Condition/Palette/PropertyFalseCondition.php index eac3cb871..33e81b564 100644 --- a/src/DataDefinition/Palette/Condition/Palette/PropertyFalseCondition.php +++ b/src/DataDefinition/Palette/Condition/Palette/PropertyFalseCondition.php @@ -32,7 +32,7 @@ class PropertyFalseCondition extends AbstractBoolPaletteCondition /** * {@inheritdoc} */ - public function getMatchCount(ModelInterface $model = null, PropertyValueBag $input = null) + public function getMatchCount(?ModelInterface $model = null, ?PropertyValueBag $input = null) { if (!$this->propertyName) { return false; diff --git a/src/DataDefinition/Palette/Condition/Palette/PropertyTrueCondition.php b/src/DataDefinition/Palette/Condition/Palette/PropertyTrueCondition.php index fcb271e06..556389f8a 100644 --- a/src/DataDefinition/Palette/Condition/Palette/PropertyTrueCondition.php +++ b/src/DataDefinition/Palette/Condition/Palette/PropertyTrueCondition.php @@ -32,7 +32,7 @@ class PropertyTrueCondition extends AbstractBoolPaletteCondition /** * {@inheritdoc} */ - public function getMatchCount(ModelInterface $model = null, PropertyValueBag $input = null) + public function getMatchCount(?ModelInterface $model = null, ?PropertyValueBag $input = null) { if (!$this->propertyName) { return false; diff --git a/src/DataDefinition/Palette/Condition/Palette/PropertyValueCondition.php b/src/DataDefinition/Palette/Condition/Palette/PropertyValueCondition.php index c6c2843aa..c7fe4ad7e 100644 --- a/src/DataDefinition/Palette/Condition/Palette/PropertyValueCondition.php +++ b/src/DataDefinition/Palette/Condition/Palette/PropertyValueCondition.php @@ -141,7 +141,7 @@ public function getStrict() /** * {@inheritdoc} */ - public function getMatchCount(ModelInterface $model = null, PropertyValueBag $input = null) + public function getMatchCount(?ModelInterface $model = null, ?PropertyValueBag $input = null) { if (!$this->propertyName) { return false; diff --git a/src/DataDefinition/Palette/Condition/Property/BooleanCondition.php b/src/DataDefinition/Palette/Condition/Property/BooleanCondition.php index 889dd176d..b3064f3fd 100644 --- a/src/DataDefinition/Palette/Condition/Property/BooleanCondition.php +++ b/src/DataDefinition/Palette/Condition/Property/BooleanCondition.php @@ -79,10 +79,10 @@ public function getValue() * {@inheritdoc} */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { return $this->value; } diff --git a/src/DataDefinition/Palette/Condition/Property/DumpingPropertyCondition.php b/src/DataDefinition/Palette/Condition/Property/DumpingPropertyCondition.php index 8a04ce575..dba8fbe2e 100644 --- a/src/DataDefinition/Palette/Condition/Property/DumpingPropertyCondition.php +++ b/src/DataDefinition/Palette/Condition/Property/DumpingPropertyCondition.php @@ -59,10 +59,10 @@ public function __construct($propertyCondition) * @psalm-suppress ForbiddenCode - We explicitly allow var_dump() here for debugging purposes. */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { $result = $this->propertyCondition->match($model, $input, $property, $legend); diff --git a/src/DataDefinition/Palette/Condition/Property/NotCondition.php b/src/DataDefinition/Palette/Condition/Property/NotCondition.php index 32d61dbc4..39dbdea6b 100644 --- a/src/DataDefinition/Palette/Condition/Property/NotCondition.php +++ b/src/DataDefinition/Palette/Condition/Property/NotCondition.php @@ -75,10 +75,10 @@ public function getCondition() * {@inheritdoc} */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { return !$this->condition->match($model, $input, $property, $legend); } diff --git a/src/DataDefinition/Palette/Condition/Property/PropertyCallbackCondition.php b/src/DataDefinition/Palette/Condition/Property/PropertyCallbackCondition.php index d7637a514..459988c67 100644 --- a/src/DataDefinition/Palette/Condition/Property/PropertyCallbackCondition.php +++ b/src/DataDefinition/Palette/Condition/Property/PropertyCallbackCondition.php @@ -52,10 +52,10 @@ public function __construct($callback) * {@inheritdoc} */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { return \call_user_func($this->callback, $model, $input, $property, $legend); } diff --git a/src/DataDefinition/Palette/Condition/Property/PropertyConditionChain.php b/src/DataDefinition/Palette/Condition/Property/PropertyConditionChain.php index 4d662ce04..bfe91cb0b 100644 --- a/src/DataDefinition/Palette/Condition/Property/PropertyConditionChain.php +++ b/src/DataDefinition/Palette/Condition/Property/PropertyConditionChain.php @@ -40,10 +40,10 @@ class PropertyConditionChain extends AbstractConditionChain implements PropertyC * is encountered. */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { if (static::AND_CONJUNCTION === $this->conjunction) { foreach ($this->conditions as $condition) { diff --git a/src/DataDefinition/Palette/Condition/Property/PropertyConditionInterface.php b/src/DataDefinition/Palette/Condition/Property/PropertyConditionInterface.php index e9ff3aadc..4a400742e 100644 --- a/src/DataDefinition/Palette/Condition/Property/PropertyConditionInterface.php +++ b/src/DataDefinition/Palette/Condition/Property/PropertyConditionInterface.php @@ -48,10 +48,10 @@ interface PropertyConditionInterface extends ConditionInterface * @return bool */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ); /** diff --git a/src/DataDefinition/Palette/Condition/Property/PropertyEditableCondition.php b/src/DataDefinition/Palette/Condition/Property/PropertyEditableCondition.php index ecda816c5..10820cb6f 100644 --- a/src/DataDefinition/Palette/Condition/Property/PropertyEditableCondition.php +++ b/src/DataDefinition/Palette/Condition/Property/PropertyEditableCondition.php @@ -76,10 +76,10 @@ public function getPropertyName() * {@inheritdoc} */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { if (!$legend) { return false; diff --git a/src/DataDefinition/Palette/Condition/Property/PropertyFalseCondition.php b/src/DataDefinition/Palette/Condition/Property/PropertyFalseCondition.php index 9bee678b0..2c92d4926 100644 --- a/src/DataDefinition/Palette/Condition/Property/PropertyFalseCondition.php +++ b/src/DataDefinition/Palette/Condition/Property/PropertyFalseCondition.php @@ -38,10 +38,10 @@ class PropertyFalseCondition implements PropertyConditionInterface * {@inheritdoc} */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { if ($input && $input->hasPropertyValue($this->propertyName)) { $value = $input->getPropertyValue($this->propertyName); diff --git a/src/DataDefinition/Palette/Condition/Property/PropertyTrueCondition.php b/src/DataDefinition/Palette/Condition/Property/PropertyTrueCondition.php index 336166504..abac246b9 100644 --- a/src/DataDefinition/Palette/Condition/Property/PropertyTrueCondition.php +++ b/src/DataDefinition/Palette/Condition/Property/PropertyTrueCondition.php @@ -38,10 +38,10 @@ class PropertyTrueCondition implements PropertyConditionInterface * {@inheritdoc} */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { if ($input && $input->hasPropertyValue($this->propertyName)) { $value = $input->getPropertyValue($this->propertyName); diff --git a/src/DataDefinition/Palette/Condition/Property/PropertyValueCondition.php b/src/DataDefinition/Palette/Condition/Property/PropertyValueCondition.php index a37c45dca..edab343db 100644 --- a/src/DataDefinition/Palette/Condition/Property/PropertyValueCondition.php +++ b/src/DataDefinition/Palette/Condition/Property/PropertyValueCondition.php @@ -145,10 +145,10 @@ public function getStrict() * {@inheritdoc} */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { if ($input && $input->hasPropertyValue($this->propertyName)) { $value = $input->getPropertyValue($this->propertyName); diff --git a/src/DataDefinition/Palette/Condition/Property/PropertyVisibleCondition.php b/src/DataDefinition/Palette/Condition/Property/PropertyVisibleCondition.php index 0f0ba0358..395dbae23 100644 --- a/src/DataDefinition/Palette/Condition/Property/PropertyVisibleCondition.php +++ b/src/DataDefinition/Palette/Condition/Property/PropertyVisibleCondition.php @@ -75,10 +75,10 @@ public function getPropertyName() * {@inheritdoc} */ public function match( - ModelInterface $model = null, - PropertyValueBag $input = null, - PropertyInterface $property = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBag $input = null, + ?PropertyInterface $property = null, + ?LegendInterface $legend = null ) { if (!$legend) { return false; diff --git a/src/DataDefinition/Palette/Legend.php b/src/DataDefinition/Palette/Legend.php index 3f4378e06..7ea2ade02 100644 --- a/src/DataDefinition/Palette/Legend.php +++ b/src/DataDefinition/Palette/Legend.php @@ -74,7 +74,7 @@ public function __construct($name) /** * {@inheritdoc} */ - public function setPalette(PaletteInterface $palette = null) + public function setPalette(?PaletteInterface $palette = null) { if ($this->palette) { $this->palette->removeLegend($this); @@ -148,7 +148,7 @@ public function setProperties(array $properties) /** * {@inheritdoc} */ - public function addProperties(array $properties, PropertyInterface $before = null) + public function addProperties(array $properties, ?PropertyInterface $before = null) { foreach ($properties as $property) { $this->addProperty($property, $before); @@ -161,7 +161,7 @@ public function addProperties(array $properties, PropertyInterface $before = nul * * @throws DcGeneralInvalidArgumentException When the property passed as $before can not be found. */ - public function addProperty(PropertyInterface $property, PropertyInterface $before = null) + public function addProperty(PropertyInterface $property, ?PropertyInterface $before = null) { $hash = \spl_object_hash($property); diff --git a/src/DataDefinition/Palette/LegendInterface.php b/src/DataDefinition/Palette/LegendInterface.php index 2a7a38cc2..d84f25b94 100644 --- a/src/DataDefinition/Palette/LegendInterface.php +++ b/src/DataDefinition/Palette/LegendInterface.php @@ -38,7 +38,7 @@ interface LegendInterface * * @return LegendInterface */ - public function setPalette(PaletteInterface $palette = null); + public function setPalette(?PaletteInterface $palette = null); /** * Return the palette this legend belongs to. @@ -99,22 +99,22 @@ public function setProperties(array $properties); * Add all properties to this legend. * * @param array|PropertyInterface[] $properties The properties. - * @param PropertyInterface $before The property before the passed properties shall be inserted + * @param PropertyInterface|null $before The property before the passed properties shall be inserted * (optional). * * @return LegendInterface */ - public function addProperties(array $properties, PropertyInterface $before = null); + public function addProperties(array $properties, ?PropertyInterface $before = null); /** * Add a property to this legend. * - * @param PropertyInterface $property The property. - * @param PropertyInterface $before The property before the passed property shall be inserted (optional). + * @param PropertyInterface $property The property. + * @param PropertyInterface|null $before The property before the passed property shall be inserted (optional). * * @return LegendInterface */ - public function addProperty(PropertyInterface $property, PropertyInterface $before = null); + public function addProperty(PropertyInterface $property, ?PropertyInterface $before = null); /** * Remove a property from this legend. diff --git a/src/DataDefinition/Palette/Palette.php b/src/DataDefinition/Palette/Palette.php index 67edab7ee..35b7c65d3 100644 --- a/src/DataDefinition/Palette/Palette.php +++ b/src/DataDefinition/Palette/Palette.php @@ -75,7 +75,7 @@ public function getName() /** * {@inheritdoc} */ - public function getProperties(ModelInterface $model = null, PropertyValueBag $input = null) + public function getProperties(?ModelInterface $model = null, ?PropertyValueBag $input = null) { $properties = [[]]; foreach ($this->legends as $legend) { @@ -88,7 +88,7 @@ public function getProperties(ModelInterface $model = null, PropertyValueBag $in /** * {@inheritdoc} */ - public function getVisibleProperties(ModelInterface $model = null, PropertyValueBag $input = null) + public function getVisibleProperties(?ModelInterface $model = null, ?PropertyValueBag $input = null) { $properties = []; foreach ($this->getLegends() as $legend) { @@ -105,7 +105,7 @@ public function getVisibleProperties(ModelInterface $model = null, PropertyValue /** * {@inheritdoc} */ - public function getEditableProperties(ModelInterface $model = null, PropertyValueBag $input = null) + public function getEditableProperties(?ModelInterface $model = null, ?PropertyValueBag $input = null) { $properties = []; foreach ($this->getLegends() as $legend) { @@ -164,7 +164,7 @@ public function setLegends(array $legends) /** * {@inheritdoc} */ - public function addLegends(array $legends, LegendInterface $before = null) + public function addLegends(array $legends, ?LegendInterface $before = null) { foreach ($legends as $legend) { $this->addLegend($legend, $before); @@ -200,7 +200,7 @@ public function containsLegend(LegendInterface $legend) * * @throws DcGeneralInvalidArgumentException When the legend passed as $before can not be found. */ - public function addLegend(LegendInterface $legend, LegendInterface $before = null) + public function addLegend(LegendInterface $legend, ?LegendInterface $before = null) { $hash = \spl_object_hash($legend); @@ -273,7 +273,7 @@ public function getLegends() /** * {@inheritdoc} */ - public function setCondition(PaletteConditionInterface $condition = null) + public function setCondition(?PaletteConditionInterface $condition = null) { $this->condition = $condition; diff --git a/src/DataDefinition/Palette/PaletteCollection.php b/src/DataDefinition/Palette/PaletteCollection.php index 7227a9e88..777705d1b 100644 --- a/src/DataDefinition/Palette/PaletteCollection.php +++ b/src/DataDefinition/Palette/PaletteCollection.php @@ -110,7 +110,7 @@ public function hasPalette(PaletteInterface $palette) * @throws DcGeneralInvalidArgumentException Is thrown if there is no palettes found. * @throws DcGeneralInvalidArgumentException Is thrown if there is no palette found or more than one palette. */ - public function findPalette(ModelInterface $model = null, PropertyValueBagInterface $input = null) + public function findPalette(?ModelInterface $model = null, ?PropertyValueBagInterface $input = null) { $matches = []; diff --git a/src/DataDefinition/Palette/PaletteCollectionInterface.php b/src/DataDefinition/Palette/PaletteCollectionInterface.php index a499b0a19..c7af88729 100644 --- a/src/DataDefinition/Palette/PaletteCollectionInterface.php +++ b/src/DataDefinition/Palette/PaletteCollectionInterface.php @@ -97,7 +97,7 @@ public function hasPalette(PaletteInterface $palette); * * @return PaletteInterface */ - public function findPalette(ModelInterface $model = null, PropertyValueBagInterface $input = null); + public function findPalette(?ModelInterface $model = null, ?PropertyValueBagInterface $input = null); /** * Check if a palette for the given name exists in this collection. diff --git a/src/DataDefinition/Palette/PaletteInterface.php b/src/DataDefinition/Palette/PaletteInterface.php index 2a4673256..fb175e7c4 100644 --- a/src/DataDefinition/Palette/PaletteInterface.php +++ b/src/DataDefinition/Palette/PaletteInterface.php @@ -50,32 +50,32 @@ public function getName(); /** * Get all properties from all legends in this palette. * - * @param ModelInterface|null $model If given, selectors will be evaluated depending on the model. - * @param PropertyValueBag $input If given, selectors will be evaluated depending on the input data. + * @param ModelInterface|null $model If given, selectors will be evaluated depending on the model. + * @param PropertyValueBag|null $input If given, selectors will be evaluated depending on the input data. * * @return PropertyInterface[] */ - public function getProperties(ModelInterface $model = null, PropertyValueBag $input = null); + public function getProperties(?ModelInterface $model = null, ?PropertyValueBag $input = null); /** * Get all properties from all legends in this palette that are visible. * - * @param ModelInterface|null $model If given, selectors will be evaluated depending on the model. - * @param PropertyValueBag $input If given, selectors will be evaluated depending on the input data. + * @param ModelInterface|null $model If given, selectors will be evaluated depending on the model. + * @param PropertyValueBag|null $input If given, selectors will be evaluated depending on the input data. * * @return PropertyInterface[] */ - public function getVisibleProperties(ModelInterface $model = null, PropertyValueBag $input = null); + public function getVisibleProperties(?ModelInterface $model = null, ?PropertyValueBag $input = null); /** * Get all properties from all legends in this palette that are editable. * - * @param ModelInterface|null $model If given, selectors will be evaluated depending on the model. - * @param PropertyValueBag $input If given, selectors will be evaluated depending on the input data. + * @param ModelInterface|null $model If given, selectors will be evaluated depending on the model. + * @param PropertyValueBag|null $input If given, selectors will be evaluated depending on the input data. * * @return PropertyInterface[] */ - public function getEditableProperties(ModelInterface $model = null, PropertyValueBag $input = null); + public function getEditableProperties(?ModelInterface $model = null, ?PropertyValueBag $input = null); /** * Get a property by name from this palette. @@ -108,11 +108,11 @@ public function setLegends(array $legends); * Add all legends to this palette. * * @param list $legends The legends. - * @param LegendInterface $before The legend before which the new legends shall be inserted (optional). + * @param LegendInterface|null $before The legend before which the new legends shall be inserted (optional). * * @return PaletteInterface */ - public function addLegends(array $legends, LegendInterface $before = null); + public function addLegends(array $legends, ?LegendInterface $before = null); /** * Determine if a legend with the given name exists in this palette. @@ -136,11 +136,11 @@ public function containsLegend(LegendInterface $legend); * Add a legend to this palette. * * @param LegendInterface $legend The legend to add. - * @param LegendInterface $before The legend before which the new legend shall be inserted (optional). + * @param LegendInterface|null $before The legend before which the new legend shall be inserted (optional). * * @return PaletteInterface */ - public function addLegend(LegendInterface $legend, LegendInterface $before = null); + public function addLegend(LegendInterface $legend, ?LegendInterface $before = null); /** * Remove a legend from this palette. @@ -176,7 +176,7 @@ public function getLegends(); * * @return PaletteInterface */ - public function setCondition(PaletteConditionInterface $condition = null); + public function setCondition(?PaletteConditionInterface $condition = null); /** * Get the condition bound to this palette. diff --git a/src/DataDefinition/Palette/Property.php b/src/DataDefinition/Palette/Property.php index 3b00cc9a2..d1dda68b2 100644 --- a/src/DataDefinition/Palette/Property.php +++ b/src/DataDefinition/Palette/Property.php @@ -85,9 +85,9 @@ public function getName() * {@inheritdoc} */ public function isVisible( - ModelInterface $model = null, - PropertyValueBagInterface $input = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBagInterface $input = null, + ?LegendInterface $legend = null ) { if ($this->visibleCondition) { // We should have defined the interfaces back in 2013... :/ @@ -102,9 +102,9 @@ public function isVisible( * {@inheritdoc} */ public function isEditable( - ModelInterface $model = null, - PropertyValueBagInterface $input = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBagInterface $input = null, + ?LegendInterface $legend = null ) { if ($this->editableCondition) { // We should have defined the interfaces back in 2013... :/ @@ -118,7 +118,7 @@ public function isEditable( /** * {@inheritdoc} */ - public function setVisibleCondition(PropertyConditionInterface $condition = null) + public function setVisibleCondition(?PropertyConditionInterface $condition = null) { $this->visibleCondition = $condition; @@ -136,7 +136,7 @@ public function getVisibleCondition() /** * {@inheritdoc} */ - public function setEditableCondition(PropertyConditionInterface $condition = null) + public function setEditableCondition(?PropertyConditionInterface $condition = null) { $this->editableCondition = $condition; diff --git a/src/DataDefinition/Palette/PropertyInterface.php b/src/DataDefinition/Palette/PropertyInterface.php index e88b3bd25..8032d6904 100644 --- a/src/DataDefinition/Palette/PropertyInterface.php +++ b/src/DataDefinition/Palette/PropertyInterface.php @@ -62,9 +62,9 @@ public function getName(); * @return bool */ public function isVisible( - ModelInterface $model = null, - PropertyValueBagInterface $input = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBagInterface $input = null, + ?LegendInterface $legend = null ); /** @@ -77,24 +77,24 @@ public function isVisible( * data. * If no model and no input data is given, all properties will be * returned, including sub palette properties. - * @param LegendInterface $legend The legend the property is assigned to. + * @param LegendInterface|null $legend The legend the property is assigned to. * * @return bool */ public function isEditable( - ModelInterface $model = null, - PropertyValueBagInterface $input = null, - LegendInterface $legend = null + ?ModelInterface $model = null, + ?PropertyValueBagInterface $input = null, + ?LegendInterface $legend = null ); /** * Set the visible condition for this property. * - * @param PropertyConditionInterface $condition The condition. + * @param PropertyConditionInterface|null $condition The condition. * * @return PropertyInterface */ - public function setVisibleCondition(PropertyConditionInterface $condition = null); + public function setVisibleCondition(?PropertyConditionInterface $condition = null); /** * Get the visible condition for this property. @@ -106,11 +106,11 @@ public function getVisibleCondition(); /** * Set the editable condition for this property. * - * @param PropertyConditionInterface $condition The condition. + * @param PropertyConditionInterface|null $condition The condition. * * @return PropertyInterface */ - public function setEditableCondition(PropertyConditionInterface $condition = null); + public function setEditableCondition(?PropertyConditionInterface $condition = null); /** * Get the editable condition for this property. diff --git a/src/Event/EnforceModelRelationshipEvent.php b/src/Event/EnforceModelRelationshipEvent.php index ceb23c608..9599b9006 100644 --- a/src/Event/EnforceModelRelationshipEvent.php +++ b/src/Event/EnforceModelRelationshipEvent.php @@ -53,8 +53,8 @@ class EnforceModelRelationshipEvent extends AbstractModelAwareEvent public function __construct( EnvironmentInterface $environment, ModelInterface $model, - ModelInterface $parentModel = null, - ModelInterface $rootModel = null + ?ModelInterface $parentModel = null, + ?ModelInterface $rootModel = null ) { parent::__construct($environment, $model); diff --git a/src/Event/PostPersistModelEvent.php b/src/Event/PostPersistModelEvent.php index 76f01f276..36996367c 100644 --- a/src/Event/PostPersistModelEvent.php +++ b/src/Event/PostPersistModelEvent.php @@ -48,7 +48,7 @@ class PostPersistModelEvent extends AbstractModelAwareEvent public function __construct( EnvironmentInterface $environment, ModelInterface $model, - ModelInterface $originalModel = null + ?ModelInterface $originalModel = null ) { parent::__construct($environment, $model); diff --git a/src/Event/PrePersistModelEvent.php b/src/Event/PrePersistModelEvent.php index 496cd9a80..a80ef5e2c 100644 --- a/src/Event/PrePersistModelEvent.php +++ b/src/Event/PrePersistModelEvent.php @@ -48,7 +48,7 @@ class PrePersistModelEvent extends AbstractModelAwareEvent public function __construct( EnvironmentInterface $environment, ModelInterface $model, - ModelInterface $originalModel = null + ?ModelInterface $originalModel = null ) { parent::__construct($environment, $model); diff --git a/src/EventListener/StoreRefererListener.php b/src/EventListener/StoreRefererListener.php index a14af5386..dcf69d510 100644 --- a/src/EventListener/StoreRefererListener.php +++ b/src/EventListener/StoreRefererListener.php @@ -84,6 +84,9 @@ public function __invoke(ResponseEvent $event): void $session = $request->getSession(); $key = $request->query->has('popup') ? 'popupReferer' : 'referer'; $refererId = $request->attributes->get('_contao_referer_id'); + if (null === $refererId) { + return; + } $referers = $this->prepareBackendReferer($refererId, $session->get($key)); $ref = (string) $request->query->get('ref', ''); diff --git a/src/Exception/DefinitionException.php b/src/Exception/DefinitionException.php index 0e45aa04a..16bbc29ca 100644 --- a/src/Exception/DefinitionException.php +++ b/src/Exception/DefinitionException.php @@ -50,7 +50,7 @@ class DefinitionException extends DcGeneralRuntimeException * @param int $code The error code. * @param \Exception|null $previous The previous exception. */ - public function __construct($definitionName, $code = 0, \Exception $previous = null) + public function __construct($definitionName, $code = 0, ?\Exception $previous = null) { $this->name = $definitionName; diff --git a/src/Factory/DcGeneralFactory.php b/src/Factory/DcGeneralFactory.php index 519fd3dfb..6626093c2 100644 --- a/src/Factory/DcGeneralFactory.php +++ b/src/Factory/DcGeneralFactory.php @@ -58,7 +58,7 @@ class DcGeneralFactory implements DcGeneralFactoryInterface * * @param CacheInterface|null $cache The cache. */ - public function __construct(CacheInterface $cache = null) + public function __construct(?CacheInterface $cache = null) { if (null === $cache) { // @codingStandardsIgnoreStart @@ -299,7 +299,7 @@ public function getTranslator() /** * {@inheritdoc} */ - public function setEnvironment(EnvironmentInterface $environment = null) + public function setEnvironment(?EnvironmentInterface $environment = null) { $this->environment = $environment; @@ -317,7 +317,7 @@ public function getEnvironment() /** * {@inheritdoc} */ - public function setDataContainer(ContainerInterface $dataContainer = null) + public function setDataContainer(?ContainerInterface $dataContainer = null) { $this->dataContainer = $dataContainer; diff --git a/src/Panel/DefaultPanel.php b/src/Panel/DefaultPanel.php index 2db61511d..ee8d82a67 100644 --- a/src/Panel/DefaultPanel.php +++ b/src/Panel/DefaultPanel.php @@ -95,7 +95,7 @@ public function getElement($elementName) /** * {@inheritdoc} */ - public function initialize(ConfigInterface $config, PanelElementInterface $element = null) + public function initialize(ConfigInterface $config, ?PanelElementInterface $element = null) { /** @var PanelElementInterface $currentElement */ foreach ($this as $currentElement) { diff --git a/src/View/ActionHandler/AbstractPropertyVisibilityHandler.php b/src/View/ActionHandler/AbstractPropertyVisibilityHandler.php index e826b6748..7fa724c63 100644 --- a/src/View/ActionHandler/AbstractPropertyVisibilityHandler.php +++ b/src/View/ActionHandler/AbstractPropertyVisibilityHandler.php @@ -788,7 +788,7 @@ private function useIntersectValue( $intersectPropertyName, array $legendPropertyNames, EnvironmentInterface $environment, - PaletteInterface $defaultPalette = null + ?PaletteInterface $defaultPalette = null ): bool { $propertiesDefinition = $this->getDataDefinition($environment)->getPropertiesDefinition(); $useIntersectValue = (bool) $defaultPalette; @@ -894,7 +894,7 @@ private function intersectModelSetParentId(ModelInterface $intersectModel, Envir private function getLegendPropertyNames( ModelInterface $intersectModel, EnvironmentInterface $environment, - PaletteInterface &$defaultPalette = null + ?PaletteInterface &$defaultPalette = null ): array { $inputProvider = $this->getInputProvider($environment); $palettesDefinition = $this->getDataDefinition($environment)->getPalettesDefinition(); diff --git a/tests/Clipboard/MockedAbstractItem.php b/tests/Clipboard/MockedAbstractItem.php index ee4e14ad0..29cbbf111 100644 --- a/tests/Clipboard/MockedAbstractItem.php +++ b/tests/Clipboard/MockedAbstractItem.php @@ -54,7 +54,7 @@ class MockedAbstractItem extends AbstractItem * * @SuppressWarnings(PHPMD.LongVariable) */ - public function __construct($action, ModelIdInterface $parentId = null, $modelIdOrProviderName = null) + public function __construct($action, ?ModelIdInterface $parentId = null, $modelIdOrProviderName = null) { parent::__construct($action, $parentId);