Skip to content

Commit d375b71

Browse files
author
Marc Reimann
committed
Fix deprecations
1 parent 4bebdc0 commit d375b71

51 files changed

Lines changed: 207 additions & 196 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
},
9393
"extra": {
9494
"branch-alias": {
95-
"dev-release/2.4.0": "2.4.x-dev"
95+
"dev-feature/symfony-7": "2.5.x-dev"
9696
},
9797
"contao-manager-plugin": "ContaoCommunityAlliance\\DcGeneral\\ContaoManager\\Plugin"
9898
}

src/Cache/Http/InvalidateCacheTags.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ class InvalidateCacheTags implements InvalidateCacheTagsInterface
7070
*
7171
* @param string $namespace The http cache namespace.
7272
* @param EventDispatcherInterface $dispatcher The event dispatcher.
73-
* @param CacheInvalidator|null $cacheManager The http cache manager.
73+
* @param CacheInvalidator|null $cacheManager The http cache manager.
7474
*/
7575
public function __construct(
7676
string $namespace,
7777
EventDispatcherInterface $dispatcher,
78-
CacheInvalidator $cacheManager = null
78+
?CacheInvalidator $cacheManager = null
7979
) {
8080
$this->namespace = $namespace;
8181
$this->dispatcher = $dispatcher;

src/Contao/Compatibility/DcCompat.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ class DcCompat extends General
5858
* Create a new instance.
5959
*
6060
* @param EnvironmentInterface $environment The Dc instance to use for delegating.
61-
* @param ModelInterface|null $model The model within scope (optional).
61+
* @param ModelInterface|null $model The model within scope (optional).
6262
* @param string|null $propertyName The name of the property within scope (optional).
6363
*/
64-
public function __construct(EnvironmentInterface $environment, ModelInterface $model = null, $propertyName = null)
64+
public function __construct(EnvironmentInterface $environment, ?ModelInterface $model = null, $propertyName = null)
6565
{
6666
// Prevent "Recoverable error: Argument X passed to SomClass::someMethod() must be an instance of DataContainer,
6767
// instance of ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat given" in callbacks.

src/Contao/Dca/Builder/Legacy/LegacyDcaDataDefinitionBuilder.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,10 @@ protected function parseBackendView(ContainerInterface $container)
763763
$this->parsePanel($view);
764764
$this->parseGlobalOperations($view);
765765
$this->parseModelOperations($view);
766+
767+
// Contao 5.7 handling.
768+
// $builder = \Contao\System::getContainer()->get('contao.data_container.operations_builder');
769+
// $operationDca = $builder->initializeWithButtons($container->getName(), [], );
766770
}
767771

768772
/**
@@ -1203,6 +1207,10 @@ protected function parseModelOperations(Contao2BackendViewDefinitionInterface $v
12031207
$collection = $view->getModelCommands();
12041208

12051209
foreach ($operationsDca as $operationName => $operationDca) {
1210+
if (is_string($operationDca)) {
1211+
continue;
1212+
}
1213+
assert(is_array($operationDca));
12061214
$command = $this->createCommand($operationName, $operationDca);
12071215
$collection->addCommand($command);
12081216
}

src/Contao/Picker/AbstractAwarePickerProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected function getUser()
156156
*
157157
* @return array
158158
*/
159-
abstract protected function getRouteParameters(PickerConfig $config = null);
159+
abstract protected function getRouteParameters(?PickerConfig $config = null);
160160

161161
/**
162162
* Generates the URL for the picker.

src/Contao/Picker/PagePickerProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function supportsValue(PickerConfig $config): bool
108108
/**
109109
* {@inheritdoc}
110110
*/
111-
public function getDcaTable(PickerConfig $config = null): string
111+
public function getDcaTable(?PickerConfig $config = null): string
112112
{
113113
return 'tl_page';
114114
}

src/Contao/Picker/TreePickerProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function convertDcaValue(PickerConfig $config, mixed $value): int|string
110110
/**
111111
* {@inheritdoc}
112112
*/
113-
protected function getRouteParameters(PickerConfig $config = null)
113+
protected function getRouteParameters(?PickerConfig $config = null)
114114
{
115115
return ['do' => 'tree'];
116116
}

src/Contao/Subscriber/FormatModelLabelSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function handleFormatModelLabel(FormatModelLabelEvent $event)
110110
*
111111
* @return string
112112
*/
113-
private function getFirstSorting(GroupAndSortingDefinitionInterface $sortingDefinition = null)
113+
private function getFirstSorting(?GroupAndSortingDefinitionInterface $sortingDefinition = null)
114114
{
115115
if (null === $sortingDefinition) {
116116
return '';

src/Contao/View/Contao2BackendView/ActionHandler/MultipleHandler/OverrideAllHandler.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private function process(Action $action, EnvironmentInterface $environment)
147147
* Handle invalid property value bag.
148148
*
149149
* @param PropertyValueBagInterface|null $propertyValueBag The property value bag.
150-
* @param ModelInterface|null $model The model.
150+
* @param ModelInterface|null $model The model.
151151
* @param EnvironmentInterface $environment The environment.
152152
*
153153
* @return void
@@ -157,9 +157,9 @@ private function process(Action $action, EnvironmentInterface $environment)
157157
* @SuppressWarnings(PHPMD.LongVariable)
158158
*/
159159
protected function handleInvalidPropertyValueBag(
160-
PropertyValueBagInterface $propertyValueBag = null,
161-
ModelInterface $model = null,
162-
EnvironmentInterface $environment
160+
?PropertyValueBagInterface $propertyValueBag = null,
161+
?ModelInterface $model = null,
162+
EnvironmentInterface $environment
163163
) {
164164
// @codingStandardsIgnoreStart
165165
@\trigger_error('This function where remove in 3.0. ' . __CLASS__ . '::' . __FUNCTION__, E_USER_DEPRECATED);
@@ -210,16 +210,16 @@ protected function handleInvalidPropertyValueBag(
210210
*
211211
* @param Action $action The action.
212212
* @param \ArrayObject $renderInformation The render information.
213-
* @param PropertyValueBagInterface $propertyValues The property values.
213+
* @param PropertyValueBagInterface|null $propertyValues The property values.
214214
* @param EnvironmentInterface $environment The environment.
215215
*
216216
* @return void
217217
*/
218218
private function handleOverrideCollection(
219-
Action $action,
220-
\ArrayObject $renderInformation,
221-
PropertyValueBagInterface $propertyValues = null,
222-
EnvironmentInterface $environment
219+
Action $action,
220+
\ArrayObject $renderInformation,
221+
?PropertyValueBagInterface $propertyValues = null,
222+
EnvironmentInterface $environment
223223
) {
224224
if (!$propertyValues) {
225225
return;

src/Contao/View/Contao2BackendView/ActionHandler/ToggleHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function handleEvent(ActionEvent $event)
101101
*
102102
* @param EnvironmentInterface $environment The environment.
103103
* @param ToggleCommandInterface $operation The operation.
104-
* @param ModelIdInterface|null $modelId The model id.
104+
* @param ModelIdInterface|null $modelId The model id.
105105
*
106106
* @return void
107107
*
@@ -112,7 +112,7 @@ public function handleEvent(ActionEvent $event)
112112
protected function process(
113113
EnvironmentInterface $environment,
114114
ToggleCommandInterface $operation,
115-
ModelIdInterface $modelId = null
115+
?ModelIdInterface $modelId = null
116116
) {
117117
$dataProvider = $environment->getDataProvider();
118118
assert($dataProvider instanceof DataProviderInterface);

0 commit comments

Comments
 (0)