Skip to content

Create Plugin action should default to no sortOrder #385

@Vinai

Description

@Vinai

The sortOrder value for plugins can be used to enforce plugin execution order.
If there is no need for a specific plugin execution order, the value of sortOrder is meaningless.
The correct values of sortOrder for plugins to resolve a problem can only be determined on a case by case basis.

A typical example where a sortOrder is required, is a when two Magento modules are installed together that do not usually go together, and one plugin interferes with the other (maybe an aroundPlugin doesn't always call $proceed, which should also prevent the other plugin from execution).
In such a case one solution is to create a conflict resolution module to set the correct sortOrder on both the plugins through configuration merging.
However, until such time, there is no "correct" value for a plugin sortOrder, since it always has to be in relation to the sortOrder value of one or more other specific plugins.

For this reason, instead of defaulting to a meaningless value of 10 and enforcing the sortOrder value to be set in the "Create Plugin" PHPStorm action, I suggest leaving the input field empty by default and not enforcing it.
When no value is set, the sortOrder attribute should be omitted in the resulting XML.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions