fix some spacing
[lhc/web/wiklou.git] / includes / parser / Preprocessor_HipHop.hphp
index 2593b58..bd5e1a7 100644 (file)
@@ -51,7 +51,7 @@ class Preprocessor_HipHop implements Preprocessor {
         * @param $args array
         * @return PPCustomFrame_HipHop
         */
-       function newCustomFrame( array $args ) {
+       function newCustomFrame( $args ) {
                return new PPCustomFrame_HipHop( $this, $args );
        }
 
@@ -109,7 +109,7 @@ class Preprocessor_HipHop implements Preprocessor {
         * @throws MWException
         * @return PPNode_HipHop_Tree
         */
-       function preprocessToObj( string $text, int $flags = 0 ) {
+       function preprocessToObj( $text, $flags = 0 ) {
                wfProfileIn( __METHOD__ );
 
                // Check cache.
@@ -121,7 +121,7 @@ class Preprocessor_HipHop implements Preprocessor {
                if ( $cacheable ) {
                        wfProfileIn( __METHOD__.'-cacheable' );
 
-                       $cacheKey = strval( wfMemcKey( 'preprocess-hash', md5($text), $flags ) );
+                       $cacheKey = strval( wfMemcKey( 'preprocess-hash', md5( $text ), $flags ) );
                        $cacheValue = strval( $wgMemc->get( $cacheKey ) );
                        if ( $cacheValue !== '' ) {
                                $version = substr( $cacheValue, 0, 8 );
@@ -347,7 +347,7 @@ class Preprocessor_HipHop implements Preprocessor {
 
                                                if ( $stack->top ) {
                                                        $part = $stack->getTop()->getCurrentPart();
-                                                       if ( ! (isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 )) {
+                                                       if ( !(isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 )) {
                                                                $part->visualEnd = $wsStart;
                                                        }
                                                        // Else comments abutting, no change in visual end
@@ -411,7 +411,7 @@ class Preprocessor_HipHop implements Preprocessor {
                                }
                                // <includeonly> and <noinclude> just become <ignore> tags
                                if ( in_array( $lowerName, $ignoredElements ) ) {
-                                       $accum->addNodeWithText(  'ignore', strval( substr( $text, $tagStartPos, $i - $tagStartPos ) ) );
+                                       $accum->addNodeWithText( 'ignore', strval( substr( $text, $tagStartPos, $i - $tagStartPos ) ) );
                                        continue;
                                }
 
@@ -578,7 +578,7 @@ class Preprocessor_HipHop implements Preprocessor {
                                        }
                                }
 
-                               if ($matchingCount <= 0) {
+                               if ( $matchingCount <= 0 ) {
                                        # No matching element found in callback array
                                        # Output a literal closing brace and continue
                                        $accum->addLiteral( str_repeat( $curChar, $count ) );
@@ -671,7 +671,7 @@ class Preprocessor_HipHop implements Preprocessor {
                                $accum = $stack->getAccum();
 
                                # Re-add the old stack element if it still has unmatched opening characters remaining
-                               if ($matchingCount < $piece->count) {
+                               if ( $matchingCount < $piece->count ) {
                                        $piece->parts = array( new PPDPart_HipHop );
                                        $piece->count -= $matchingCount;
                                        # do we still qualify for any callback with remaining count?
@@ -729,7 +729,7 @@ class Preprocessor_HipHop implements Preprocessor {
                $rootNode->lastChild = $stack->rootAccum->lastNode;
 
                // Cache
-               if ($cacheable) {
+               if ( $cacheable ) {
                        $cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . serialize( $rootNode );
                        $wgMemc->set( $cacheKey, $cacheValue, 86400 );
                        wfProfileOut( __METHOD__.'-cache-miss' );
@@ -865,7 +865,7 @@ class PPDStackElement_HipHop {
         * @return PPDAccum_HipHop
         */
        function getAccum() {
-               return PPDAccum_HipHop::cast( $this->parts[count($this->parts) - 1]->out );
+               return PPDAccum_HipHop::cast( $this->parts[count( $this->parts ) - 1]->out );
        }
 
        /**
@@ -879,7 +879,7 @@ class PPDStackElement_HipHop {
         * @return PPDPart_HipHop
         */
        function getCurrentPart() {
-               return PPDPart_HipHop::cast( $this->parts[count($this->parts) - 1] );
+               return PPDPart_HipHop::cast( $this->parts[count( $this->parts ) - 1] );
        }
 
        /**
@@ -1066,11 +1066,12 @@ class PPFrame_HipHop implements PPFrame {
         *
         * @param $args PPNode_HipHop_Array|array|bool
         * @param $title Title|bool
+        * @param $indexOffset A number subtracted from the index attributes of the arguments
         *
         * @throws MWException
         * @return PPTemplateFrame_HipHop
         */
-       function newChild( $args = false, $title = false ) {
+       function newChild( $args = false, $title = false, $indexOffset = 0 ) {
                $namedArgs = array();
                $numberedArgs = array();
                if ( $title === false ) {
@@ -1215,7 +1216,7 @@ class PPFrame_HipHop implements PPFrame {
                                        }
                                        # Add a strip marker in PST mode so that pstPass2() can run some old-fashioned regexes on the result
                                        # Not in RECOVER_COMMENTS mode (extractSections) though
-                                       elseif ( $this->parser->ot['wiki'] && ! ( $flags & PPFrame::RECOVER_COMMENTS ) ) {
+                                       elseif ( $this->parser->ot['wiki'] && !( $flags & PPFrame::RECOVER_COMMENTS ) ) {
                                                $out .= $this->parser->insertStripItem( $contextNode->firstChild->value );
                                        }
                                        # Recover the literal comment in RECOVER_COMMENTS and pre+no-remove
@@ -1568,8 +1569,8 @@ class PPTemplateFrame_HipHop extends PPFrame_HipHop {
         */
        function getNumberedArguments() {
                $arguments = array();
-               foreach ( array_keys($this->numberedArgs) as $key ) {
-                       $arguments[$key] = $this->getArgument($key);
+               foreach ( array_keys( $this->numberedArgs ) as $key ) {
+                       $arguments[$key] = $this->getArgument( $key );
                }
                return $arguments;
        }
@@ -1579,8 +1580,8 @@ class PPTemplateFrame_HipHop extends PPFrame_HipHop {
         */
        function getNamedArguments() {
                $arguments = array();
-               foreach ( array_keys($this->namedArgs) as $key ) {
-                       $arguments[$key] = $this->getArgument($key);
+               foreach ( array_keys( $this->namedArgs ) as $key ) {
+                       $arguments[$key] = $this->getArgument( $key );
                }
                return $arguments;
        }
@@ -1883,6 +1884,7 @@ class PPNode_HipHop_Tree implements PPNode {
        /**
         * Split a <template> or <tplarg> node
         *
+        * @throws MWException
         * @return array
         */
        function splitTemplate() {