Skip to content

Commit 9196842

Browse files
committed
Adding ability to not check anonymous functions.
Add --skip-anonymous-functions when running for anonymous functions to be ignored.
1 parent 3358208 commit 9196842

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

PhpDocblockChecker/CheckerCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ protected function configure()
6666
->addOption('directory', 'd', InputOption::VALUE_REQUIRED, 'Directory to scan.', './')
6767
->addOption('skip-classes', null, InputOption::VALUE_NONE, 'Don\'t check classes for docblocks.')
6868
->addOption('skip-methods', null, InputOption::VALUE_NONE, 'Don\'t check methods for docblocks.')
69+
->addOption('skip-anonymous-functions', null, InputOption::VALUE_NONE, 'Don\'t check anonymous functions for docblocks.')
6970
->addOption('json', 'j', InputOption::VALUE_NONE, 'Output JSON instead of a log.');
7071
}
7172

@@ -79,6 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7980
$this->output = $output;
8081
$this->skipClasses = $input->getOption('skip-classes');
8182
$this->skipMethods = $input->getOption('skip-methods');
83+
$this->skipAnonymousFunctions = $input->getOption('skip-anonymous-functions');
8284

8385
// Set up excludes:
8486
if (!is_null($exclude)) {
@@ -152,6 +154,10 @@ protected function processFile($file)
152154
if (!$this->skipMethods) {
153155
foreach ($class['methods'] as $methodName => $method) {
154156
if (is_null($method['docblock'])) {
157+
if ($this->skipAnonymousFunctions && $methodName == 'anonymous function') {
158+
continue;
159+
}
160+
155161
$errors = true;
156162

157163
$this->report[] = array(

0 commit comments

Comments
 (0)