Skip to content

Commit 76011f6

Browse files
committed
PrefixAllGlobals: improve error message clarity
When people run the sniffs without the `-s` option, the messages for some of the errors in this sniff were not specific enough as the "Prefix**AllGlobals**" part would not be seen. I considered adjusting the error message template `ERROR_MSG`, however, this would cause more confusion as, for instance, namespace declarations will **always** be in the global namespace. So, I've opted to adjust select error messages instead.
1 parent 7e54b98 commit 76011f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public function process_token( $stackPtr ) {
367367
return;
368368
}
369369

370-
$error_text = 'Functions declared';
370+
$error_text = 'Functions declared in the global namespace';
371371
$error_code = 'NonPrefixedFunctionFound';
372372
break;
373373

@@ -555,7 +555,7 @@ protected function process_variable_variable( $stackPtr ) {
555555
$stackPtr,
556556
'NonPrefixedVariableFound',
557557
array(
558-
'Variables defined',
558+
'Global variables defined',
559559
$variable_name,
560560
)
561561
);
@@ -705,7 +705,7 @@ protected function process_variable_assignment( $stackPtr ) {
705705
$is_error,
706706
'NonPrefixedVariableFound',
707707
array(
708-
'Variables defined',
708+
'Global variables defined',
709709
'$' . $variable_name,
710710
)
711711
);

0 commit comments

Comments
 (0)