Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .phpcq.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ phpcq:
# psalm
- 8A03EA3B385DBAA1
- 12CE0F1D262429A5
- 99BF4D9A33D65E1E
# magl@magll.net
- D2CCAC42F6295E7D
# PHP_CodeSniffer
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/Http/InvalidateCacheTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Contao/Compatibility/DcCompat.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* @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)

Check warning on line 64 in src/Contao/Compatibility/DcCompat.php

View workflow job for this annotation

GitHub Actions / PHP: 8.2 Contao: ~5.3.0

Line exceeds 120 characters; contains 127 characters (reported by phpcs: Generic.Files.LineLength.TooLong)

Check warning on line 64 in src/Contao/Compatibility/DcCompat.php

View workflow job for this annotation

GitHub Actions / PHP: 8.3 Contao: ~5.3.0

Line exceeds 120 characters; contains 127 characters (reported by phpcs: Generic.Files.LineLength.TooLong)

Check warning on line 64 in src/Contao/Compatibility/DcCompat.php

View workflow job for this annotation

GitHub Actions / PHP: 8.2 Contao: ~5.3.0

Line exceeds 120 characters; contains 127 characters (reported by phpcs: Generic.Files.LineLength.TooLong)

Check warning on line 64 in src/Contao/Compatibility/DcCompat.php

View workflow job for this annotation

GitHub Actions / PHP: 8.3 Contao: ~5.3.0

