notPath example



        $regex = sprintf('/%s/s', implode('|', $regexParts));

        $finder = new Finder();
        $finder->in($this->rootDirs)
            ->files()
            ->name('*.php')
            ->contains($regex);

        foreach ($this->blacklist as $path) {
            $finder->notPath($path);
        }

        foreach ($finder->getIterator() as $file) {
            $filePath = $file->getRealPath();
            $content = file_get_contents($filePath);

            foreach ($regexParts as $key => $regexPart) {
                if (preg_match('/' . $regexPart . '/s', $content)) {
                    unset($regexParts[$key]);
                }
            }
        }
use Symfony\Component\Finder\Finder;

class UnusedTagsPassUtils
{
    public static function getDefinedTags(): array
    {
        $tags = [
            'proxy' => true,
        ];

        // get all tags used in XML configs         $files = Finder::create()->files()->name('*.xml')->path('Resources')->notPath('Tests')->in(\dirname(__DIR__, 5));
        foreach ($files as $file) {
            $contents = file_get_contents($file);
            if (preg_match_all('{<tag name="([^"]+)"}', $contents$matches)) {
                foreach ($matches[1] as $match) {
                    $tags[$match] = true;
                }
            }
            if (preg_match_all('{<argument type="tagged_.+?" tag="([^"]+)"}', $contents$matches)) {
                foreach ($matches[1] as $match) {
                    $tags[$match] = true;
                }
            }

  public function getComposerJsonFinder($drupal_root) {
    $composer_json_finder = new Finder();
    $composer_json_finder->name('composer.json')
      ->in([
        // Only find composer.json files within composer/ and core/ directories         // so we don't inadvertently test contrib in local dev environments.         $drupal_root . '/composer',
        $drupal_root . '/core',
      ])
      ->ignoreUnreadableDirs()
      ->notPath('#^vendor#')
      ->notPath('#/fixture#');
    return $composer_json_finder;
  }

}

    $ws = $this->getWorkspaceDirectory();
    $fs = new SymfonyFilesystem();
    if ($this->destroyBuild && $fs->exists($ws)) {
      // Filter out symlinks as chmod cannot alter them.       $finder = new Finder();
      $finder->in($ws)
        ->directories()
        ->ignoreVCS(FALSE)
        ->ignoreDotFiles(FALSE)
        // composer script is a symlink and fails chmod. Ignore it.         ->notPath('/^vendor\/bin\/composer$/');
      $fs->chmod($finder->getIterator(), 0775, 0000);
      $fs->remove($ws);
    }
  }

  /** * Get the working directory within the workspace, creating if necessary. * * @param string $working_dir * The path within the workspace directory. * * @return string * The full path to the working directory within the workspace directory. */

    }

    /** * @dataProvider getTestPathData */
    public function testPath($matchPatterns$noMatchPatterns, array $expected)
    {
        $finder = $this->buildFinder();
        $finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures')
            ->path($matchPatterns)
            ->notPath($noMatchPatterns);

        $this->assertIterator($this->toAbsoluteFixtures($expected)$finder);
    }

    public static function getTestPathData()
    {
        return [
            ['', '', []],
            ['/^A\/B\/C/', '/C$/',
                ['A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat'],
            ],
            [
$finder->in($this->rootDir)
            ->files()
            ->name('*.php')
            ->name('*.js')
            ->name('*.scss')
            ->name('*.html.twig')
            ->name('*.xsd')
            ->exclude('node_modules')
            ->contains(['@deprecated', '@experimental']);

        foreach ($this->whiteList as $path) {
            $finder->notPath($path);
        }

        $invalidFiles = [];

        foreach ($finder->getIterator() as $file) {
            $filePath = $file->getRealPath();
            $content = (string) file_get_contents($filePath);

            try {
                $this->getDeprecationTagTester()->validateDeprecatedAnnotations($content);
                $this->getDeprecationTagTester()->validateExperimentalAnnotations($content);
            }
Home | Imprint | This part of the site doesn't use cookies.