is missing. } /** * @return bool */ protected function ackEnd(): bool { return true; } /** * @param array $collection * @return array */ protected function transformation( array $collection ): array { $start = array_shift( $collection ); $sc = TokenUtils::getTokenType( $start ); // A stray end tag. if ( $sc === 'EndTagTk' ) { $meta = TokenCollector::buildMetaToken( $this->manager, 'mw:Includes/NoInclude', true, ( $start->dataAttribs->tsr ?? null ), null ); return [ 'tokens' => [ $meta ] ]; } // Handle self-closing tag case specially! if ( $sc === 'SelfclosingTagTk' ) { return ( $this->options['isInclude'] ) ? [ 'tokens' => [] ] : [ 'tokens' => [ TokenCollector::buildMetaToken( $this->manager, 'mw:Includes/NoInclude', false, ( $start->dataAttribs->tsr ?? null ), null ) ] ]; } $tokens = []; $end = array_pop( $collection ); $eof = $end instanceof EOFTk; if ( empty( $this->options['isInclude'] ) ) { // Content is preserved // Add meta tags for open and close $startTSR = $start->dataAttribs->tsr ?? null; $endTSR = $end->dataAttribs->tsr ?? null; $tokens[] = TokenCollector::buildMetaToken( $this->manager, 'mw:Includes/NoInclude', false, $startTSR, null ); $tokens = array_merge( $tokens, $collection ); if ( $end && !$eof ) { $tokens[] = TokenCollector::buildMetaToken( $this->manager, 'mw:Includes/NoInclude', true, $endTSR, null ); } } elseif ( empty( $this->options['inTemplate'] ) ) { // Content is stripped $tokens[] = TokenCollector::buildStrippedMetaToken( $this->manager, 'mw:Includes/NoInclude', $start, ( $eof ) ? null : $end ); } // Preserve EOF if ( $eof ) { $tokens[] = $end; } return [ 'tokens' => $tokens ]; } }