Line exceeds 120 characters; contains 127 characters (reported by phpcs: Generic.Files.LineLength.TooLong)
{
// 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Contao/Picker/AbstractAwarePickerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/Contao/Picker/PagePickerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Contao/Picker/TreePickerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Contao/Subscriber/FormatModelLabelSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions src/Contao/View/Contao2BackendView/ContaoWidgetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@
/**
* 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
*
Expand All @@ -284,7 +284,7 @@
* @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();
Expand Down Expand Up @@ -401,16 +401,16 @@
/**
* 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.

Check warning on line 404 in src/Contao/View/Contao2BackendView/ContaoWidgetManager.php

View workflow job for this annotation

GitHub Actions / PHP: 8.2 Contao: ~5.3.0

Line exceeds 120 characters; contains 123 characters (reported by phpcs: Generic.Files.LineLength.TooLong)

Check warning on line 404 in src/Contao/View/Contao2BackendView/ContaoWidgetManager.php

View workflow job for this annotation

GitHub Actions / PHP: 8.3 Contao: ~5.3.0

Line exceeds 120 characters; contains 123 characters (reported by phpcs: Generic.Files.LineLength.TooLong)

Check warning on line 404 in src/Contao/View/Contao2BackendView/ContaoWidgetManager.php

View workflow job for this annotation

GitHub Actions / PHP: 8.2 Contao: ~5.3.0

Line exceeds 120 characters; contains 123 characters (reported by phpcs: Generic.Files.LineLength.TooLong)

Check warning on line 404 in src/Contao/View/Contao2BackendView/ContaoWidgetManager.php

View workflow job for this annotation

GitHub Actions / PHP: 8.3 Contao: ~5.3.0

Line exceeds 120 characters; contains 123 characters (reported by phpcs: Generic.Files.LineLength.TooLong)
* @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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/Controller/ControllerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@
*
* 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.

Check warning on line 185 in src/Controller/ControllerInterface.php

View workflow job for this annotation

GitHub Actions / PHP: 8.2 Contao: ~5.3.0

Line exceeds 120 characters; contains 123 characters (reported by phpcs: Generic.Files.LineLength.TooLong)

Check warning on line 185 in src/Controller/ControllerInterface.php

View workflow job for this annotation

GitHub Actions / PHP: 8.3 Contao: ~5.3.0

Line exceeds 120 characters; contains 123 characters (reported by phpcs: Generic.Files.LineLength.TooLong)

Check warning on line 185 in src/Controller/ControllerInterface.php

View workflow job for this annotation

GitHub Actions / PHP: 8.2 Contao: ~5.3.0

Line exceeds 120 characters; contains 123 characters (reported by phpcs: Generic.Files.LineLength.TooLong)

Check warning on line 185 in src/Controller/ControllerInterface.php

View workflow job for this annotation

GitHub Actions / PHP: 8.3 Contao: ~5.3.0

Line exceeds 120 characters; contains 123 characters (reported by phpcs: Generic.Files.LineLength.TooLong)
*
* @return CollectionInterface
*/
public function getModelsFromClipboard(ModelIdInterface $parentModelId = null);
public function getModelsFromClipboard(?ModelIdInterface $parentModelId = null);

/**
* Evaluate clipboard items, then return the corresponding models.
Expand All @@ -201,11 +201,11 @@
* @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 = []
);

Expand All @@ -218,7 +218,7 @@
*
* @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.
Expand Down
54 changes: 27 additions & 27 deletions src/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
protected function assembleSiblingsFor(
ModelInterface $model,
$sortingProperty = null,
ModelIdInterface $parentId = null
?ModelIdInterface $parentId = null
) {
// @codingStandardsIgnoreStart
@trigger_error(
Expand Down Expand Up @@ -559,7 +559,7 @@
/**
* {@inheritDoc}
*/
public function getModelsFromClipboard(ModelIdInterface $parentModelId = null)
public function getModelsFromClipboard(?ModelIdInterface $parentModelId = null)
{
$environment = $this->getEnvironment();

Expand Down Expand Up @@ -588,12 +588,12 @@
* {@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,

Check failure on line 595 in src/Controller/DefaultController.php

View workflow job for this annotation

GitHub Actions / PHP: 8.2 Contao: ~5.3.0

Expected 1 space between type hint and argument "$filter"; 2 found (reported by phpcs: Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint)

Check failure on line 595 in src/Controller/DefaultController.php

View workflow job for this annotation

GitHub Actions / PHP: 8.3 Contao: ~5.3.0

Expected 1 space between type hint and argument "$filter"; 2 found (reported by phpcs: Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint)

Check failure on line 595 in src/Controller/DefaultController.php

View workflow job for this annotation

GitHub Actions / PHP: 8.2 Contao: ~5.3.0

Expected 1 space between type hint and argument "$filter"; 2 found (reported by phpcs: Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint)

Check failure on line 595 in src/Controller/DefaultController.php

View workflow job for this annotation

GitHub Actions / PHP: 8.3 Contao: ~5.3.0

Expected 1 space between type hint and argument "$filter"; 2 found (reported by phpcs: Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint)
array &$items = [],
) {
if ($source) {
$actions = $this->getActionsFromSource($source, $parentModelId);
Expand All @@ -614,7 +614,7 @@
*
* @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);
Expand Down Expand Up @@ -662,7 +662,7 @@
*
* @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);
Expand Down Expand Up @@ -721,9 +721,9 @@
*/
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) {
Expand Down Expand Up @@ -765,7 +765,7 @@
* @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'];
Expand Down Expand Up @@ -842,7 +842,7 @@
*
* @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);
Expand Down Expand Up @@ -876,9 +876,9 @@
*/
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);
Expand Down Expand Up @@ -906,7 +906,7 @@
*
* @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());
Expand All @@ -930,7 +930,7 @@
*
* @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());
Expand Down Expand Up @@ -958,9 +958,9 @@
*/
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()
Expand All @@ -987,12 +987,12 @@
/**
* 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());
Expand Down Expand Up @@ -1177,7 +1177,7 @@
/**
* {@inheritDoc}
*/
public function pasteTop(CollectionInterface $models, $sortedBy, ModelIdInterface $parentId = null)
public function pasteTop(CollectionInterface $models, $sortedBy, ?ModelIdInterface $parentId = null)
{
$environment = $this->getEnvironment();

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ModelCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/SortingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading
Loading