Browse files

Fixed bug #19324 : Setting show_warnings configuration option does no…

…t work
  • Loading branch information...
1 parent c946650 commit c8ac067ea5519c5e4d7fb801722eb2c7b858e844 @gsherwood gsherwood committed Mar 12, 2012
Showing with 26 additions and 31 deletions.
  1. +25 −31 CodeSniffer/CLI.php
  2. +1 −0 package.xml
View
56 CodeSniffer/CLI.php
@@ -83,33 +83,26 @@ public function checkRequirements()
public function getDefaults()
{
// The default values for config settings.
- $defaults['files'] = array();
- $defaults['standard'] = null;
- $defaults['verbosity'] = 0;
- $defaults['interactive'] = false;
- $defaults['local'] = false;
- $defaults['showSources'] = false;
- $defaults['extensions'] = array();
- $defaults['sniffs'] = array();
- $defaults['ignored'] = array();
- $defaults['reportFile'] = null;
- $defaults['generator'] = '';
- $defaults['reports'] = array();
+ $defaults['files'] = array();
+ $defaults['standard'] = null;
+ $defaults['verbosity'] = 0;
+ $defaults['interactive'] = false;
+ $defaults['local'] = false;
+ $defaults['showSources'] = false;
+ $defaults['extensions'] = array();
+ $defaults['sniffs'] = array();
+ $defaults['ignored'] = array();
+ $defaults['reportFile'] = null;
+ $defaults['generator'] = '';
+ $defaults['reports'] = array();
+ $defaults['errorSeverity'] = null;
+ $defaults['warningSeverity'] = null;
$reportFormat = PHP_CodeSniffer::getConfigData('report_format');
if ($reportFormat !== null) {
$defaults['reports'][$reportFormat] = null;
}
- $defaults['warningSeverity'] = null;
- $showWarnings = PHP_CodeSniffer::getConfigData('show_warnings');
- if ($showWarnings !== null) {
- $showWarnings = (bool) $showWarnings;
- if ($showWarnings === false) {
- $defaults['warningSeverity'] = 0;
- }
- }
-
$tabWidth = PHP_CodeSniffer::getConfigData('tab_width');
if ($tabWidth === null) {
$defaults['tabWidth'] = 0;
@@ -125,28 +118,29 @@ public function getDefaults()
}
$severity = PHP_CodeSniffer::getConfigData('severity');
- if ($severity === null) {
- $defaults['errorSeverity'] = null;
- $defaults['warningSeverity'] = null;
- } else {
+ if ($severity !== null) {
$defaults['errorSeverity'] = (int) $severity;
$defaults['warningSeverity'] = (int) $severity;
}
$severity = PHP_CodeSniffer::getConfigData('error_severity');
- if ($severity === null) {
- $defaults['errorSeverity'] = null;
- } else {
+ if ($severity !== null) {
$defaults['errorSeverity'] = (int) $severity;
}
$severity = PHP_CodeSniffer::getConfigData('warning_severity');
- if ($severity === null) {
- $defaults['warningSeverity'] = null;
- } else {
+ if ($severity !== null) {
$defaults['warningSeverity'] = (int) $severity;
}
+ $showWarnings = PHP_CodeSniffer::getConfigData('show_warnings');
+ if ($showWarnings !== null) {
+ $showWarnings = (bool) $showWarnings;
+ if ($showWarnings === false) {
+ $defaults['warningSeverity'] = 0;
+ }
+ }
+
$reportWidth = PHP_CodeSniffer::getConfigData('report_width');
if ($reportWidth === null) {
$defaults['reportWidth'] = 80;
View
1 package.xml
@@ -36,6 +36,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
-- Thanks to Peter Philipp for the patch
- Fixed an issue in AbstractPatternSniff where comments were not being ignored in some cases
- Fixed bug #19290 : Generic indent sniffer fails for anonymous functions
+ - Fixed bug #19324 : Setting show_warnings configuration option does not work
</notes>
<contents>
<dir name="/">

0 comments on commit c8ac067

Please sign in to comment.