Skip to content

Commit

Permalink
Merge pull request #67 from VincentLanglet/fixTwig
Browse files Browse the repository at this point in the history
🐛 Fix iterable
  • Loading branch information
VincentLanglet authored Jul 1, 2019
2 parents f74f671 + 5069644 commit 019067d
Show file tree
Hide file tree
Showing 4 changed files with 306 additions and 145 deletions.
4 changes: 2 additions & 2 deletions TwigCS/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(array $config = [])
/**
* Find all files to process, based on a file or directory and exclude patterns.
*
* @return array
* @return iterable
*
* @throws Exception
*/
Expand All @@ -65,7 +65,7 @@ public function findFiles()
$files->exclude($exclude);
}

return iterator_to_array($files, false);
return $files;
}

/**
Expand Down
14 changes: 7 additions & 7 deletions TwigCS/Runner/Linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ public function __construct(Environment $env, Tokenizer $tokenizer)
/**
* Run the linter on the given $files against the given $ruleset.
*
* @param array $files List of files to process.
* @param Ruleset $ruleset Set of rules to check.
* @param bool $fix If true, the linter will fix the file
* @param iterable $files List of files to process.
* @param Ruleset $ruleset Set of rules to check.
* @param bool $fix If true, the linter will fix the file
*
* @return Report an object with all violations and stats.
*
* @throws Exception
*/
public function run(array $files, Ruleset $ruleset, bool $fix = false)
public function run(iterable $files, Ruleset $ruleset, bool $fix = false)
{
if (empty($files)) {
throw new Exception('No files to process, provide at least one file to be linted');
Expand Down Expand Up @@ -84,12 +84,12 @@ public function run(array $files, Ruleset $ruleset, bool $fix = false)
}

/**
* @param array $files
* @param Ruleset $ruleset
* @param iterable $files
* @param Ruleset $ruleset
*
* @throws Exception
*/
public function fix(array $files, Ruleset $ruleset)
public function fix(iterable $files, Ruleset $ruleset)
{
$fixer = new Fixer($ruleset, $this->tokenizer);

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"bin": ["bin/twigcs"],
"require": {
"php": ">=7.0",
"php": ">=7.1",
"squizlabs/php_codesniffer": "3.4.*",
"symfony/console": "^3.0 || ^4.0",
"symfony/finder": "^3.0 || ^4.0",
Expand Down
Loading

0 comments on commit 019067d

Please sign in to comment.