Skip to content

Commit b0cc778

Browse files
Coding Standards: Add public visibility to methods in src directory.
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51919 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4dae388 commit b0cc778

13 files changed

Lines changed: 100 additions & 100 deletions

File tree

src/wp-admin/includes/class-wp-debug-data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class WP_Debug_Data {
1313
*
1414
* @since 5.2.0
1515
*/
16-
static function check_for_updates() {
16+
public static function check_for_updates() {
1717
wp_version_check();
1818
wp_update_plugins();
1919
wp_update_themes();
@@ -32,7 +32,7 @@ static function check_for_updates() {
3232
*
3333
* @return array The debug data for the site.
3434
*/
35-
static function debug_data() {
35+
public static function debug_data() {
3636
global $wpdb;
3737

3838
// Save few function calls.

src/wp-admin/includes/class-wp-site-health-auto-updates.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function test_wp_automatic_updates_disabled() {
156156
*
157157
* @return array|false The test results. False if the auto-updates failed.
158158
*/
159-
function test_if_failed_update() {
159+
public function test_if_failed_update() {
160160
$failed = get_site_option( 'auto_core_update_failed' );
161161

162162
if ( ! $failed ) {
@@ -272,7 +272,7 @@ public function test_vcs_abspath() {
272272
*
273273
* @return array The test results.
274274
*/
275-
function test_check_wp_filesystem_method() {
275+
public function test_check_wp_filesystem_method() {
276276
// Make sure the `request_filesystem_credentials()` function is available during our REST API call.
277277
if ( ! function_exists( 'request_filesystem_credentials' ) ) {
278278
require_once ABSPATH . '/wp-admin/includes/file.php';
@@ -306,7 +306,7 @@ function test_check_wp_filesystem_method() {
306306
*
307307
* @return array|false The test results. False if they're not writeable.
308308
*/
309-
function test_all_files_writable() {
309+
public function test_all_files_writable() {
310310
global $wp_filesystem;
311311

312312
require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
@@ -391,7 +391,7 @@ function test_all_files_writable() {
391391
*
392392
* @return array|false The test results. False if it isn't a development version.
393393
*/
394-
function test_accepts_dev_updates() {
394+
public function test_accepts_dev_updates() {
395395
require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
396396
// Only for dev versions.
397397
if ( false === strpos( $wp_version, '-' ) ) {
@@ -429,7 +429,7 @@ function test_accepts_dev_updates() {
429429
*
430430
* @return array The test results.
431431
*/
432-
function test_accepts_minor_updates() {
432+
public function test_accepts_minor_updates() {
433433
if ( defined( 'WP_AUTO_UPDATE_CORE' ) && false === WP_AUTO_UPDATE_CORE ) {
434434
return array(
435435
'description' => sprintf(

src/wp-admin/includes/class-wp-site-health.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2767,7 +2767,7 @@ public function has_late_cron() {
27672767
*
27682768
* @return object The test results.
27692769
*/
2770-
function detect_plugin_theme_auto_update_issues() {
2770+
public function detect_plugin_theme_auto_update_issues() {
27712771
$mock_plugin = (object) array(
27722772
'id' => 'w.org/plugins/a-fake-plugin',
27732773
'slug' => 'a-fake-plugin',
@@ -2850,7 +2850,7 @@ function detect_plugin_theme_auto_update_issues() {
28502850
*
28512851
* @return object The test results.
28522852
*/
2853-
function can_perform_loopback() {
2853+
public function can_perform_loopback() {
28542854
$body = array( 'site-health' => 'loopback-test' );
28552855
$cookies = wp_unslash( $_COOKIE );
28562856
$timeout = 10;

src/wp-content/themes/twentyeleven/inc/widgets.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
1717
*
1818
* @since Twenty Eleven 2.2
1919
*/
20-
function __construct() {
20+
public function __construct() {
2121
parent::__construct(
2222
'widget_twentyeleven_ephemera',
2323
__( 'Twenty Eleven Ephemera', 'twentyeleven' ),
@@ -40,7 +40,7 @@ function __construct() {
4040
* @since Twenty Eleven 1.0
4141
* @deprecated Twenty Eleven 2.2
4242
*/
43-
function Twenty_Eleven_Ephemera_Widget() {
43+
public function Twenty_Eleven_Ephemera_Widget() {
4444
self::__construct();
4545
}
4646

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

5858
if ( ! is_array( $cache ) ) {
@@ -158,7 +158,7 @@ function widget( $args, $instance ) {
158158
*
159159
* @since Twenty Eleven 1.0
160160
*/
161-
function update( $new_instance, $old_instance ) {
161+
public function update( $new_instance, $old_instance ) {
162162
$instance = $old_instance;
163163
$instance['title'] = strip_tags( $new_instance['title'] );
164164
$instance['number'] = (int) $new_instance['number'];
@@ -177,7 +177,7 @@ function update( $new_instance, $old_instance ) {
177177
*
178178
* @since Twenty Eleven 1.0
179179
*/
180-
function flush_widget_cache() {
180+
public function flush_widget_cache() {
181181
wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' );
182182
}
183183

@@ -188,7 +188,7 @@ function flush_widget_cache() {
188188
*
189189
* @since Twenty Eleven 1.0
190190
*/
191-
function form( $instance ) {
191+
public function form( $instance ) {
192192
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
193193
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 10;
194194
?>

src/wp-content/themes/twentyfourteen/inc/widgets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function widget( $args, $instance ) {
269269
* @param array $old_instance Original widget instance.
270270
* @return array Updated widget instance.
271271
*/
272-
function update( $new_instance, $old_instance ) {
272+
public function update( $new_instance, $old_instance ) {
273273
$old_instance['title'] = strip_tags( $new_instance['title'] );
274274
$old_instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] );
275275

@@ -287,7 +287,7 @@ function update( $new_instance, $old_instance ) {
287287
*
288288
* @param array $instance
289289
*/
290-
function form( $instance ) {
290+
public function form( $instance ) {
291291
$title = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
292292
$number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : 2;
293293
$format = isset( $instance['format'] ) ? $instance['format'] : '';

src/wp-includes/class-wp-customize-manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ public function changeset_data() {
11851185
*
11861186
* @param array $starter_content Starter content. Defaults to `get_theme_starter_content()`.
11871187
*/
1188-
function import_theme_starter_content( $starter_content = array() ) {
1188+
public function import_theme_starter_content( $starter_content = array() ) {
11891189
if ( empty( $starter_content ) ) {
11901190
$starter_content = get_theme_starter_content();
11911191
}
@@ -2622,7 +2622,7 @@ public function save() {
26222622
*
26232623
* @return array|WP_Error Returns array on success and WP_Error with array data on error.
26242624
*/
2625-
function save_changeset_post( $args = array() ) {
2625+
public function save_changeset_post( $args = array() ) {
26262626

26272627
$args = array_merge(
26282628
array(

src/wp-includes/class-wp-customize-setting.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ protected function aggregate_multidimensional() {
268268
* @since 4.5.0
269269
* @ignore
270270
*/
271-
static public function reset_aggregated_multidimensionals() {
271+
public static function reset_aggregated_multidimensionals() {
272272
self::$aggregated_multidimensionals = array();
273273
}
274274

src/wp-includes/pomo/entry.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Translation_Entry {
4040
* - references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form
4141
* - flags (array) -- flags like php-format
4242
*/
43-
function __construct( $args = array() ) {
43+
public function __construct( $args = array() ) {
4444
// If no singular -- empty object.
4545
if ( ! isset( $args['singular'] ) ) {
4646
return;
@@ -80,7 +80,7 @@ public function Translation_Entry( $args = array() ) {
8080
*
8181
* @return string|bool the key or false if the entry is empty
8282
*/
83-
function key() {
83+
public function key() {
8484
if ( null === $this->singular || '' === $this->singular ) {
8585
return false;
8686
}
@@ -96,7 +96,7 @@ function key() {
9696
/**
9797
* @param object $other
9898
*/
99-
function merge_with( &$other ) {
99+
public function merge_with( &$other ) {
100100
$this->flags = array_unique( array_merge( $this->flags, $other->flags ) );
101101
$this->references = array_unique( array_merge( $this->references, $other->references ) );
102102
if ( $this->extracted_comments != $other->extracted_comments ) {

src/wp-includes/pomo/mo.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function get_filename() {
3737
* @param string $filename MO file to load
3838
* @return bool True if the import from file was successful, otherwise false.
3939
*/
40-
function import_from_file( $filename ) {
40+
public function import_from_file( $filename ) {
4141
$reader = new POMO_FileReader( $filename );
4242

4343
if ( ! $reader->is_resource() ) {
@@ -53,7 +53,7 @@ function import_from_file( $filename ) {
5353
* @param string $filename
5454
* @return bool
5555
*/
56-
function export_to_file( $filename ) {
56+
public function export_to_file( $filename ) {
5757
$fh = fopen( $filename, 'wb' );
5858
if ( ! $fh ) {
5959
return false;
@@ -66,7 +66,7 @@ function export_to_file( $filename ) {
6666
/**
6767
* @return string|false
6868
*/
69-
function export() {
69+
public function export() {
7070
$tmp_fh = fopen( 'php://temp', 'r+' );
7171
if ( ! $tmp_fh ) {
7272
return false;
@@ -80,7 +80,7 @@ function export() {
8080
* @param Translation_Entry $entry
8181
* @return bool
8282
*/
83-
function is_entry_good_for_export( $entry ) {
83+
public function is_entry_good_for_export( $entry ) {
8484
if ( empty( $entry->translations ) ) {
8585
return false;
8686
}
@@ -96,7 +96,7 @@ function is_entry_good_for_export( $entry ) {
9696
* @param resource $fh
9797
* @return true
9898
*/
99-
function export_to_file_handle( $fh ) {
99+
public function export_to_file_handle( $fh ) {
100100
$entries = array_filter( $this->entries, array( $this, 'is_entry_good_for_export' ) );
101101
ksort( $entries );
102102
$magic = 0x950412de;
@@ -157,7 +157,7 @@ function export_to_file_handle( $fh ) {
157157
* @param Translation_Entry $entry
158158
* @return string
159159
*/
160-
function export_original( $entry ) {
160+
public function export_original( $entry ) {
161161
// TODO: Warnings for control characters.
162162
$exported = $entry->singular;
163163
if ( $entry->is_plural ) {
@@ -173,15 +173,15 @@ function export_original( $entry ) {
173173
* @param Translation_Entry $entry
174174
* @return string
175175
*/
176-
function export_translations( $entry ) {
176+
public function export_translations( $entry ) {
177177
// TODO: Warnings for control characters.
178178
return $entry->is_plural ? implode( "\0", $entry->translations ) : $entry->translations[0];
179179
}
180180

181181
/**
182182
* @return string
183183
*/
184-
function export_headers() {
184+
public function export_headers() {
185185
$exported = '';
186186
foreach ( $this->headers as $header => $value ) {
187187
$exported .= "$header: $value\n";
@@ -193,7 +193,7 @@ function export_headers() {
193193
* @param int $magic
194194
* @return string|false
195195
*/
196-
function get_byteorder( $magic ) {
196+
public function get_byteorder( $magic ) {
197197
// The magic is 0x950412de.
198198

199199
// bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
@@ -214,7 +214,7 @@ function get_byteorder( $magic ) {
214214
* @param POMO_FileReader $reader
215215
* @return bool True if the import was successful, otherwise false.
216216
*/
217-
function import_from_reader( $reader ) {
217+
public function import_from_reader( $reader ) {
218218
$endian_string = MO::get_byteorder( $reader->readint32() );
219219
if ( false === $endian_string ) {
220220
return false;
@@ -311,7 +311,7 @@ function import_from_reader( $reader ) {
311311
* 0x00 as a plural translations separator
312312
* @return Translation_Entry Entry instance.
313313
*/
314-
function &make_entry( $original, $translation ) {
314+
public function &make_entry( $original, $translation ) {
315315
$entry = new Translation_Entry();
316316
// Look for context, separated by \4.
317317
$parts = explode( "\4", $original );
@@ -335,14 +335,14 @@ function &make_entry( $original, $translation ) {
335335
* @param int $count
336336
* @return string
337337
*/
338-
function select_plural_form( $count ) {
338+
public function select_plural_form( $count ) {
339339
return $this->gettext_select_plural_form( $count );
340340
}
341341

342342
/**
343343
* @return int
344344
*/
345-
function get_plural_forms_count() {
345+
public function get_plural_forms_count() {
346346
return $this->_nplurals;
347347
}
348348
}

0 commit comments

Comments
 (0)