getNamespaceAliases example

$namespace = trim($reflection->getNamespaceName(), '\\');
        $fileName = $reflection->getFileName();

        if (\is_string($fileName) && is_file($fileName)) {
            if (false === $contents = file_get_contents($fileName)) {
                throw new \RuntimeException(sprintf('Unable to read file "%s".', $fileName));
            }

            $factory = new ContextFactory();
            $context = $factory->createForNamespace($namespace$contents);

            return [$namespace$context->getNamespaceAliases()];
        }

        return [$namespace[]];
    }
}
Home | Imprint | This part of the site doesn't use cookies.