Make WordPress Core


Ignore:
Timestamp:
11/04/2021 01:15:33 PM (5 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Add public visibility to methods in tests/phpunit/includes/.

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. As these are part of the WordPress testing framework (for Core and extenders), changing them to anything else would be a backwards-compatibility break.

Props costdev, jrf, hellofromTonya.
See #54177.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/mock-fs.php

    r47122 r52009  
    1414        public $method  = 'MockFS';
    1515
    16         function __construct() {}
    17 
    18         function connect() {
     16        public function __construct() {}
     17
     18        public function connect() {
    1919                return true;
    2020        }
    2121
    2222        // Copy of core's function, but accepts a path.
    23         function abspath( $path = false ) {
     23        public function abspath( $path = false ) {
    2424                if ( ! $path ) {
    2525                        $path = ABSPATH;
    … …  
    4141         * Can also be passed the initial filesystem to be setup which is passed to self::setfs()
    4242         */
    43         function init( $paths = '', $home_dir = '/' ) {
     43        public function init( $paths = '', $home_dir = '/' ) {
    4444                $this->fs     = new MockFS_Directory_Node( '/' );
    4545                $this->fs_map = array(
    … …  
    5454         * "Bulk Loads" a filesystem into the internal virtual filesystem
    5555         */
    56         function setfs( $paths ) {
     56        public function setfs( $paths ) {
    5757                if ( ! is_array( $paths ) ) {
    5858                        $paths = explode( "\n", $paths );
    … …  
    9494        // Here starteth the WP_Filesystem functions.
    9595
    96         function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
     96        public function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
    9797                $path = trailingslashit( $path );
    9898
    … …  
    115115        }
    116116
    117         function put_contents( $path, $contents = '', $mode = null ) {
     117        public function put_contents( $path, $contents = '', $mode = null ) {
    118118                if ( ! $this->is_dir( dirname( $path ) ) ) {
    119119                        $this->mkdir( dirname( $path ) );
    … …  
    127127        }
    128128
    129         function get_contents( $file ) {
     129        public function get_contents( $file ) {
    130130                if ( ! $this->is_file( $file ) ) {
    131131                        return false;
    … …  
    134134        }
    135135
    136         function cwd() {
     136        public function cwd() {
    137137                return $this->cwd->path;
    138138        }
    139139
    140         function chdir( $path ) {
     140        public function chdir( $path ) {
    141141                if ( ! isset( $this->fs_map[ $path ] ) ) {
    142142                        return false;
    … …  
    147147        }
    148148
    149         function exists( $path ) {
     149        public function exists( $path ) {
    150150                return isset( $this->fs_map[ $path ] ) || isset( $this->fs_map[ trailingslashit( $path ) ] );
    151151        }
    152152
    153         function is_file( $file ) {
     153        public function is_file( $file ) {
    154154                return isset( $this->fs_map[ $file ] ) && $this->fs_map[ $file ]->is_file();
    155155        }
    156156
    157         function is_dir( $path ) {
     157        public function is_dir( $path ) {
    158158                $path = trailingslashit( $path );
    159159
    … …  
    161161        }
    162162
    163         function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
     163        public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
    164164
    165165                if ( empty( $path ) || '.' === $path ) {
    … …  
    215215        public $path; // The full path to the entry.
    216216
    217         function __construct( $path ) {
     217        public function __construct( $path ) {
    218218                $this->path = $path;
    219219                $this->name = basename( $path );
    220220        }
    221221
    222         function is_file() {
     222        public function is_file() {
    223223                return 'f' === $this->type;
    224224        }
    225225
    226         function is_dir() {
     226        public function is_dir() {
    227227                return 'd' === $this->type;
    228228        }
    … …  
    238238        public $contents = ''; // The contents of the file.
    239239
    240         function __construct( $path, $contents = '' ) {
     240        public function __construct( $path, $contents = '' ) {
    241241                parent::__construct( $path );
    242242                $this->contents = $contents;
Note: See TracChangeset for help on using the changeset viewer.