Coding Standards: Fix/ignore the `WordPress.NamingConventions.ValidFunctionName` violations.

See #47632


Built from https://develop.svn.wordpress.org/trunk@45580


git-svn-id: http://core.svn.wordpress.org/trunk@45391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2019-07-01 08:01:57 +00:00
parent 072682b1ed
commit 55af0f0d0a
21 changed files with 36 additions and 35 deletions

View File

@ -1720,7 +1720,7 @@ function copy_dir( $from, $to, $skip_list = array() ) {
* @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false. * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
* @return bool|null True on success, false on failure, null if the filesystem method class file does not exist. * @return bool|null True on success, false on failure, null if the filesystem method class file does not exist.
*/ */
function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_ownership = false ) { function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_ownership = false ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
global $wp_filesystem; global $wp_filesystem;
require_once( ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php' ); require_once( ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php' );

View File

@ -831,7 +831,7 @@ function iis7_add_rewrite_rule( $filename, $rewrite_rule ) {
* @param DOMDocument $doc * @param DOMDocument $doc
* @param string $filename * @param string $filename
*/ */
function saveDomDocument( $doc, $filename ) { function saveDomDocument( $doc, $filename ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$config = $doc->saveXML(); $config = $doc->saveXML();
$config = preg_replace( "/([^\r])\n/", "$1\r\n", $config ); $config = preg_replace( "/([^\r])\n/", "$1\r\n", $config );
$fp = fopen( $filename, 'w' ); $fp = fopen( $filename, 'w' );

View File

@ -2453,7 +2453,7 @@ function get_alloptions_110() {
* @param string $setting Option name. * @param string $setting Option name.
* @return mixed * @return mixed
*/ */
function __get_option( $setting ) { function __get_option( $setting ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
global $wpdb; global $wpdb;
if ( $setting == 'home' && defined( 'WP_HOME' ) ) { if ( $setting == 'home' && defined( 'WP_HOME' ) ) {
@ -2522,7 +2522,7 @@ function deslash( $content ) {
* Default true. * Default true.
* @return array Strings containing the results of the various update queries. * @return array Strings containing the results of the various update queries.
*/ */
function dbDelta( $queries = '', $execute = true ) { function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
global $wpdb; global $wpdb;
if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) ) { if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) ) {

View File

@ -31,7 +31,7 @@ global $opml;
* @param string $tagName XML element name. * @param string $tagName XML element name.
* @param array $attrs XML element attributes. * @param array $attrs XML element attributes.
*/ */
function startElement( $parser, $tagName, $attrs ) { function startElement( $parser, $tagName, $attrs ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
global $names, $urls, $targets, $descriptions, $feeds; global $names, $urls, $targets, $descriptions, $feeds;
if ( 'OUTLINE' === $tagName ) { if ( 'OUTLINE' === $tagName ) {
@ -68,7 +68,7 @@ function startElement( $parser, $tagName, $attrs ) {
* @param mixed $parser XML Parser resource. * @param mixed $parser XML Parser resource.
* @param string $tagName XML tag name. * @param string $tagName XML tag name.
*/ */
function endElement( $parser, $tagName ) { function endElement( $parser, $tagName ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
// Nothing to do. // Nothing to do.
} }

View File

@ -563,6 +563,6 @@ function is_multi_author() {
* @since 3.2.0 * @since 3.2.0
* @access private * @access private
*/ */
function __clear_multi_author_cache() { function __clear_multi_author_cache() { //phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
delete_transient( 'is_multi_author' ); delete_transient( 'is_multi_author' );
} }

View File

@ -105,7 +105,7 @@ function get_the_category( $id = false ) {
* @param int $cat_ID Category ID. * @param int $cat_ID Category ID.
* @return string|WP_Error Category name on success, WP_Error on failure. * @return string|WP_Error Category name on success, WP_Error on failure.
*/ */
function get_the_category_by_ID( $cat_ID ) { function get_the_category_by_ID( $cat_ID ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$cat_ID = (int) $cat_ID; $cat_ID = (int) $cat_ID;
$category = get_term( $cat_ID ); $category = get_term( $cat_ID );

View File

@ -197,7 +197,7 @@ function get_category_by_slug( $slug ) {
* @param string $cat_name Category name. * @param string $cat_name Category name.
* @return int 0, if failure and ID of category on success. * @return int 0, if failure and ID of category on success.
*/ */
function get_cat_ID( $cat_name ) { function get_cat_ID( $cat_name ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$cat = get_term_by( 'name', $cat_name, 'category' ); $cat = get_term_by( 'name', $cat_name, 'category' );
if ( $cat ) { if ( $cat ) {
return $cat->term_id; return $cat->term_id;

View File

@ -647,7 +647,7 @@ class WP_Http {
* @param string $strResponse The full response string * @param string $strResponse The full response string
* @return array Array with 'headers' and 'body' keys. * @return array Array with 'headers' and 'body' keys.
*/ */
public static function processResponse( $strResponse ) { public static function processResponse( $strResponse ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
$res = explode( "\r\n\r\n", $strResponse, 2 ); $res = explode( "\r\n\r\n", $strResponse, 2 );
return array( return array(
@ -669,7 +669,7 @@ class WP_Http {
* @return array Processed string headers. If duplicate headers are encountered, * @return array Processed string headers. If duplicate headers are encountered,
* Then a numbered array is returned as the value of that header-key. * Then a numbered array is returned as the value of that header-key.
*/ */
public static function processHeaders( $headers, $url = '' ) { public static function processHeaders( $headers, $url = '' ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
// Split headers, one per array element. // Split headers, one per array element.
if ( is_string( $headers ) ) { if ( is_string( $headers ) ) {
// Tolerate line terminator: CRLF = LF (RFC 2616 19.3). // Tolerate line terminator: CRLF = LF (RFC 2616 19.3).
@ -752,7 +752,7 @@ class WP_Http {
* *
* @param array $r Full array of args passed into ::request() * @param array $r Full array of args passed into ::request()
*/ */
public static function buildCookieHeader( &$r ) { public static function buildCookieHeader( &$r ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
if ( ! empty( $r['cookies'] ) ) { if ( ! empty( $r['cookies'] ) ) {
// Upgrade any name => value cookie pairs to WP_HTTP_Cookie instances. // Upgrade any name => value cookie pairs to WP_HTTP_Cookie instances.
foreach ( $r['cookies'] as $name => $value ) { foreach ( $r['cookies'] as $name => $value ) {
@ -788,7 +788,7 @@ class WP_Http {
* @param string $body Body content * @param string $body Body content
* @return string Chunked decoded body on success or raw body on failure. * @return string Chunked decoded body on success or raw body on failure.
*/ */
public static function chunkTransferDecode( $body ) { public static function chunkTransferDecode( $body ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
// The body is not chunked encoded or is malformed. // The body is not chunked encoded or is malformed.
if ( ! preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', trim( $body ) ) ) { if ( ! preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', trim( $body ) ) ) {
return $body; return $body;

View File

@ -211,7 +211,7 @@ class WP_Http_Cookie {
* *
* @return string Header encoded cookie name and value. * @return string Header encoded cookie name and value.
*/ */
public function getHeaderValue() { public function getHeaderValue() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
if ( ! isset( $this->name ) || ! isset( $this->value ) ) { if ( ! isset( $this->name ) || ! isset( $this->value ) ) {
return ''; return '';
} }
@ -234,7 +234,7 @@ class WP_Http_Cookie {
* *
* @return string * @return string
*/ */
public function getFullHeader() { public function getFullHeader() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
return 'Cookie: ' . $this->getHeaderValue(); return 'Cookie: ' . $this->getHeaderValue();
} }

View File

@ -147,7 +147,7 @@ class WP_HTTP_Response {
* *
* @return mixed Any JSON-serializable value. * @return mixed Any JSON-serializable value.
*/ */
public function jsonSerialize() { public function jsonSerialize() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
return $this->get_data(); return $this->get_data();
} }
} }

View File

@ -262,7 +262,7 @@ function comment_author_link( $comment_ID = 0 ) {
* Default current comment. * Default current comment.
* @return string Comment author's IP address. * @return string Comment author's IP address.
*/ */
function get_comment_author_IP( $comment_ID = 0 ) { function get_comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$comment = get_comment( $comment_ID ); $comment = get_comment( $comment_ID );
/** /**
@ -287,7 +287,7 @@ function get_comment_author_IP( $comment_ID = 0 ) {
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's IP address. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's IP address.
* Default current comment. * Default current comment.
*/ */
function comment_author_IP( $comment_ID = 0 ) { function comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
echo esc_html( get_comment_author_IP( $comment_ID ) ); echo esc_html( get_comment_author_IP( $comment_ID ) );
} }
@ -651,7 +651,7 @@ function comment_excerpt( $comment_ID = 0 ) {
* *
* @return int The comment ID. * @return int The comment ID.
*/ */
function get_comment_ID() { function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$comment = get_comment(); $comment = get_comment();
/** /**
@ -671,7 +671,7 @@ function get_comment_ID() {
* *
* @since 0.71 * @since 0.71
*/ */
function comment_ID() { function comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
echo get_comment_ID(); echo get_comment_ID();
} }

View File

@ -434,6 +434,7 @@ if ( ! interface_exists( 'JsonSerializable' ) ) {
* @since 4.4.0 * @since 4.4.0
*/ */
interface JsonSerializable { interface JsonSerializable {
// phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
public function jsonSerialize(); public function jsonSerialize();
} }
} }

View File

@ -2427,7 +2427,7 @@ function convert_invalid_entities( $content ) {
* @param bool $force If true, forces balancing, ignoring the value of the option. Default false. * @param bool $force If true, forces balancing, ignoring the value of the option. Default false.
* @return string Balanced text * @return string Balanced text
*/ */
function balanceTags( $text, $force = false ) { function balanceTags( $text, $force = false ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
if ( $force || get_option( 'use_balanceTags' ) == 1 ) { if ( $force || get_option( 'use_balanceTags' ) == 1 ) {
return force_balance_tags( $text ); return force_balance_tags( $text );
} else { } else {

View File

@ -5631,7 +5631,7 @@ function get_file_data( $file, $default_headers, $context = '' ) {
* *
* @return true True. * @return true True.
*/ */
function __return_true() { function __return_true() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
return true; return true;
} }
@ -5646,7 +5646,7 @@ function __return_true() {
* *
* @return false False. * @return false False.
*/ */
function __return_false() { function __return_false() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
return false; return false;
} }
@ -5659,7 +5659,7 @@ function __return_false() {
* *
* @return int 0. * @return int 0.
*/ */
function __return_zero() { function __return_zero() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
return 0; return 0;
} }
@ -5672,7 +5672,7 @@ function __return_zero() {
* *
* @return array Empty array. * @return array Empty array.
*/ */
function __return_empty_array() { function __return_empty_array() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
return array(); return array();
} }
@ -5685,7 +5685,7 @@ function __return_empty_array() {
* *
* @return null Null value. * @return null Null value.
*/ */
function __return_null() { function __return_null() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
return null; return null;
} }
@ -5700,7 +5700,7 @@ function __return_null() {
* *
* @return string Empty string. * @return string Empty string.
*/ */
function __return_empty_string() { function __return_empty_string() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
return ''; return '';
} }

View File

@ -4548,7 +4548,7 @@ function readonly( $readonly, $current = true, $echo = true ) {
* @param string $type The type of checked|selected|disabled|readonly we are doing * @param string $type The type of checked|selected|disabled|readonly we are doing
* @return string html attribute or empty string * @return string html attribute or empty string
*/ */
function __checked_selected_helper( $helper, $current, $echo, $type ) { function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
if ( (string) $helper === (string) $current ) { if ( (string) $helper === (string) $current ) {
$result = " $type='$type'"; $result = " $type='$type'";
} else { } else {

View File

@ -26,7 +26,7 @@ function wp_get_server_protocol() {
* @since 2.1.0 * @since 2.1.0
* @access private * @access private
*/ */
function wp_unregister_GLOBALS() { function wp_unregister_GLOBALS() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
if ( ! ini_get( 'register_globals' ) ) { if ( ! ini_get( 'register_globals' ) ) {
return; return;
} }

View File

@ -2252,7 +2252,7 @@ function force_ssl_content( $force = '' ) {
* @param string $url URL * @param string $url URL
* @return string URL with https as the scheme * @return string URL with https as the scheme
*/ */
function filter_SSL( $url ) { function filter_SSL( $url ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
if ( ! is_string( $url ) ) { if ( ! is_string( $url ) ) {
return get_bloginfo( 'url' ); // Return home blog url with proper scheme return get_bloginfo( 'url' ); // Return home blog url with proper scheme
} }

View File

@ -34,7 +34,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
* *
* @param string $endian Set the endianness of the file. Accepts 'big', or 'little'. * @param string $endian Set the endianness of the file. Accepts 'big', or 'little'.
*/ */
function setEndian( $endian ) { function setEndian( $endian ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
$this->endian = $endian; $this->endian = $endian;
} }

View File

@ -13,7 +13,7 @@
* *
* @since 0.71 * @since 0.71
*/ */
function the_ID() { function the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
echo get_the_ID(); echo get_the_ID();
} }
@ -24,7 +24,7 @@ function the_ID() {
* *
* @return int|false The ID of the current item in the WordPress Loop. False if $post is not set. * @return int|false The ID of the current item in the WordPress Loop. False if $post is not set.
*/ */
function get_the_ID() { function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$post = get_post(); $post = get_post();
return ! empty( $post ) ? $post->ID : false; return ! empty( $post ) ? $post->ID : false;
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-45579'; $wp_version = '5.3-alpha-45580';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -96,7 +96,7 @@ exit;
* @param string $io Whether input or output * @param string $io Whether input or output
* @param string $msg Information describing logging reason. * @param string $msg Information describing logging reason.
*/ */
function logIO( $io, $msg ) { function logIO( $io, $msg ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) { if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) {
error_log( $io . ' - ' . $msg ); error_log( $io . ' - ' . $msg );