mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-03 09:50:49 +00:00
c2d3d4a3b4
55227be6c3
Removing SmartFileInfo (#2879)
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Skipper\SkipVoter;
|
|
|
|
use Rector\Skipper\Contract\SkipVoterInterface;
|
|
use Rector\Skipper\Matcher\FileInfoMatcher;
|
|
use Rector\Skipper\SkipCriteriaResolver\SkippedPathsResolver;
|
|
final class PathSkipVoter implements SkipVoterInterface
|
|
{
|
|
/**
|
|
* @readonly
|
|
* @var \Rector\Skipper\Matcher\FileInfoMatcher
|
|
*/
|
|
private $fileInfoMatcher;
|
|
/**
|
|
* @readonly
|
|
* @var \Rector\Skipper\SkipCriteriaResolver\SkippedPathsResolver
|
|
*/
|
|
private $skippedPathsResolver;
|
|
public function __construct(FileInfoMatcher $fileInfoMatcher, SkippedPathsResolver $skippedPathsResolver)
|
|
{
|
|
$this->fileInfoMatcher = $fileInfoMatcher;
|
|
$this->skippedPathsResolver = $skippedPathsResolver;
|
|
}
|
|
/**
|
|
* @param string|object $element
|
|
*/
|
|
public function match($element) : bool
|
|
{
|
|
return \true;
|
|
}
|
|
/**
|
|
* @param string|object $element
|
|
*/
|
|
public function shouldSkip($element, string $filePath) : bool
|
|
{
|
|
$skippedPaths = $this->skippedPathsResolver->resolve();
|
|
return $this->fileInfoMatcher->doesFileInfoMatchPatterns($filePath, $skippedPaths);
|
|
}
|
|
}
|