function FileList::addFile
Add a file to the list.
If a file object has already been created, it can be passed here. If it is left NULL, it will be created when accessed.
Parameters
string $path The path to the file being added.:
\PHP_CodeSniffer\Files\File $file The file being added.:
Return value
void
1 call to FileList::addFile()
- FileList::__construct in vendor/
squizlabs/ php_codesniffer/ src/ Files/ FileList.php - Constructs a file list and loads in an array of file paths to process.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Files/ FileList.php, line 118
Class
Namespace
PHP_CodeSniffer\FilesCode
public function addFile($path, $file = null) {
// No filtering is done for STDIN when the filename
// has not been specified.
if ($path === 'STDIN') {
$this->files[$path] = $file;
$this->numFiles++;
return;
}
$filterClass = $this->getFilterClass();
$di = new RecursiveArrayIterator([
$path,
]);
$filter = new $filterClass($di, $path, $this->config, $this->ruleset);
$iterator = new RecursiveIteratorIterator($filter);
foreach ($iterator as $path) {
$this->files[$path] = $file;
$this->numFiles++;
}
}