@@ -624,91 +624,4 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
624
624
}//end processMultiLineCall()
625
625
626
626
627
- /**
628
- * Processes this test, when one of its tokens is encountered.
629
- *
630
- * @param \PHP_CodeSniffer\Files\File $phpcsFile All the tokens found in the document.
631
- * @param int $stackPtr The position of the current token
632
- * in the stack passed in $tokens.
633
- * @param int $length The length of the new indent.
634
- * @param int $change The difference in length between
635
- * the old and new indent.
636
- *
637
- * @return bool
638
- */
639
- protected function adjustIndent (File $ phpcsFile , $ stackPtr , $ length , $ change )
640
- {
641
- $ tokens = $ phpcsFile ->getTokens ();
642
-
643
- // We don't adjust indents outside of PHP.
644
- if ($ tokens [$ stackPtr ]['code ' ] === T_INLINE_HTML ) {
645
- return false ;
646
- }
647
-
648
- $ padding = '' ;
649
- if ($ length > 0 ) {
650
- if ($ this ->tabIndent === true ) {
651
- $ numTabs = floor ($ length / $ this ->tabWidth );
652
- if ($ numTabs > 0 ) {
653
- $ numSpaces = ($ length - ($ numTabs * $ this ->tabWidth ));
654
- $ padding = str_repeat ("\t" , $ numTabs ).str_repeat (' ' , $ numSpaces );
655
- }
656
- } else {
657
- $ padding = str_repeat (' ' , $ length );
658
- }
659
- }
660
-
661
- if ($ tokens [$ stackPtr ]['column ' ] === 1 ) {
662
- $ trimmed = ltrim ($ tokens [$ stackPtr ]['content ' ]);
663
- $ accepted = $ phpcsFile ->fixer ->replaceToken ($ stackPtr , $ padding .$ trimmed );
664
- } else {
665
- // Easier to just replace the entire indent.
666
- $ accepted = $ phpcsFile ->fixer ->replaceToken (($ stackPtr - 1 ), $ padding );
667
- }
668
-
669
- if ($ accepted === false ) {
670
- return false ;
671
- }
672
-
673
- if ($ tokens [$ stackPtr ]['code ' ] === T_DOC_COMMENT_OPEN_TAG ) {
674
- // We adjusted the start of a comment, so adjust the rest of it
675
- // as well so the alignment remains correct.
676
- for ($ x = ($ stackPtr + 1 ); $ x < $ tokens [$ stackPtr ]['comment_closer ' ]; $ x ++) {
677
- if ($ tokens [$ x ]['column ' ] !== 1 ) {
678
- continue ;
679
- }
680
-
681
- $ length = 0 ;
682
- if ($ tokens [$ x ]['code ' ] === T_DOC_COMMENT_WHITESPACE ) {
683
- $ length = $ tokens [$ x ]['length ' ];
684
- }
685
-
686
- $ padding = ($ length + $ change );
687
- if ($ padding > 0 ) {
688
- if ($ this ->tabIndent === true ) {
689
- $ numTabs = floor ($ padding / $ this ->tabWidth );
690
- $ numSpaces = ($ padding - ($ numTabs * $ this ->tabWidth ));
691
- $ padding = str_repeat ("\t" , $ numTabs ).str_repeat (' ' , $ numSpaces );
692
- } else {
693
- $ padding = str_repeat (' ' , $ padding );
694
- }
695
- } else {
696
- $ padding = '' ;
697
- }
698
-
699
- $ phpcsFile ->fixer ->replaceToken ($ x , $ padding );
700
- if ($ this ->debug === true ) {
701
- $ length = strlen ($ padding );
702
- $ line = $ tokens [$ x ]['line ' ];
703
- $ type = $ tokens [$ x ]['type ' ];
704
- echo "\t=> Indent adjusted to $ length for $ type on line $ line " .PHP_EOL ;
705
- }
706
- }//end for
707
- }//end if
708
-
709
- return true ;
710
-
711
- }//end adjustIndent()
712
-
713
-
714
627
}//end class
0 commit comments