@@ -181,7 +181,7 @@ private static function extract_subdir_path( $index_path ) {
181181 $ wp_path_src = $ matches [1 ] . $ matches [2 ];
182182 $ wp_path_src = Utils \replace_path_consts ( $ wp_path_src , $ index_path );
183183
184- $ wp_path = eval ( "return $ wp_path_src; " ); // phpcs:ignore Squiz.PHP.Eval.Discouraged -- @codingStandardsIgnoreLine
184+ $ wp_path = eval ( "return $ wp_path_src; " ); // phpcs:ignore Squiz.PHP.Eval.Discouraged
185185
186186 if ( ! Utils \is_path_absolute ( $ wp_path ) ) {
187187 $ wp_path = dirname ( $ index_path ) . "/ $ wp_path " ;
@@ -239,6 +239,7 @@ private function find_wp_root() {
239239 */
240240 private static function set_wp_root ( $ path ) {
241241 if ( ! defined ( 'ABSPATH ' ) ) {
242+ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- Declaring a WP native constant.
242243 define ( 'ABSPATH ' , Utils \normalize_path ( Utils \trailingslashit ( $ path ) ) );
243244 } elseif ( ! is_null ( $ path ) ) {
244245 WP_CLI ::error_multi_line (
@@ -856,15 +857,13 @@ private function check_wp_version() {
856857
857858 $ minimum_version = '3.7 ' ;
858859
859- // @codingStandardsIgnoreStart
860860 if ( version_compare ( $ wp_version , $ minimum_version , '< ' ) ) {
861861 WP_CLI ::error (
862862 "WP-CLI needs WordPress $ minimum_version or later to work properly. " .
863863 "The version currently installed is $ wp_version. \n" .
864864 'Try running `wp core download --force`. '
865865 );
866866 }
867- // @codingStandardsIgnoreEnd
868867 }
869868
870869 public function init_config () {
@@ -1082,6 +1081,8 @@ public function start() {
10821081 );
10831082 }
10841083
1084+ // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- Declaring WP native constants.
1085+
10851086 if ( $ this ->cmd_starts_with ( array ( 'core ' , 'is-installed ' ) )
10861087 || $ this ->cmd_starts_with ( array ( 'core ' , 'update-db ' ) ) ) {
10871088 define ( 'WP_INSTALLING ' , true );
@@ -1119,6 +1120,7 @@ public function start() {
11191120 if ( $ this ->cmd_starts_with ( array ( 'cron ' , 'event ' , 'run ' ) ) ) {
11201121 define ( 'DOING_CRON ' , true );
11211122 }
1123+ // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
11221124
11231125 $ this ->load_wordpress ();
11241126
@@ -1159,14 +1161,16 @@ public function load_wordpress() {
11591161 // Load wp-config.php code, in the global scope
11601162 $ wp_cli_original_defined_vars = get_defined_vars ();
11611163
1162- eval ( $ this ->get_wp_config_code () ); // phpcs:ignore Squiz.PHP.Eval.Discouraged -- @codingStandardsIgnoreLine
1164+ eval ( $ this ->get_wp_config_code () ); // phpcs:ignore Squiz.PHP.Eval.Discouraged
11631165
11641166 foreach ( get_defined_vars () as $ key => $ var ) {
11651167 if ( array_key_exists ( $ key , $ wp_cli_original_defined_vars ) || 'wp_cli_original_defined_vars ' === $ key ) {
11661168 continue ;
11671169 }
1168- // @codingStandardsIgnoreLine
1170+
1171+ // phpcs:ignore PHPCompatibility.Variables.ForbiddenGlobalVariableVariable.NonBareVariableFound
11691172 global $ {$ key };
1173+ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
11701174 $ {$ key } = $ var ;
11711175 }
11721176
@@ -1203,6 +1207,7 @@ public function load_wordpress() {
12031207 }
12041208
12051209 // Fix memory limit. See http://core.trac.wordpress.org/ticket/14889
1210+ // phpcs:ignore WordPress.PHP.IniSet.memory_limit_Blacklisted -- This is perfectly fine for CLI usage.
12061211 ini_set ( 'memory_limit ' , -1 );
12071212
12081213 // Load all the admin APIs, for convenience
@@ -1233,6 +1238,7 @@ private static function fake_current_site_blog( $url_parts ) {
12331238 $ url_parts ['path ' ] = '/ ' ;
12341239 }
12351240
1241+ // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- Intentional override.
12361242 $ current_site = (object ) array (
12371243 'id ' => 1 ,
12381244 'blog_id ' => 1 ,
@@ -1242,6 +1248,10 @@ private static function fake_current_site_blog( $url_parts ) {
12421248 'site_name ' => 'Fake Site ' ,
12431249 );
12441250
1251+ // Bug in WPCS {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/1693}
1252+ // which will be fixed in WPCS 2.1.1/2.2.0. Once the bug fix is in, this comment can be removed.
1253+ // However, it then need to be replaced with the GlobalVariableOverride ignore as used above.
1254+ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
12451255 $ current_blog = (object ) array (
12461256 'blog_id ' => 1 ,
12471257 'site_id ' => 1 ,
@@ -1753,6 +1763,6 @@ private function enable_error_reporting() {
17531763 // Don't enable E_DEPRECATED as old versions of WP use PHP 4 style constructors and the mysql extension.
17541764 error_reporting ( E_ALL & ~E_DEPRECATED );
17551765 }
1756- ini_set ( 'display_errors ' , 'stderr ' );
1766+ ini_set ( 'display_errors ' , 'stderr ' ); // phpcs:ignore WordPress.PHP.IniSet.display_errors_Blacklisted
17571767 }
17581768}
0 commit comments