WordPress.org

Make WordPress Core

Changeset 50657


Ignore:
Timestamp:
04/05/2021 10:36:17 AM (3 weeks ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp-admin/includes/class-wp-filesystem-*.php.

See #52627.

Location:
trunk/src/wp-admin/includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-base.php

    r49936 r50657  
    275275
    276276        foreach ( $folder_parts as $index => $key ) {
    277             if ( $index == $last_index ) {
     277            if ( $index === $last_index ) {
    278278                continue; // We want this to be caught by the next code block.
    279279            }
     
    344344        $perms = intval( $this->getchmod( $file ), 8 );
    345345
    346         if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket.
     346        if ( ( $perms & 0xC000 ) === 0xC000 ) { // Socket.
    347347            $info = 's';
    348         } elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link.
     348        } elseif ( ( $perms & 0xA000 ) === 0xA000 ) { // Symbolic Link.
    349349            $info = 'l';
    350         } elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular.
     350        } elseif ( ( $perms & 0x8000 ) === 0x8000 ) { // Regular.
    351351            $info = '-';
    352         } elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special.
     352        } elseif ( ( $perms & 0x6000 ) === 0x6000 ) { // Block special.
    353353            $info = 'b';
    354         } elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory.
     354        } elseif ( ( $perms & 0x4000 ) === 0x4000 ) { // Directory.
    355355            $info = 'd';
    356         } elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special.
     356        } elseif ( ( $perms & 0x2000 ) === 0x2000 ) { // Character special.
    357357            $info = 'c';
    358         } elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe.
     358        } elseif ( ( $perms & 0x1000 ) === 0x1000 ) { // FIFO pipe.
    359359            $info = 'p';
    360360        } else { // Unknown.
  • trunk/src/wp-admin/includes/class-wp-filesystem-direct.php

    r49936 r50657  
    506506     */
    507507    public function touch( $file, $time = 0, $atime = 0 ) {
    508         if ( 0 == $time ) {
     508        if ( 0 === $time ) {
    509509            $time = time();
    510510        }
    511511
    512         if ( 0 == $atime ) {
     512        if ( 0 === $atime ) {
    513513            $atime = time();
    514514        }
     
    631631            }
    632632
    633             if ( $limit_file && $struc['name'] != $limit_file ) {
     633            if ( $limit_file && $struc['name'] !== $limit_file ) {
    634634                continue;
    635635            }
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php

    r49936 r50657  
    451451        $result = @ftp_chdir( $this->link, trailingslashit( $path ) );
    452452
    453         if ( $result && $path == $this->cwd() || $this->cwd() != $cwd ) {
     453        if ( $result && $path === $this->cwd() || $this->cwd() !== $cwd ) {
    454454            @ftp_chdir( $this->link, $cwd );
    455455            return true;
     
    615615            $b['hour']   = $lucifer[4];
    616616            $b['minute'] = $lucifer[5];
    617             $b['time']   = mktime( $lucifer[4] + ( strcasecmp( $lucifer[6], 'PM' ) == 0 ? 12 : 0 ), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3] );
     617            $b['time']   = mktime( $lucifer[4] + ( strcasecmp( $lucifer[6], 'PM' ) === 0 ? 12 : 0 ), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3] );
    618618            $b['am/pm']  = $lucifer[6];
    619619            $b['name']   = $lucifer[8];
     
    648648                $b['size']   = $lucifer[4];
    649649
    650                 if ( 8 == $lcount ) {
     650                if ( 8 === $lcount ) {
    651651                    sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] );
    652652                    sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] );
     
    746746            }
    747747
    748             if ( $limit_file && $entry['name'] != $limit_file ) {
     748            if ( $limit_file && $entry['name'] !== $limit_file ) {
    749749                continue;
    750750            }
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r49936 r50657  
    211211        $bytes_written = fwrite( $temphandle, $contents );
    212212
    213         if ( false === $bytes_written || strlen( $contents ) != $bytes_written ) {
     213        if ( false === $bytes_written || strlen( $contents ) !== $bytes_written ) {
    214214            fclose( $temphandle );
    215215            unlink( $tempfile );
     
    651651            }
    652652
    653             if ( $limit_file && $struc['name'] != $limit_file ) {
     653            if ( $limit_file && $struc['name'] !== $limit_file ) {
    654654                continue;
    655655            }
  • trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php

    r49936 r50657  
    780780            }
    781781
    782             if ( $limit_file && $struc['name'] != $limit_file ) {
     782            if ( $limit_file && $struc['name'] !== $limit_file ) {
    783783                continue;
    784784            }
Note: See TracChangeset for help on using the changeset viewer.