Make WordPress Core

Changeset 44117 for trunk


Ignore:
Timestamp:
12/13/2018 05:51:31 PM (8 years ago)
Author:
desrosj
Message:

PHPCS: Fix errors.

Fixes errors introduced in [44116].

File:
1 edited

Legend:

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

    r44116 r44117  
    246246                                if ( 0 === $stack_depth ) {
    247247                                        if ( isset( $leading_html_start ) ) {
    248                                                 $this->output[] = (array) self::freeform( substr(
    249                                                         $this->document,
    250                                                         $leading_html_start,
    251                                                         $start_offset - $leading_html_start
    252                                                 ) );
     248                                                $this->output[] = (array) self::freeform(
     249                                                        substr(
     250                                                                $this->document,
     251                                                                $leading_html_start,
     252                                                                $start_offset - $leading_html_start
     253                                                        )
     254                                                );
    253255                                        }
    254256
    255257                                        $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '' );
    256                                         $this->offset = $start_offset + $token_length;
     258                                        $this->offset   = $start_offset + $token_length;
    257259                                        return true;
    258260                                }
    … …  
    269271                        case 'block-opener':
    270272                                // track all newly-opened blocks on the stack
    271                                 array_push( $this->stack, new WP_Block_Parser_Frame(
    272                                         new WP_Block_Parser_Block( $block_name, $attrs, array(), '' ),
    273                                         $start_offset,
    274                                         $token_length,
    275                                         $start_offset + $token_length,
    276                                         $leading_html_start
    277                                 ) );
     273                                array_push(
     274                                        $this->stack,
     275                                        new WP_Block_Parser_Frame(
     276                                                new WP_Block_Parser_Block( $block_name, $attrs, array(), '' ),
     277                                                $start_offset,
     278                                                $token_length,
     279                                                $start_offset + $token_length,
     280                                                $leading_html_start
     281                                        )
     282                                );
    278283                                $this->offset = $start_offset + $token_length;
    279284                                return true;
    … …  
    306311                                 * block and add it as a new innerBlock to the parent
    307312                                 */
    308                                 $stack_top = array_pop( $this->stack );
     313                                $stack_top                    = array_pop( $this->stack );
    309314                                $stack_top->block->innerHTML .= substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset );
    310                                 $stack_top->prev_offset = $start_offset + $token_length;
     315                                $stack_top->prev_offset       = $start_offset + $token_length;
    311316
    312317                                $this->add_inner_block(
    … …  
    360365                }
    361366
    362                 list( $match, $started_at ) = $matches[ 0 ];
     367                list( $match, $started_at ) = $matches[0];
    363368
    364369                $length    = strlen( $match );
    365                 $is_closer = isset( $matches[ 'closer' ] ) && -1 !== $matches[ 'closer' ][ 1 ];
    366                 $is_void   = isset( $matches[ 'void' ] ) && -1 !== $matches[ 'void' ][ 1 ];
    367                 $namespace = $matches[ 'namespace' ];
    368                 $namespace = ( isset( $namespace ) && -1 !== $namespace[ 1 ] ) ? $namespace[ 0 ] : 'core/';
    369                 $name      = $namespace . $matches[ 'name' ][ 0 ];
    370                 $has_attrs = isset( $matches[ 'attrs' ] ) && -1 !== $matches[ 'attrs' ][ 1 ];
     370                $is_closer = isset( $matches['closer'] ) && -1 !== $matches['closer'][1];
     371                $is_void   = isset( $matches['void'] ) && -1 !== $matches['void'][1];
     372                $namespace = $matches['namespace'];
     373                $namespace = ( isset( $namespace ) && -1 !== $namespace[1] ) ? $namespace[0] : 'core/';
     374                $name      = $namespace . $matches['name'][0];
     375                $has_attrs = isset( $matches['attrs'] ) && -1 !== $matches['attrs'][1];
    371376
    372377                /*
    … …  
    375380                 */
    376381                $attrs = $has_attrs
    377                         ? json_decode( $matches[ 'attrs' ][ 0 ], /* as-associative */ true )
     382                        ? json_decode( $matches['attrs'][0], /* as-associative */ true )
    378383                        : json_decode( '{}', /* don't ask why, just verify in PHP */ false );
    379384
    … …  
    440445         */
    441446        function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) {
    442                 $parent = $this->stack[ count( $this->stack ) - 1 ];
     447                $parent                       = $this->stack[ count( $this->stack ) - 1 ];
    443448                $parent->block->innerBlocks[] = $block;
    444                 $parent->block->innerHTML .= substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset );
    445                 $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length;
     449                $parent->block->innerHTML    .= substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset );
     450                $parent->prev_offset          = $last_offset ? $last_offset : $token_start + $token_length;
    446451        }
    447452
    … …  
    462467
    463468                if ( isset( $stack_top->leading_html_start ) ) {
    464                         $this->output[] = (array) self::freeform( substr(
    465                                 $this->document,
    466                                 $stack_top->leading_html_start,
    467                                 $stack_top->token_start - $stack_top->leading_html_start
    468                         ) );
     469                        $this->output[] = (array) self::freeform(
     470                                substr(
     471                                        $this->document,
     472                                        $stack_top->leading_html_start,
     473                                        $stack_top->token_start - $stack_top->leading_html_start
     474                                )
     475                        );
    469476                }
    470477
Note: See TracChangeset for help on using the changeset viewer.