diff --git a/WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php b/WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php index 3c4804d0..5d294a6b 100644 --- a/WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php +++ b/WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php @@ -26,10 +26,30 @@ class IncludingFileSniff extends AbstractFunctionRestrictionsSniff { */ public $getPathFunctions = [ 'dirname', + 'get_404_template', + 'get_archive_template', + 'get_attachment_template', + 'get_author_template', + 'get_category_template', + 'get_date_template', + 'get_embed_template', + 'get_front_page_template', + 'get_page_template', + 'get_paged_template', // Deprecated, but should still be accepted for the purpose of this sniff. + 'get_home_template', + 'get_index_template', 'get_parent_theme_file_path', + 'get_privacy_policy_template', + 'get_query_template', + 'get_search_template', + 'get_single_template', + 'get_singular_template', 'get_stylesheet_directory', + 'get_tag_template', + 'get_taxonomy_template', 'get_template_directory', 'get_theme_file_path', + 'locate_block_template', 'locate_template', 'plugin_dir_path', ]; diff --git a/WordPressVIPMinimum/Tests/Files/IncludingFileUnitTest.inc b/WordPressVIPMinimum/Tests/Files/IncludingFileUnitTest.inc index 63dcf460..032eefd0 100644 --- a/WordPressVIPMinimum/Tests/Files/IncludingFileUnitTest.inc +++ b/WordPressVIPMinimum/Tests/Files/IncludingFileUnitTest.inc @@ -34,4 +34,9 @@ include_once dir_function(); // Error - custom functionm with keyword from $al require CUSTOM_CONSTANT_DIR . 'file.php'; // OK. require_once ( VIPCS_PATH ) . 'file.php'; // OK. include_once - DIR_CUSTOM , 'file.php'; // OK. \ No newline at end of file + DIR_CUSTOM , 'file.php'; // OK. + +// These are valid (previously false positives). +include( get_404_template() ); +require get_query_template( 'post' ); +include_once locate_block_template( __DIR__, 'silly_block' );