Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the order of required vars PHP8 #18

Merged
merged 2 commits into from
Jun 10, 2022
Merged
Changes from 1 commit
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
42 changes: 21 additions & 21 deletions src/Model/Template/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,32 +73,32 @@ public function __construct(
CssInliner $cssInliner,
\Magento\Widget\Model\ResourceModel\Widget $widgetResource,
Widget $widget,
$variables = [],
array $directiveProcessors = [],
array $availableFilters,
array $widgetUnescapedParams,
array $widgetCustomParamsHandlers
array $widgetCustomParamsHandlers,
$variables = [],
array $directiveProcessors = []
) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you have changed the order of the parameters of the constructor.
But did you check where this class is created? Does it break since arguments are passed in the wrong order? :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional arguments aren't necessary here.
Please return the order of arguments and remove the default values.
Then add a fallback for arguments, that had a default value, when you pass them to the parent constructor.
See the line 101 as the example.

parent::__construct(
$string,
$logger,
$escaper,
$assetRepo,
$scopeConfig,
$coreVariableFactory,
$storeManager,
$layout,
$layoutFactory,
$appState,
$urlModel,
$configVariables,
$variableResolver,
$cssProcessor,
$pubDirectory,
$cssInliner,
$widgetResource,
$widget,
$variables ?? [],
$logger,
$escaper,
$assetRepo,
$scopeConfig,
$coreVariableFactory,
$storeManager,
$layout,
$layoutFactory,
$appState,
$urlModel,
$configVariables,
$variableResolver,
$cssProcessor,
$pubDirectory,
$cssInliner,
$widgetResource,
$widget,
$variables ?? [],
$directiveProcessors
);

Expand Down