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

Core: add sniff to enforce the use of __DIR__ instead of dirname(__FILE__) #2137

Merged
merged 1 commit into from
Dec 8, 2022

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Dec 8, 2022

Related to previous efforts which already fixed all instances of this in WP Core.

The sniff from PHPCSExtra includes an auto-fixer for the issue.

Note: the sniff from PHPCSExtra also contains a check for nested dirname() function calls. This check is not (yet) enabled as the fix for this requires PHP 7.0+.

Fixes #1954

Refs:

Related to WP Core tickets:

…LE__)

Related to previous efforts which already fixed all instances of this in WP Core.

The sniff from PHPCSExtra includes an auto-fixer for the issue.

Note: the sniff from PHPCSExtra also contains a check for nested `dirname()` function calls. This check is not (yet) enabled as the fix for this requires PHP 7.0+.

Fixes 1954

Refs:
* PHPCSStandards/PHPCSExtra 172
* PHPCSStandards/PHPCSExtra 187

Related to WP Core tickets:
* https://core.trac.wordpress.org/ticket/48082
* https://core.trac.wordpress.org/changeset/47198
Copy link
Member

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

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

@dingo-d dingo-d merged commit d0defe8 into develop Dec 8, 2022
@dingo-d dingo-d deleted the feature/core-modernize-dirname-use-sniff branch December 8, 2022 12:34
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.

Prefer __DIR__ to dirname( __FILE__ )
3 participants