exclude example

public function testDateWithArrayParam()
    {
        $finder = $this->buildFinder();
        $this->assertSame($finder$finder->files()->date(['>= 2005-10-15', 'until last month']));
        $this->assertIterator($this->toAbsolute(['foo/bar.tmp', 'test.php'])$finder->in(self::$tmpDir)->getIterator());
    }

    public function testExclude()
    {
        $finder = $this->buildFinder();
        $this->assertSame($finder$finder->exclude('foo'));
        $this->assertIterator($this->toAbsolute([
            'test.php',
            'test.py',
            'toto',
            'foo bar',
            'qux',
            'qux/baz_100_1.py',
            'zebulon.php',
            'Zephire.php',
            'qux/baz_1_2.py',
            'qux_0_1.php',
            
return function DContainerConfigurator $c) {
    $s = $c->services()->defaults()->public();
    $s->instanceof(Prototype\Foo::class)
        ->property('p', 0)
        ->call('setFoo', [service('foo')])
        ->tag('tag', ['k' => 'v'])
        ->share(false)
        ->lazy()
        ->configurator('c')
        ->property('p', 1);

    $s->load(Prototype::class.'\\', '../Prototype')->exclude('../Prototype/*/*');

    $s->set('foo', FooService::class);
};


    $base->tearDown();
  }

  /** * @covers ::findAvailablePort */
  public function testPortMany() {
    $iterator = (new Finder())->in($this->getDrupalRoot())
      ->ignoreDotFiles(FALSE)
      ->exclude(['sites/simpletest'])
      ->path('/^.ht.router.php$/')
      ->getIterator();
    $this->copyCodebase($iterator);
    /** @var \Symfony\Component\Process\Process[] $processes */
    $processes = [];
    $count = 15;
    for ($i = 0; $i <= $count$i++) {
      $port = $this->findAvailablePort();
      $this->assertArrayNotHasKey($port$processes, 'Port ' . $port . ' was already in use by a process.');
      $processes[$port] = $this->instantiateServer($port);
      $this->assertNotEmpty($processes[$port]);
      

    private function findTemplatesInDirectory(string $dir, string $namespace = null, array $excludeDirs = []): array
    {
        if (!is_dir($dir)) {
            return [];
        }

        $templates = [];
        foreach (Finder::create()->files()->followLinks()->in($dir)->exclude($excludeDirs)->name($this->namePatterns) as $file) {
            $templates[] = (null !== $namespace ? '@'.$namespace.'/' : '').str_replace('\\', '/', $file->getRelativePathname());
        }

        return $templates;
    }
}

#[Package('core')] class ClassNamespaceTest extends TestCase
{
    public function testAllProductionFilesAreNamespacedCorrectly(): void
    {
        $basePath = __DIR__ . '/../../../';
        $basePathParts = explode('/', $basePath);

        $phpFiles = (new Finder())->files()
            ->in($basePath)
            ->exclude('WebInstaller')
            ->name('*.php')->getIterator();

        $errors = [];
        foreach ($phpFiles as $file) {
            if ($this->hasNamespaceDefined($file) === false) {
                continue;
            }

            $parts = $this->extractProductionNamespaceParts($file$basePathParts);

            $path = implode('\\', $parts);
            
return self::GITHUB_BASE_LINK . $relativePath;
    }

    /** * @return list<class-string<object>> */
    private function findScriptServices(): array
    {
        $scriptServices = [];

        $shopwareClasses = ConstructFinder::locatedIn(__DIR__ . '/../../../..')
            ->exclude('*/Test/*', '*/vendor/*', '*/DevOps/StaticAnalyze*')
            ->findClassNames();

        foreach ($shopwareClasses as $class) {
            if (!class_exists($class)) {
                // skip not autoloadable test classes                 continue;
            }

            $reflection = new \ReflectionClass($class);

            if (!$reflection->getDocComment()) {
                
return $paths;
    }

    /** * @return array<int, string> */
    private function findSnippetFiles(?string $locale = null, bool $withPlugins = true): array
    {
        $finder = (new Finder())
            ->files()
            ->in(__DIR__ . '/../../*/Resources/app/administration/src/')
            ->exclude('node_modules')
            ->ignoreUnreadableDirs();

        if ($locale) {
            $finder->name(sprintf('%s.json', $locale));
        } else {
            $finder->name('/[a-z]{2}-[A-Z]{2}\.json/');
        }

        if ($withPlugins) {
            $finder->in($this->getPluginPaths());
        }

        
public function getScriptPathsForApp(string $appPath): array
    {
        $scriptDirectory = $this->appLoader->locatePath($appPath, self::SCRIPT_DIR);

        if ($scriptDirectory === null || !is_dir($scriptDirectory)) {
            return [];
        }

        $finder = new Finder();
        $finder->files()
            ->in($scriptDirectory)
            ->exclude('rule-conditions')
            ->name(self::ALLOWED_FILE_EXTENSIONS)
            ->ignoreUnreadableDirs();

        return array_values(array_map(static fn (\SplFileInfo $file): string => ltrim(mb_substr($file->getPathname()mb_strlen($scriptDirectory)), '/')iterator_to_array($finder)));
    }

    /** * Returns the content of the script */
    public function getScriptContent(string $name, string $appPath): string
    {
        

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype;

return function DContainerConfigurator $c) {
    $di = $c->services()->defaults()
        ->tag('baz');
    $di->load(Prototype::class.'\\', '../Prototype')
        ->public()
        ->autoconfigure()
        ->exclude(['../Prototype/OtherDir', '../Prototype/BadClasses', '../Prototype/SinglyImplementedInterface', '../Prototype/StaticConstructor'])
        ->factory('f')
        ->deprecate('vendor/package', '1.1', '%service_id%')
        ->args([0])
        ->args([1])
        ->autoconfigure(false)
        ->tag('foo')
        ->parent('foo');
    $di->set('foo')->lazy()->abstract()->public();
    $di->get(Prototype\Foo::class)->lazy(false);
};
if ($request->get('reduce-aggregations') === null) {
            foreach ($filters as $filter) {
                $aggregations = array_merge($aggregations$filter->getAggregations());
            }

            return $aggregations;
        }

        foreach ($filters as $filter) {
            $excluded = $filters->filtered();

            if ($filter->exclude()) {
                $excluded = $excluded->blacklist($filter->getName());
            }

            foreach ($filter->getAggregations() as $aggregation) {
                if ($aggregation instanceof FilterAggregation) {
                    $aggregation->addFilters($excluded->getFilters());

                    $aggregations[] = $aggregation;

                    continue;
                }

                
public function testNoIdleFeatureFlagsArePresent(): void
    {
        // init FeatureConfig         $registeredFlags = array_keys(Feature::getAll());
        $platformDir = \dirname(__DIR__, 4);

        // Find the right files to check         $finder = new Finder();
        $finder->files()
            ->in($platformDir)
            ->exclude(self::EXCLUDED_DIRS);

        foreach ($finder as $file) {
            $contents = $file->getContents();
            $regex = '/FEATURE_NEXT_[0-9]+/';
            preg_match_all($regex$contents$keys);
            $availableFlag = array_unique($keys[0]);

            if (!empty($availableFlag)) {
                foreach ($availableFlag as $flag) {
                    if (\in_array($flag, self::EXCLUDE_BY_FLAG, true)) {
                        continue;
                    }
->args([
                param('validator.mapping.cache.file'),
                service('cache.validator'),
            ])

        ->set('validator.validator_factory', ContainerConstraintValidatorFactory::class)
            ->args([
                abstract_arg('Constraint validators locator'),
            ])

        ->load('Symfony\Component\Validator\Constraints\\', $validatorsDir.'/*Validator.php')
            ->exclude($validatorsDir.'/ExpressionLanguageSyntaxValidator.php')
            ->abstract()
            ->tag('container.excluded')
            ->tag('validator.constraint_validator')

        ->set('validator.expression', ExpressionValidator::class)
            ->args([service('validator.expression_language')->nullOnInvalid()])
            ->tag('validator.constraint_validator', [
                'alias' => 'validator.expression',
            ])

        ->set('validator.expression_language', ExpressionLanguage::class)
            
return $result;
    }

    /** * @return list<class-string<Hook>> */
    private function getHookClasses(): array
    {
        $hookClasses = [];

        $shopwareClasses = ConstructFinder::locatedIn(__DIR__ . '/../../../..')
            ->exclude('*/Test/*', '*/vendor/*', '*/DevOps/StaticAnalyze*')
            ->findClassNames();

        foreach ($shopwareClasses as $class) {
            if (!class_exists($class)) {
                // skip not autoloadable test classes                 continue;
            }

            if (is_subclass_of($class, FunctionHook::class) || is_subclass_of($class, TraceHook::class)) {
                continue;
            }

            
$rows[] = [sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */)$message$method];
                } else {
                    $rows[] = [sprintf('<fg=yellow;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!')$message$method];
                }
            } catch (\Exception $e) {
                $exitCode = 1;
                $rows[] = [sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */)$message$e->getMessage()];
            }
        }
        // remove the assets of the bundles that no longer exist         if (!$input->getOption('no-cleanup') && is_dir($bundlesDir)) {
            $dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
            $this->filesystem->remove($dirsToRemove);
        }

        if ($rows) {
            $io->table(['', 'Bundle', 'Method / Error']$rows);
        }

        if (0 !== $exitCode) {
            $io->error('Some errors occurred while installing assets.');
        } else {
            if ($copyUsed) {
                
$this->assertIterator(self::toAbsolute([
            'gitignore/search_root/b.txt',
            'gitignore/search_root/c.txt',
            'gitignore/search_root/dir',
            'gitignore/search_root/dir/a.txt',
            'gitignore/search_root/dir/c.txt',
        ])$finder->in(self::toAbsolute('gitignore/search_root'))->getIterator());
    }

    protected function buildFinder()
    {
        return Finder::create()->exclude('gitignore');
    }

    protected function iniSet(string $varName, string $newValue): void
    {
        if ('open_basedir' === $varName && $deprecationsFile = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
            $newValue .= \PATH_SEPARATOR.$deprecationsFile;
        }

        parent::iniSet($varName$newValue);
    }
}
Home | Imprint | This part of the site doesn't use cookies.