-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as not planned
Closed as not planned
Copy link
Description
PR #2154 added support for array properties being extended, however it appears that this doesn't work when an array property already has a default value set.
If we take the original example of the Generic.PHP.ForbiddenFunctions sniff, it all works correctly if you overrule the forbiddenFunctions property in a standard and then extend it from a project-based ruleset.
However, if you want to extend the default values of the forbiddenFunctions property:
public $forbiddenFunctions = [
'sizeof' => 'count',
'delete' => 'unset',
];either via a standard or a project ruleset:
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array" extend="true">
<element key="foo" value="fixedFoo"/>
<element key="bar" value="fixedBar"/>
</property>
</properties>
</rule>You end up with:
public $forbiddenFunctions = [
'foo' => 'fixedFoo',
'bar' => 'fixedBar',
];instead of the expected:
public $forbiddenFunctions = [
'sizeof' => 'count',
'delete' => 'unset',
'foo' => 'fixedFoo',
'bar' => 'fixedBar',
];@Majkl578 Any thoughts on this ?
Related #2153
mwgamble
Metadata
Metadata
Assignees
Type
Projects
Status
Ready for Release