Skip to content

🐛 Fix iterable #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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