Index: trunk/tools/code-utils/check-vars.php |
— | — | @@ -129,10 +129,25 @@ |
130 | 130 | 'deprecated-calls' => true, |
131 | 131 | 'deprecated-might' => true, |
132 | 132 | 'poisoned-function' => true, |
133 | | - 'error' => true |
| 133 | + 'error' => true, |
| 134 | + # 'help' keyword is reserved!! |
134 | 135 | ); |
| 136 | + /** print out the default warnings list */ |
| 137 | + static function dumpWarningsKeywords() { |
| 138 | + print "Warning keywords suitable for -W<[no]keyword>:\n"; |
| 139 | + $w = CheckVars::$enabledWarnings ; |
| 140 | + asort( $w ); // sort by status |
| 141 | + print "Keywords disabled by default:\n"; |
| 142 | + $prevStatus = false; |
| 143 | + foreach( $w as $key => $status ) { |
| 144 | + if( $status !== $prevStatus ) { |
| 145 | + $prevStatus = $status; |
| 146 | + print "Keywords enabled by default:\n"; |
| 147 | + } |
| 148 | + print "\t$key\n"; |
| 149 | + } |
| 150 | + } |
135 | 151 | |
136 | | - |
137 | 152 | protected $generateDeprecatedList = false; |
138 | 153 | protected $generateParentList = false; |
139 | 154 | |
— | — | @@ -1059,7 +1074,16 @@ |
1060 | 1075 | } |
1061 | 1076 | |
1062 | 1077 | if( $argc < 2 ) { |
1063 | | - die ("Usage: php $argv[0] [--generate-deprecated-list] [--generate-parent-list] <PHP_source_file1> <PHP_source_file2> ...\n"); |
| 1078 | + die ( |
| 1079 | +"Usage: |
| 1080 | + php $argv[0] [options] <PHP_source_file1> <PHP_source_file2> ... |
| 1081 | + |
| 1082 | +Options: |
| 1083 | + --generate-deprecated-list |
| 1084 | + --generate-parent-list |
| 1085 | + -Whelp : available warnings methods |
| 1086 | + -W[no]key : disabled/enable key warning. |
| 1087 | +"); |
1064 | 1088 | } |
1065 | 1089 | |
1066 | 1090 | $cv = new CheckVars(); |
— | — | @@ -1076,7 +1100,10 @@ |
1077 | 1101 | |
1078 | 1102 | foreach ( $argv as $arg ) { |
1079 | 1103 | if ( preg_match( '/^-W(no-)?(.*)/', $arg, $m ) ) { |
1080 | | - if ( !isset( CheckVars::$enabledWarnings[ $m[2] ] ) ) { |
| 1104 | + if( $m[2] === 'help' ) { |
| 1105 | + CheckVars::dumpWarningsKeywords(); |
| 1106 | + exit; |
| 1107 | + } elseif ( !isset( CheckVars::$enabledWarnings[ $m[2] ] ) ) { |
1081 | 1108 | var_dump($m); |
1082 | 1109 | die( "Wrong warning name $arg\n" ); |
1083 | 1110 | } |