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

Exclude get_theme_file_path from WordPressVIPMinimum.Files.IncludingFile.UsingCustomFunction warning #689

Closed
kshaner opened this issue Jun 7, 2021 · 1 comment

Comments

@kshaner
Copy link
Contributor

kshaner commented Jun 7, 2021

What problem would the enhancement address for VIP?

The function get_theme_file_path should not trigger as a warning when including files. get_theme_file_path uses get_stylesheet_directory and get_template_directory in the function which are both already allowed.

Describe the solution you'd like

Add get_theme_file_path to the $getPathFunctions property of the WordPressVIPMinimum\Sniffs\Files\IncludingFileSniff sniff.

What code should be reported as a violation?

N/A

What code should not be reported as a violation?

require_once get_theme_file_path( 'includes/custom-theme-file.php' );
@GaryJones
Copy link
Contributor

List of recognised functions for defining a path:

public $getPathFunctions = [
'plugin_dir_path',
'dirname',
'get_stylesheet_directory',
'get_template_directory',
'locate_template',
'get_parent_theme_file_path',
];

Developer docs for the suggested get_theme_file_path function: https://developer.wordpress.org/reference/functions/get_theme_file_path/

I have to agree - I see no reason not to include 'get_theme_file_path' in the list of $getPathFunctions.

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

No branches or pull requests

4 participants