Skip to content

Commit

Permalink
Merge pull request #31 from eclipxe13/master
Browse files Browse the repository at this point in the history
Feature: set cache option from configuration file
  • Loading branch information
overtrue authored Feb 9, 2018
2 parents 95bc42f + 8ecfcd4 commit 47066fe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Options:
-c, --configuration=CONFIGURATION Read configuration from config file (default: ./.phplint.yml).
--no-configuration Ignore default configuration file (default: ./.phplint.yml).
--no-cache Ignore cached data.
--cache=CACHE Path to the cache file.
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
Expand All @@ -56,6 +57,7 @@ You can also define configuration as a file `.phplint.yml`:
```yaml
path: ./
jobs: 10
cache: build/phplint.cache
extensions:
- php
exclude:
Expand Down Expand Up @@ -102,4 +104,3 @@ $errors = $linter->lint();
## License

MIT

5 changes: 3 additions & 2 deletions src/Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$linter = new Linter($options['path'], $options['exclude'], $options['extensions']);
$linter->setProcessLimit($options['jobs']);

if (null !== $input->getOption('cache')) {
Cache::setFilename($input->getOption('cache'));
if ($options['cache']) {
Cache::setFilename($options['cache']);
}

$usingCache = 'No';
Expand Down Expand Up @@ -261,6 +261,7 @@ protected function mergeOptions()
{
$options = $this->input->getOptions();
$options['path'] = $this->input->getArgument('path');
$options['cache'] = $this->input->getOption('cache');

$config = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Process/Lint.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function hasSyntaxError()
}

/**
* @return bool|string
* @return bool|array
*/
public function getSyntaxError()
{
Expand Down

0 comments on commit 47066fe

Please sign in to comment.