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

New "DateTime.RestrictedFunctions" sniff #1807

Merged
merged 1 commit into from Oct 27, 2019

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Oct 5, 2019

This introduces a new WordPress.DateTime.RestrictedFunctions sniff which initially includes two groups:

  • timezone_change - moved from the WordPress.WP.TimezoneChange sniff
  • date - moved from the WordPress.PHP.RestrictedPHPFunctions sniff (group not yet in a released WPCS version yet)

The WordPress.WP.TimezoneChange sniff is now deprecated.

  • The sniff is no longer included in the WPCS rulesets.
  • If the sniff is explicitly included via a custom ruleset, deprecation notices will be thrown.
  • If the exclude property is set from with a custom ruleset, a deprecation notice will be thrown.

The new sniff is now included in the Core ruleset.

Note: once WP Core upgrades, the one instance of using date_default_timezone_set() in WP Core (in wp-settings.php) will need to be whitelisted inline.
There are a few more occurrences in the unit tests, but those can be ignored via file based excludes.

Fixes #1805

WordPress/Sniffs/WP/TimezoneChangeSniff.php Outdated Show resolved Hide resolved
This introduces a new `WordPress.DateTime.RestrictedFunctions` sniff which initially includes two groups:
* `timezone_change` - moved from the `WordPress.WP.TimezoneChange` sniff
* `date` - moved from the `WordPress.PHP.RestrictedPHPFunctions` sniff (group not yet in a released WPCS version yet)

The `WordPress.WP.TimezoneChange` sniff is now deprecated.
* The sniff is no longer included in the WPCS rulesets.
* If the sniff is explicitly included via a custom ruleset, deprecation notices will be thrown.
* If the `exclude` property is set from with a custom ruleset, a deprecation notice will be thrown.

The new sniff is now included in the `Core` ruleset.

Note: once WP Core upgrades, the one instance of using `date_default_timezone_set()` in WP Core (in `wp-settings.php`) will need to be whitelisted inline.
There are a few more occurrences in the unit tests, but those can be ignored via file based excludes.

Fixes 1805
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New category: DateTime (WPCS 2.2.0)
3 participants