Skip to content

Commit

Permalink
\[PMakowski] squizlabs#2.5.1.x-dev: matching PHPCS coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Makowski committed Mar 18, 2016
1 parent 169a4f9 commit 109f51f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions CodeSniffer.php
Expand Up @@ -269,6 +269,10 @@ public function __construct(
*/
public static function autoload($className)
{
if (class_exists($className, false) === true) {
return;
}

if (substr($className, 0, 4) === 'PHP_') {
$newClassName = substr($className, 4);
} else {
Expand Down Expand Up @@ -1789,11 +1793,12 @@ public function processFile($file, $contents=null)
$reportData = $this->reporting->prepareFileReport($phpcsFile);
$reportClass->generateFileReport($reportData, $phpcsFile, $cliValues['showSources'], $cliValues['reportWidth']);

if (empty(PHP_CODESNIFFER_EDITOR_PATH)) {
if (empty(PHP_CODESNIFFER_EDITOR_PATH) === true) {
echo '<ENTER> to recheck, [s] to skip or [q] to quit : ';
} else {
echo '<ENTER> to recheck, [s] to skip, [o] to open in editor or [q] to quit : ';
}

$input = fgets(STDIN);
$input = trim($input);

Expand All @@ -1804,7 +1809,7 @@ public function processFile($file, $contents=null)
exit(0);
break;
case 'o':
if (false == empty(PHP_CODESNIFFER_EDITOR_PATH)) {
if (false === empty(PHP_CODESNIFFER_EDITOR_PATH)) {
exec(PHP_CODESNIFFER_EDITOR_PATH.' '.$file);
}
break;
Expand Down
5 changes: 3 additions & 2 deletions CodeSniffer/CLI.php
Expand Up @@ -708,14 +708,15 @@ public function processLongArgument($arg, $pos)
$this->values['warningSeverity'] = (int) substr($arg, 17);
} else if (substr($arg, 0, 12) === 'editor-path=') {
$value = substr($arg, 12);
if (preg_match('/^[\'\"]/', $value, $matches)) {
if (1 === preg_match('/^[\'\"]/', $value, $matches)) {
while (0 === preg_match("/[{$matches[0]}]$/", $value)) {
$value .= ' '.$this->_cliArgs[++$pos];
$this->_cliArgs[$pos] = '';
}

$value = substr($value, 1, -1);
}

$this->values['editorPath'] = $value;
} else if (substr($arg, 0, 7) === 'ignore=') {
// Split the ignore string on commas, unless the comma is escaped
Expand Down

0 comments on commit 109f51f

Please sign in to comment.