Skip to content

Commit

Permalink
Coding Standards: Add public visibility to methods in src directory.
Browse files Browse the repository at this point in the history
This commit adds the `public` visibility keyword to each method which did not have an explicit visibility keyword.

Why `public`?

With no visibility previously declared, these methods are implicitly `public` and available for use. Changing them to anything else would be a backwards-compatibility break.

Props costdev, jrf.
See #54177.
Built from https://develop.svn.wordpress.org/trunk@51919


git-svn-id: http://core.svn.wordpress.org/trunk@51512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
hellofromtonya committed Oct 18, 2021
1 parent a60032f commit 234877c
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 101 deletions.
4 changes: 2 additions & 2 deletions wp-admin/includes/class-wp-debug-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class WP_Debug_Data {
*
* @since 5.2.0
*/
static function check_for_updates() {
public static function check_for_updates() {
wp_version_check();
wp_update_plugins();
wp_update_themes();
Expand All @@ -32,7 +32,7 @@ static function check_for_updates() {
*
* @return array The debug data for the site.
*/
static function debug_data() {
public static function debug_data() {
global $wpdb;

// Save few function calls.
Expand Down
10 changes: 5 additions & 5 deletions wp-admin/includes/class-wp-site-health-auto-updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function test_wp_automatic_updates_disabled() {
*
* @return array|false The test results. False if the auto-updates failed.
*/
function test_if_failed_update() {
public function test_if_failed_update() {
$failed = get_site_option( 'auto_core_update_failed' );

if ( ! $failed ) {
Expand Down Expand Up @@ -272,7 +272,7 @@ public function test_vcs_abspath() {
*
* @return array The test results.
*/
function test_check_wp_filesystem_method() {
public function test_check_wp_filesystem_method() {
// Make sure the `request_filesystem_credentials()` function is available during our REST API call.
if ( ! function_exists( 'request_filesystem_credentials' ) ) {
require_once ABSPATH . '/wp-admin/includes/file.php';
Expand Down Expand Up @@ -306,7 +306,7 @@ function test_check_wp_filesystem_method() {
*
* @return array|false The test results. False if they're not writeable.
*/
function test_all_files_writable() {
public function test_all_files_writable() {
global $wp_filesystem;

require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
Expand Down Expand Up @@ -391,7 +391,7 @@ function test_all_files_writable() {
*
* @return array|false The test results. False if it isn't a development version.
*/
function test_accepts_dev_updates() {
public function test_accepts_dev_updates() {
require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
// Only for dev versions.
if ( false === strpos( $wp_version, '-' ) ) {
Expand Down Expand Up @@ -429,7 +429,7 @@ function test_accepts_dev_updates() {
*
* @return array The test results.
*/
function test_accepts_minor_updates() {
public function test_accepts_minor_updates() {
if ( defined( 'WP_AUTO_UPDATE_CORE' ) && false === WP_AUTO_UPDATE_CORE ) {
return array(
'description' => sprintf(
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/includes/class-wp-site-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -2767,7 +2767,7 @@ public function has_late_cron() {
*
* @return object The test results.
*/
function detect_plugin_theme_auto_update_issues() {
public function detect_plugin_theme_auto_update_issues() {
$mock_plugin = (object) array(
'id' => 'w.org/plugins/a-fake-plugin',
'slug' => 'a-fake-plugin',
Expand Down Expand Up @@ -2850,7 +2850,7 @@ function detect_plugin_theme_auto_update_issues() {
*
* @return object The test results.
*/
function can_perform_loopback() {
public function can_perform_loopback() {
$body = array( 'site-health' => 'loopback-test' );
$cookies = wp_unslash( $_COOKIE );
$timeout = 10;
Expand Down
12 changes: 6 additions & 6 deletions wp-content/themes/twentyeleven/inc/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
*
* @since Twenty Eleven 2.2
*/
function __construct() {
public function __construct() {
parent::__construct(
'widget_twentyeleven_ephemera',
__( 'Twenty Eleven Ephemera', 'twentyeleven' ),
Expand All @@ -40,7 +40,7 @@ function __construct() {
* @since Twenty Eleven 1.0
* @deprecated Twenty Eleven 2.2
*/
function Twenty_Eleven_Ephemera_Widget() {
public function Twenty_Eleven_Ephemera_Widget() {
self::__construct();
}

Expand All @@ -52,7 +52,7 @@ function Twenty_Eleven_Ephemera_Widget() {
* @param array $args An array of standard parameters for widgets in this theme.
* @param array $instance An array of settings for this widget instance.
*/
function widget( $args, $instance ) {
public function widget( $args, $instance ) {
$cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' );

if ( ! is_array( $cache ) ) {
Expand Down Expand Up @@ -158,7 +158,7 @@ function widget( $args, $instance ) {
*
* @since Twenty Eleven 1.0
*/
function update( $new_instance, $old_instance ) {
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['number'] = (int) $new_instance['number'];
Expand All @@ -177,7 +177,7 @@ function update( $new_instance, $old_instance ) {
*
* @since Twenty Eleven 1.0
*/
function flush_widget_cache() {
public function flush_widget_cache() {
wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' );
}

Expand All @@ -188,7 +188,7 @@ function flush_widget_cache() {
*
* @since Twenty Eleven 1.0
*/
function form( $instance ) {
public function form( $instance ) {
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 10;
?>
Expand Down
4 changes: 2 additions & 2 deletions wp-content/themes/twentyfourteen/inc/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public function widget( $args, $instance ) {
* @param array $old_instance Original widget instance.
* @return array Updated widget instance.
*/
function update( $new_instance, $old_instance ) {
public function update( $new_instance, $old_instance ) {
$old_instance['title'] = strip_tags( $new_instance['title'] );
$old_instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] );

Expand All @@ -287,7 +287,7 @@ function update( $new_instance, $old_instance ) {
*
* @param array $instance
*/
function form( $instance ) {
public function form( $instance ) {
$title = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
$number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : 2;
$format = isset( $instance['format'] ) ? $instance['format'] : '';
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ public function changeset_data() {
*
* @param array $starter_content Starter content. Defaults to `get_theme_starter_content()`.
*/
function import_theme_starter_content( $starter_content = array() ) {
public function import_theme_starter_content( $starter_content = array() ) {
if ( empty( $starter_content ) ) {
$starter_content = get_theme_starter_content();
}
Expand Down Expand Up @@ -2622,7 +2622,7 @@ public function save() {
*
* @return array|WP_Error Returns array on success and WP_Error with array data on error.
*/
function save_changeset_post( $args = array() ) {
public function save_changeset_post( $args = array() ) {

$args = array_merge(
array(
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/class-wp-customize-setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ protected function aggregate_multidimensional() {
* @since 4.5.0
* @ignore
*/
static public function reset_aggregated_multidimensionals() {
public static function reset_aggregated_multidimensionals() {
self::$aggregated_multidimensionals = array();
}

Expand Down
6 changes: 3 additions & 3 deletions wp-includes/pomo/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Translation_Entry {
* - references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form
* - flags (array) -- flags like php-format
*/
function __construct( $args = array() ) {
public function __construct( $args = array() ) {
// If no singular -- empty object.
if ( ! isset( $args['singular'] ) ) {
return;
Expand Down Expand Up @@ -80,7 +80,7 @@ public function Translation_Entry( $args = array() ) {
*
* @return string|bool the key or false if the entry is empty
*/
function key() {
public function key() {
if ( null === $this->singular || '' === $this->singular ) {
return false;
}
Expand All @@ -96,7 +96,7 @@ function key() {
/**
* @param object $other
*/
function merge_with( &$other ) {
public function merge_with( &$other ) {
$this->flags = array_unique( array_merge( $this->flags, $other->flags ) );
$this->references = array_unique( array_merge( $this->references, $other->references ) );
if ( $this->extracted_comments != $other->extracted_comments ) {
Expand Down
26 changes: 13 additions & 13 deletions wp-includes/pomo/mo.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function get_filename() {
* @param string $filename MO file to load
* @return bool True if the import from file was successful, otherwise false.
*/
function import_from_file( $filename ) {
public function import_from_file( $filename ) {
$reader = new POMO_FileReader( $filename );

if ( ! $reader->is_resource() ) {
Expand All @@ -53,7 +53,7 @@ function import_from_file( $filename ) {
* @param string $filename
* @return bool
*/
function export_to_file( $filename ) {
public function export_to_file( $filename ) {
$fh = fopen( $filename, 'wb' );
if ( ! $fh ) {
return false;
Expand All @@ -66,7 +66,7 @@ function export_to_file( $filename ) {
/**
* @return string|false
*/
function export() {
public function export() {
$tmp_fh = fopen( 'php://temp', 'r+' );
if ( ! $tmp_fh ) {
return false;
Expand All @@ -80,7 +80,7 @@ function export() {
* @param Translation_Entry $entry
* @return bool
*/
function is_entry_good_for_export( $entry ) {
public function is_entry_good_for_export( $entry ) {
if ( empty( $entry->translations ) ) {
return false;
}
Expand All @@ -96,7 +96,7 @@ function is_entry_good_for_export( $entry ) {
* @param resource $fh
* @return true
*/
function export_to_file_handle( $fh ) {
public function export_to_file_handle( $fh ) {
$entries = array_filter( $this->entries, array( $this, 'is_entry_good_for_export' ) );
ksort( $entries );
$magic = 0x950412de;
Expand Down Expand Up @@ -157,7 +157,7 @@ function export_to_file_handle( $fh ) {
* @param Translation_Entry $entry
* @return string
*/
function export_original( $entry ) {
public function export_original( $entry ) {
// TODO: Warnings for control characters.
$exported = $entry->singular;
if ( $entry->is_plural ) {
Expand All @@ -173,15 +173,15 @@ function export_original( $entry ) {
* @param Translation_Entry $entry
* @return string
*/
function export_translations( $entry ) {
public function export_translations( $entry ) {
// TODO: Warnings for control characters.
return $entry->is_plural ? implode( "\0", $entry->translations ) : $entry->translations[0];
}

/**
* @return string
*/
function export_headers() {
public function export_headers() {
$exported = '';
foreach ( $this->headers as $header => $value ) {
$exported .= "$header: $value\n";
Expand All @@ -193,7 +193,7 @@ function export_headers() {
* @param int $magic
* @return string|false
*/
function get_byteorder( $magic ) {
public function get_byteorder( $magic ) {
// The magic is 0x950412de.

// bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
Expand All @@ -214,7 +214,7 @@ function get_byteorder( $magic ) {
* @param POMO_FileReader $reader
* @return bool True if the import was successful, otherwise false.
*/
function import_from_reader( $reader ) {
public function import_from_reader( $reader ) {
$endian_string = MO::get_byteorder( $reader->readint32() );
if ( false === $endian_string ) {
return false;
Expand Down Expand Up @@ -311,7 +311,7 @@ function import_from_reader( $reader ) {
* 0x00 as a plural translations separator
* @return Translation_Entry Entry instance.
*/
function &make_entry( $original, $translation ) {
public function &make_entry( $original, $translation ) {
$entry = new Translation_Entry();
// Look for context, separated by \4.
$parts = explode( "\4", $original );
Expand All @@ -335,14 +335,14 @@ function &make_entry( $original, $translation ) {
* @param int $count
* @return string
*/
function select_plural_form( $count ) {
public function select_plural_form( $count ) {
return $this->gettext_select_plural_form( $count );
}

/**
* @return int
*/
function get_plural_forms_count() {
public function get_plural_forms_count() {
return $this->_nplurals;
}
}
Expand Down
Loading

0 comments on commit 234877c

Please sign in to comment.