Make WordPress Core

Changeset 44266


Ignore:
Timestamp:
12/17/2018 05:06:03 PM (8 years ago)
Author:
desrosj
Message:

PHPCS: Fix code formatting issues.

In [44264], several code formatting issues were introduced. This fixes them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-parser.php

    r44264 r44266  
    6464
    6565        function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) {
    66                 $this->blockName   = $name;
    67                 $this->attrs       = $attrs;
    68                 $this->innerBlocks = $innerBlocks;
    69                 $this->innerHTML   = $innerHTML;
     66                $this->blockName    = $name;
     67                $this->attrs        = $attrs;
     68                $this->innerBlocks  = $innerBlocks;
     69                $this->innerHTML    = $innerHTML;
    7070                $this->innerContent = $innerContent;
    7171        }
    … …  
    270270                                if ( 0 === $stack_depth ) {
    271271                                        if ( isset( $leading_html_start ) ) {
    272                                                 $this->output[] = (array) self::freeform( substr(
    273                                                         $this->document,
    274                                                         $leading_html_start,
    275                                                         $start_offset - $leading_html_start
    276                                                 ) );
     272                                                $this->output[] = (array) self::freeform(
     273                                                        substr(
     274                                                                $this->document,
     275                                                                $leading_html_start,
     276                                                                $start_offset - $leading_html_start
     277                                                        )
     278                                                );
    277279                                        }
    278280
    279281                                        $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() );
    280                                         $this->offset = $start_offset + $token_length;
     282                                        $this->offset   = $start_offset + $token_length;
    281283                                        return true;
    282284                                }
    … …  
    293295                        case 'block-opener':
    294296                                // track all newly-opened blocks on the stack
    295                                 array_push( $this->stack, new WP_Block_Parser_Frame(
    296                                         new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ),
    297                                         $start_offset,
    298                                         $token_length,
    299                                         $start_offset + $token_length,
    300                                         $leading_html_start
    301                                 ) );
     297                                array_push(
     298                                        $this->stack,
     299                                        new WP_Block_Parser_Frame(
     300                                                new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ),
     301                                                $start_offset,
     302                                                $token_length,
     303                                                $start_offset + $token_length,
     304                                                $leading_html_start
     305                                        )
     306                                );
    302307                                $this->offset = $start_offset + $token_length;
    303308                                return true;
    … …  
    330335                                 * block and add it as a new innerBlock to the parent
    331336                                 */
    332                                 $stack_top = array_pop( $this->stack );
    333                                 $html = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset );
    334                                 $stack_top->block->innerHTML .= $html;
     337                                $stack_top                        = array_pop( $this->stack );
     338                                $html                             = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset );
     339                                $stack_top->block->innerHTML     .= $html;
    335340                                $stack_top->block->innerContent[] = $html;
    336                                 $stack_top->prev_offset = $start_offset + $token_length;
     341                                $stack_top->prev_offset           = $start_offset + $token_length;
    337342
    338343                                $this->add_inner_block(
    … …  
    386391                }
    387392
    388                 list( $match, $started_at ) = $matches[ 0 ];
     393                list( $match, $started_at ) = $matches[0];
    389394
    390395                $length    = strlen( $match );
    391                 $is_closer = isset( $matches[ 'closer' ] ) && -1 !== $matches[ 'closer' ][ 1 ];
    392                 $is_void   = isset( $matches[ 'void' ] ) && -1 !== $matches[ 'void' ][ 1 ];
    393                 $namespace = $matches[ 'namespace' ];
    394                 $namespace = ( isset( $namespace ) && -1 !== $namespace[ 1 ] ) ? $namespace[ 0 ] : 'core/';
    395                 $name      = $namespace . $matches[ 'name' ][ 0 ];
    396                 $has_attrs = isset( $matches[ 'attrs' ] ) && -1 !== $matches[ 'attrs' ][ 1 ];
     396                $is_closer = isset( $matches['closer'] ) && -1 !== $matches['closer'][1];
     397                $is_void   = isset( $matches['void'] ) && -1 !== $matches['void'][1];
     398                $namespace = $matches['namespace'];
     399                $namespace = ( isset( $namespace ) && -1 !== $namespace[1] ) ? $namespace[0] : 'core/';
     400                $name      = $namespace . $matches['name'][0];
     401                $has_attrs = isset( $matches['attrs'] ) && -1 !== $matches['attrs'][1];
    397402
    398403                /*
    … …  
    401406                 */
    402407                $attrs = $has_attrs
    403                         ? json_decode( $matches[ 'attrs' ][ 0 ], /* as-associative */ true )
     408                        ? json_decode( $matches['attrs'][0], /* as-associative */ true )
    404409                        : $this->empty_attrs;
    405410
    … …  
    466471         */
    467472        function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) {
    468                 $parent = $this->stack[ count( $this->stack ) - 1 ];
     473                $parent                       = $this->stack[ count( $this->stack ) - 1 ];
    469474                $parent->block->innerBlocks[] = (array) $block;
    470                 $html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset );
     475                $html                         = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset );
    471476
    472477                if ( ! empty( $html ) ) {
    473                         $parent->block->innerHTML .= $html;
     478                        $parent->block->innerHTML     .= $html;
    474479                        $parent->block->innerContent[] = $html;
    475480                }
    476481
    477482                $parent->block->innerContent[] = null;
    478                 $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length;
     483                $parent->prev_offset           = $last_offset ? $last_offset : $token_start + $token_length;
    479484        }
    480485
    … …  
    495500
    496501                if ( ! empty( $html ) ) {
    497                         $stack_top->block->innerHTML .= $html;
     502                        $stack_top->block->innerHTML     .= $html;
    498503                        $stack_top->block->innerContent[] = $html;
    499504                }
    500505
    501506                if ( isset( $stack_top->leading_html_start ) ) {
    502                         $this->output[] = (array) self::freeform( substr(
    503                                 $this->document,
    504                                 $stack_top->leading_html_start,
    505                                 $stack_top->token_start - $stack_top->leading_html_start
    506                         ) );
     507                        $this->output[] = (array) self::freeform(
     508                                substr(
     509                                        $this->document,
     510                                        $stack_top->leading_html_start,
     511                                        $stack_top->token_start - $stack_top->leading_html_start
     512                                )
     513                        );
    507514                }
    508515
Note: See TracChangeset for help on using the changeset viewer.