@@ -824,14 +824,14 @@ private function check_string_has_no_leading_trailing_spaces( $matched_content,
824824 $ first_non_empty = $ this ->phpcsFile ->findNext ( Tokens::$ emptyTokens , $ param_info ['start ' ], ( $ param_info ['end ' ] + 1 ), true );
825825
826826 // Define regex patterns.
827- $ pattern_leading_spaces = '/^[ ]+/u ' ;
828- $ pattern_trailing_spaces = '/[ ]+$/u ' ;
829- $ pattern_leading_tabs = '/^\t+/u ' ;
830- $ pattern_trailing_tabs = '/\t+$/u ' ;
831- $ pattern_leading_newlines = '/^[\r\n]+/u ' ;
832- $ pattern_trailing_newlines = '/[\r\n]+$/u ' ;
827+ $ pattern_leading_spaces = '/^[\x20]+/u ' ;
828+ $ pattern_trailing_spaces = '/[\x20]+$/u ' ;
829+ $ pattern_leading_tabs = '/^\x09+/u ' ;
830+ $ pattern_trailing_tabs = '/\x09+$/u ' ;
833831 $ pattern_leading_vtabs = '/^\x0B+/u ' ;
834832 $ pattern_trailing_vtabs = '/\x0B+$/u ' ;
833+ $ pattern_leading_newlines = '/^\x0A+/u ' ;
834+ $ pattern_trailing_newlines = '/\x0A+$/u ' ;
835835
836836 // Check for leading spaces.
837837 if ( preg_match ( $ pattern_leading_spaces , $ content_without_quotes ) ) {
@@ -873,42 +873,42 @@ private function check_string_has_no_leading_trailing_spaces( $matched_content,
873873 );
874874 }
875875
876- // Check for leading new lines .
877- if ( preg_match ( $ pattern_leading_newlines , $ content_without_quotes ) ) {
876+ // Check for leading vertical tabs .
877+ if ( preg_match ( $ pattern_leading_vtabs , $ content_without_quotes ) ) {
878878 $ this ->phpcsFile ->addError (
879- 'Translatable string should not have leading new lines . Found: %s ' ,
879+ 'Translatable string should not have leading vertical tabs . Found: %s ' ,
880880 $ first_non_empty ,
881- 'LeadingNewLines ' ,
881+ 'LeadingVTabs ' ,
882882 array ( $ param_info ['clean ' ] )
883883 );
884884 }
885885
886- // Check for trailing new lines .
887- if ( preg_match ( $ pattern_trailing_newlines , $ content_without_quotes ) ) {
886+ // Check for trailing vertical tabs .
887+ if ( preg_match ( $ pattern_trailing_vtabs , $ content_without_quotes ) ) {
888888 $ this ->phpcsFile ->addError (
889- 'Translatable string should not have trailing new lines . Found: %s ' ,
889+ 'Translatable string should not have trailing vertical tabs . Found: %s ' ,
890890 $ first_non_empty ,
891- 'TrailingNewLines ' ,
891+ 'TrailingVTabs ' ,
892892 array ( $ param_info ['clean ' ] )
893893 );
894894 }
895-
896- // Check for leading vertical tabs .
897- if ( preg_match ( $ pattern_leading_vtabs , $ content_without_quotes ) ) {
895+
896+ // Check for leading new lines .
897+ if ( preg_match ( $ pattern_leading_newlines , $ content_without_quotes ) ) {
898898 $ this ->phpcsFile ->addError (
899- 'Translatable string should not have leading vertical tabs . Found: %s ' ,
899+ 'Translatable string should not have leading new lines . Found: %s ' ,
900900 $ first_non_empty ,
901- 'LeadingVTabs ' ,
901+ 'LeadingNewLines ' ,
902902 array ( $ param_info ['clean ' ] )
903903 );
904904 }
905905
906- // Check for trailing vertical tabs .
907- if ( preg_match ( $ pattern_trailing_vtabs , $ content_without_quotes ) ) {
906+ // Check for trailing new lines .
907+ if ( preg_match ( $ pattern_trailing_newlines , $ content_without_quotes ) ) {
908908 $ this ->phpcsFile ->addError (
909- 'Translatable string should not have trailing vertical tabs . Found: %s ' ,
909+ 'Translatable string should not have trailing new lines . Found: %s ' ,
910910 $ first_non_empty ,
911- 'TrailingVTabs ' ,
911+ 'TrailingNewLines ' ,
912912 array ( $ param_info ['clean ' ] )
913913 );
914914 }
0 commit comments