From 168804cd5353f1414d987f2ed6efef31c7c7e108 Mon Sep 17 00:00:00 2001 From: Ken Guest Date: Thu, 19 Nov 2015 12:15:50 +0000 Subject: [PATCH] Set $values['standard'] is set when generator is. This is to fix the following from happening: $ phpcs --generator=Markdown . PHP Warning: Invalid argument supplied for foreach() in /usr/share/php/PHP/CodeSniffer/CLI.php on line 789 PHP Stack trace: PHP 1. {main}() /usr/bin/phpcs:0 PHP 2. PHP_CodeSniffer_CLI->runphpcs() /usr/bin/phpcs:25 PHP 3. PHP_CodeSniffer_CLI->process() /usr/share/php/PHP/CodeSniffer/CLI.php:95 --- CodeSniffer/CLI.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CodeSniffer/CLI.php b/CodeSniffer/CLI.php index 4c14172c72..4de52df692 100644 --- a/CodeSniffer/CLI.php +++ b/CodeSniffer/CLI.php @@ -782,6 +782,9 @@ public function process($values=array()) if ($values['generator'] !== '') { $phpcs = new PHP_CodeSniffer($values['verbosity']); + if (is_null($values['standard'])) { + $values['standard'] = $this->validateStandard(null); + } foreach ($values['standard'] as $standard) { $phpcs->generateDocs( $standard,