Skip to content

Commit 5069644

Browse files
🐛 Fix iterable
1 parent f74f671 commit 5069644

File tree

4 files changed

+306
-145
lines changed

4 files changed

+306
-145
lines changed

TwigCS/Config/Config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(array $config = [])
4040
/**
4141
* Find all files to process, based on a file or directory and exclude patterns.
4242
*
43-
* @return array
43+
* @return iterable
4444
*
4545
* @throws Exception
4646
*/
@@ -65,7 +65,7 @@ public function findFiles()
6565
$files->exclude($exclude);
6666
}
6767

68-
return iterator_to_array($files, false);
68+
return $files;
6969
}
7070

7171
/**

TwigCS/Runner/Linter.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ public function __construct(Environment $env, Tokenizer $tokenizer)
4040
/**
4141
* Run the linter on the given $files against the given $ruleset.
4242
*
43-
* @param array $files List of files to process.
44-
* @param Ruleset $ruleset Set of rules to check.
45-
* @param bool $fix If true, the linter will fix the file
43+
* @param iterable $files List of files to process.
44+
* @param Ruleset $ruleset Set of rules to check.
45+
* @param bool $fix If true, the linter will fix the file
4646
*
4747
* @return Report an object with all violations and stats.
4848
*
4949
* @throws Exception
5050
*/
51-
public function run(array $files, Ruleset $ruleset, bool $fix = false)
51+
public function run(iterable $files, Ruleset $ruleset, bool $fix = false)
5252
{
5353
if (empty($files)) {
5454
throw new Exception('No files to process, provide at least one file to be linted');
@@ -84,12 +84,12 @@ public function run(array $files, Ruleset $ruleset, bool $fix = false)
8484
}
8585

8686
/**
87-
* @param array $files
88-
* @param Ruleset $ruleset
87+
* @param iterable $files
88+
* @param Ruleset $ruleset
8989
*
9090
* @throws Exception
9191
*/
92-
public function fix(array $files, Ruleset $ruleset)
92+
public function fix(iterable $files, Ruleset $ruleset)
9393
{
9494
$fixer = new Fixer($ruleset, $this->tokenizer);
9595

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"bin": ["bin/twigcs"],
1919
"require": {
20-
"php": ">=7.0",
20+
"php": ">=7.1",
2121
"squizlabs/php_codesniffer": "3.4.*",
2222
"symfony/console": "^3.0 || ^4.0",
2323
"symfony/finder": "^3.0 || ^4.0",

0 commit comments

Comments
 (0)