close
Skip to content

Last 3.x minor | Arrays/ArrayDeclarationSpacing: hard-deprecate the allow_single_item_single_line_associative_arrays property #2704

@rodrigoprimo

Description

@rodrigoprimo

The allow_single_item_single_line_associative_arrays property was soft-deprecated in #2696 (docblock and changelog only) in favor of the new allow_single_item_single_line_explicit_key_arrays property.

In the last WPCS 3.x release before 4.0, a runtime deprecation warning should be added to notify users still relying on the old property name.

Implementation notes

The pre-2.0 deprecation pattern (see #2691) used $phpcsFile->addWarning() at line 0 to issue a deprecation notice when the old property was changed from its default value.

However, since this is a boolean property with a default of true, checking true !== $this->old_property_name won't catch cases where the old property is explicitly set to its default value. As suggested in #2691 (comment), it may be worth investigating whether making the old property private and using magic methods could solve this detection problem.

To gauge the impact, consider doing some code searches for XML files containing the text allow_single_item_single_line_associative_arrays and potentially submitting PRs to the few repos using the property.

Related: #2691, #2696, #2705

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions