mirror of
https://github.com/10h30/genesis-simple-sidebars.git
synced 2026-07-16 04:53:24 +09:00
Introducing coding standards validation.
This commit is contained in:
committed by
Nathan Rice
parent
6e40c921ab
commit
fd504d41ac
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* WordPress Coding Standard.
|
||||
*
|
||||
* @package WPCS\WordPressCodingStandards
|
||||
* @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
|
||||
* @license https://opensource.org/licenses/MIT MIT
|
||||
*/
|
||||
|
||||
namespace WordPress\Sniffs\PHP;
|
||||
|
||||
use WordPress\AbstractFunctionRestrictionsSniff;
|
||||
|
||||
/**
|
||||
* Restrict the use of various development functions.
|
||||
*
|
||||
* @package WPCS\WordPressCodingStandards
|
||||
*
|
||||
* @since 0.11.0
|
||||
* @since 0.13.0 Class name changed: this class is now namespaced.
|
||||
*/
|
||||
class DevelopmentFunctionsSniff extends AbstractFunctionRestrictionsSniff {
|
||||
|
||||
/**
|
||||
* Groups of functions to restrict.
|
||||
*
|
||||
* Example: groups => array(
|
||||
* 'lambda' => array(
|
||||
* 'type' => 'error' | 'warning',
|
||||
* 'message' => 'Use anonymous functions instead please!',
|
||||
* 'functions' => array( 'file_get_contents', 'create_function' ),
|
||||
* )
|
||||
* )
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getGroups() {
|
||||
return array(
|
||||
'error_log' => array(
|
||||
'type' => 'warning',
|
||||
'message' => '%s() found. Debug code should not normally be used in production.',
|
||||
'functions' => array(
|
||||
'error_log',
|
||||
'var_dump',
|
||||
'var_export',
|
||||
'print_r',
|
||||
'trigger_error',
|
||||
'set_error_handler',
|
||||
'debug_backtrace',
|
||||
'debug_print_backtrace',
|
||||
'wp_debug_backtrace_summary',
|
||||
),
|
||||
),
|
||||
|
||||
'prevent_path_disclosure' => array(
|
||||
'type' => 'warning',
|
||||
'message' => '%s() can lead to full path disclosure.',
|
||||
'functions' => array(
|
||||
'error_reporting',
|
||||
'phpinfo',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user