Skip to content

Replace dirname( __FILE__ ) calls with __DIR__ magic constant#187

Merged
peterwilsoncc merged 2 commits into10up:developfrom
Soean:dir_constant
Mar 14, 2025
Merged

Replace dirname( __FILE__ ) calls with __DIR__ magic constant#187
peterwilsoncc merged 2 commits into10up:developfrom
Soean:dir_constant

Conversation

@Soean
Copy link
Copy Markdown
Contributor

@Soean Soean commented Mar 13, 2025

Description of the Change

PHP 5.3 introduced the magic constant __DIR__ which is equivalent to dirname( __FILE__ ) and more efficient to use.

Changelog Entry

Developer - Replace dirname( __FILE__ ) calls with __DIR__ magic constant.

Credits

Props @Soean

Checklist:

@Soean Soean requested review from dkotter and jeffpaul as code owners March 13, 2025 17:46
@jeffpaul jeffpaul added this to the 1.5.0 milestone Mar 13, 2025
@jeffpaul jeffpaul requested review from peterwilsoncc and removed request for dkotter and jeffpaul March 13, 2025 17:47
@jeffpaul jeffpaul moved this to Code Review in Open Source Practice Mar 13, 2025
Copy link
Copy Markdown
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

This looks good to me, thank you!

I've confirmed this covers all the instances in which the pattern is used.

@github-project-automation github-project-automation Bot moved this from Code Review to QA Testing in Open Source Practice Mar 14, 2025
@peterwilsoncc peterwilsoncc merged commit f215730 into 10up:develop Mar 14, 2025
@github-project-automation github-project-automation Bot moved this from QA Testing to Done in Open Source Practice Mar 14, 2025
@Soean Soean deleted the dir_constant branch March 14, 2025 06:51
@dkotter dkotter modified the milestones: 1.5.0, 1.4.6 Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants