diff --git a/src/BuildConfig.php b/src/BuildConfig.php index 7817faf..3e05eb5 100644 --- a/src/BuildConfig.php +++ b/src/BuildConfig.php @@ -16,7 +16,7 @@ class BuildConfig { private const PHP_DOC_URL = 'https://secure.php.net/manual/en'; - private const SYMFONY_API_URL = 'https://api.symfony.com/{symfonyVersion}'; + private const GITHUB_URL = 'https://github.com/symfony/symfony/blob/{symfonyVersion}/src'; private const SYMFONY_DOC_URL = 'https://symfony.com/doc/{symfonyVersion}'; private $useBuildCache; @@ -78,9 +78,9 @@ public function getPhpDocUrl(): string return self::PHP_DOC_URL; } - public function getSymfonyApiUrl(): string + public function getGithubUrl(): string { - return str_replace('{symfonyVersion}', $this->getSymfonyVersion(), self::SYMFONY_API_URL); + return str_replace('{symfonyVersion}', $this->getSymfonyVersion(), self::GITHUB_URL); } public function getSymfonyDocUrl(): string diff --git a/src/KernelFactory.php b/src/KernelFactory.php index ce99fcd..3a17b47 100644 --- a/src/KernelFactory.php +++ b/src/KernelFactory.php @@ -101,9 +101,9 @@ private static function getDirectives(): array private static function getReferences(BuildConfig $buildConfig): array { return [ - new SymfonyReferences\ClassReference($buildConfig->getSymfonyApiUrl()), - new SymfonyReferences\MethodReference($buildConfig->getSymfonyApiUrl()), - new SymfonyReferences\NamespaceReference($buildConfig->getSymfonyApiUrl()), + new SymfonyReferences\ClassReference($buildConfig->getGithubUrl()), + new SymfonyReferences\MethodReference($buildConfig->getGithubUrl()), + new SymfonyReferences\NamespaceReference($buildConfig->getGithubUrl()), new SymfonyReferences\PhpFunctionReference($buildConfig->getPhpDocUrl()), new SymfonyReferences\PhpMethodReference($buildConfig->getPhpDocUrl()), new SymfonyReferences\PhpClassReference($buildConfig->getPhpDocUrl()), diff --git a/src/Reference/ClassReference.php b/src/Reference/ClassReference.php index 5f99e34..362d1ba 100644 --- a/src/Reference/ClassReference.php +++ b/src/Reference/ClassReference.php @@ -16,11 +16,11 @@ class ClassReference extends Reference { - private $symfonyApiUrl; + private $githubUrl; - public function __construct(string $symfonyApiUrl) + public function __construct(string $githubUrl) { - $this->symfonyApiUrl = $symfonyApiUrl; + $this->githubUrl = $githubUrl; } public function getName(): string @@ -35,7 +35,7 @@ public function resolve(Environment $environment, string $data): ResolvedReferen return new ResolvedReference( $environment->getCurrentFileName(), $className->afterLast('\\'), - sprintf('%s/%s.html', $this->symfonyApiUrl, $className->replace('\\', '/')), + sprintf('%s/%s.php', $this->githubUrl, $className->replace('\\', '/')), [], [ 'title' => $className, diff --git a/src/Reference/MethodReference.php b/src/Reference/MethodReference.php index 12314cc..d552fcc 100644 --- a/src/Reference/MethodReference.php +++ b/src/Reference/MethodReference.php @@ -16,11 +16,11 @@ class MethodReference extends Reference { - private $symfonyApiUrl; + private $githubUrl; - public function __construct(string $symfonyApiUrl) + public function __construct(string $githubUrl) { - $this->symfonyApiUrl = $symfonyApiUrl; + $this->githubUrl = $githubUrl; } public function getName(): string @@ -42,7 +42,7 @@ public function resolve(Environment $environment, string $data): ResolvedReferen return new ResolvedReference( $environment->getCurrentFileName(), $methodName.'()', - sprintf('%s/%s.html#method_%s', $this->symfonyApiUrl, str_replace('\\', '/', $className), $methodName), + sprintf('%s/%s.php#method_%s', $this->githubUrl, str_replace('\\', '/', $className), $methodName), [], [ 'title' => sprintf('%s::%s()', $className, $methodName), diff --git a/src/Reference/NamespaceReference.php b/src/Reference/NamespaceReference.php index 1592371..c825f85 100644 --- a/src/Reference/NamespaceReference.php +++ b/src/Reference/NamespaceReference.php @@ -16,11 +16,11 @@ class NamespaceReference extends Reference { - private $symfonyApiUrl; + private $githubUrl; - public function __construct(string $symfonyApiUrl) + public function __construct(string $githubUrl) { - $this->symfonyApiUrl = $symfonyApiUrl; + $this->githubUrl = $githubUrl; } public function getName(): string @@ -35,7 +35,7 @@ public function resolve(Environment $environment, string $data): ResolvedReferen return new ResolvedReference( $environment->getCurrentFileName(), $className->afterLast('\\'), - sprintf('%s/%s.html', $this->symfonyApiUrl, $className->replace('\\', '/')), + sprintf('%s/%s', $this->githubUrl, $className->replace('\\', '/')), [], [ 'title' => $className, diff --git a/tests/fixtures/expected/blocks/references/class.html b/tests/fixtures/expected/blocks/references/class.html index 35afeec..38412f7 100644 --- a/tests/fixtures/expected/blocks/references/class.html +++ b/tests/fixtures/expected/blocks/references/class.html @@ -1 +1 @@ -
+ diff --git a/tests/fixtures/expected/blocks/references/method.html b/tests/fixtures/expected/blocks/references/method.html index 3b4d701..4c58d31 100644 --- a/tests/fixtures/expected/blocks/references/method.html +++ b/tests/fixtures/expected/blocks/references/method.html @@ -1 +1 @@ - + diff --git a/tests/fixtures/expected/blocks/references/namespace.html b/tests/fixtures/expected/blocks/references/namespace.html index 3dfb39f..37228ec 100644 --- a/tests/fixtures/expected/blocks/references/namespace.html +++ b/tests/fixtures/expected/blocks/references/namespace.html @@ -1 +1 @@ - + diff --git a/tests/fixtures/expected/main/datetime.html b/tests/fixtures/expected/main/datetime.html index 5e8497f..1e701b0 100644 --- a/tests/fixtures/expected/main/datetime.html +++ b/tests/fixtures/expected/main/datetime.html @@ -44,7 +44,7 @@This is a little tip about something! We an also talk about specific -methods: doRequest(). -Or a namespace: Constraints. +methods: doRequest(). +Or a namespace: Constraints. Or a PHP function: parse_ini_file. Or a PHP method! Locale::getDefault().