classExists example

            str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
        ];

        if ($prefix) {
            $candidates = array_filter($candidatesfn ($candidate) => str_starts_with($candidate$prefix));
        }

        // We cannot use the autoloader here as most of them use require; but if the class         // is not found, the new autoloader call will require the file again leading to a         // "cannot redeclare class" error.         foreach ($candidates as $candidate) {
            if ($this->classExists($candidate)) {
                return $candidate;
            }
        }

        try {
            require_once $file;
        } catch (\Throwable) {
            return null;
        }

        foreach ($candidates as $candidate) {
            
        // fully qualified names must start with a \         $originalName = $name;

        if ($name[0] !== '\\') {
            $pos          = strpos($name, '\\');
            $alias        = ($pos === false) ? $name : substr($name, 0, $pos);
            $found        = false;
            $loweredAlias = strtolower($alias);

            if ($this->namespaces) {
                foreach ($this->namespaces as $namespace) {
                    if ($this->classExists($namespace . '\\' . $name)) {
                        $name  = $namespace . '\\' . $name;
                        $found = true;
                        break;
                    }
                }
            } elseif (isset($this->imports[$loweredAlias])) {
                $namespace = ltrim($this->imports[$loweredAlias], '\\');
                $name      = ($pos !== false)
                    ? $namespace . substr($name$pos)
                    : $namespace;
                $found     = $this->classExists($name);
            }
        $originalName = $name;

        if ('\\' !== $name[0]) {
            $alias = (false === $pos = strpos($name, '\\'))$name : substr($name, 0, $pos);
            $found = false;

            if ($this->namespaces) {
                if (isset($this->ignoredAnnotationNames[$name])) {
                    return false;
                }
                foreach ($this->namespaces as $namespace) {
                    if ($this->classExists($namespace.'\\'.$name)) {
                        $name = $namespace.'\\'.$name;
                        $found = true;
                        break;
                    }
                }
            } elseif (isset($this->imports[$loweredAlias = strtolower($alias)])) {
                $found = true;
                $name  = (false !== $pos)
                    ? $this->imports[$loweredAlias] . substr($name$pos)
                    : $this->imports[$loweredAlias];
            } elseif ( ! isset($this->ignoredAnnotationNames[$name])
                
            str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
        ];

        if ($prefix) {
            $candidates = array_filter($candidatesfn ($candidate) => str_starts_with($candidate$prefix));
        }

        // We cannot use the autoloader here as most of them use require; but if the class         // is not found, the new autoloader call will require the file again leading to a         // "cannot redeclare class" error.         foreach ($candidates as $candidate) {
            if ($this->classExists($candidate)) {
                return $candidate;
            }
        }

        // Symfony may ship some polyfills, like "Normalizer". But if the Intl         // extension is already installed, the next require_once will fail with         // a compile error because the class is already defined. And this one         // does not throw a Throwable. So it's better to skip it here.         if (str_contains($file, 'Resources/stubs')) {
            return null;
        }

        
Home | Imprint | This part of the site doesn't use cookies.