Skip to content

Commit 97ffc89

Browse files
committed
bug #136 Use github.com instead of api.symfony.com (wouterj)
This PR was merged into the main branch. Discussion ---------- Use github.com instead of api.symfony.com ref symfony/symfony-docs#16322 Commits ------- 76fde8f Use github.com instead of api.symfony.com
2 parents 293c45d + 76fde8f commit 97ffc89

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

src/BuildConfig.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class BuildConfig
1717
{
1818
private const PHP_DOC_URL = 'https://secure.php.net/manual/en';
19-
private const SYMFONY_API_URL = 'https://api.symfony.com/{symfonyVersion}';
19+
private const GITHUB_URL = 'https://github.com/symfony/symfony/blob/{symfonyVersion}/src';
2020
private const SYMFONY_DOC_URL = 'https://symfony.com/doc/{symfonyVersion}';
2121

2222
private $useBuildCache;
@@ -78,9 +78,9 @@ public function getPhpDocUrl(): string
7878
return self::PHP_DOC_URL;
7979
}
8080

81-
public function getSymfonyApiUrl(): string
81+
public function getGithubUrl(): string
8282
{
83-
return str_replace('{symfonyVersion}', $this->getSymfonyVersion(), self::SYMFONY_API_URL);
83+
return str_replace('{symfonyVersion}', $this->getSymfonyVersion(), self::GITHUB_URL);
8484
}
8585

8686
public function getSymfonyDocUrl(): string

src/KernelFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ private static function getDirectives(): array
101101
private static function getReferences(BuildConfig $buildConfig): array
102102
{
103103
return [
104-
new SymfonyReferences\ClassReference($buildConfig->getSymfonyApiUrl()),
105-
new SymfonyReferences\MethodReference($buildConfig->getSymfonyApiUrl()),
106-
new SymfonyReferences\NamespaceReference($buildConfig->getSymfonyApiUrl()),
104+
new SymfonyReferences\ClassReference($buildConfig->getGithubUrl()),
105+
new SymfonyReferences\MethodReference($buildConfig->getGithubUrl()),
106+
new SymfonyReferences\NamespaceReference($buildConfig->getGithubUrl()),
107107
new SymfonyReferences\PhpFunctionReference($buildConfig->getPhpDocUrl()),
108108
new SymfonyReferences\PhpMethodReference($buildConfig->getPhpDocUrl()),
109109
new SymfonyReferences\PhpClassReference($buildConfig->getPhpDocUrl()),

src/Reference/ClassReference.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
class ClassReference extends Reference
1818
{
19-
private $symfonyApiUrl;
19+
private $githubUrl;
2020

21-
public function __construct(string $symfonyApiUrl)
21+
public function __construct(string $githubUrl)
2222
{
23-
$this->symfonyApiUrl = $symfonyApiUrl;
23+
$this->githubUrl = $githubUrl;
2424
}
2525

2626
public function getName(): string
@@ -35,7 +35,7 @@ public function resolve(Environment $environment, string $data): ResolvedReferen
3535
return new ResolvedReference(
3636
$environment->getCurrentFileName(),
3737
$className->afterLast('\\'),
38-
sprintf('%s/%s.html', $this->symfonyApiUrl, $className->replace('\\', '/')),
38+
sprintf('%s/%s.php', $this->githubUrl, $className->replace('\\', '/')),
3939
[],
4040
[
4141
'title' => $className,

src/Reference/MethodReference.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
class MethodReference extends Reference
1818
{
19-
private $symfonyApiUrl;
19+
private $githubUrl;
2020

21-
public function __construct(string $symfonyApiUrl)
21+
public function __construct(string $githubUrl)
2222
{
23-
$this->symfonyApiUrl = $symfonyApiUrl;
23+
$this->githubUrl = $githubUrl;
2424
}
2525

2626
public function getName(): string
@@ -42,7 +42,7 @@ public function resolve(Environment $environment, string $data): ResolvedReferen
4242
return new ResolvedReference(
4343
$environment->getCurrentFileName(),
4444
$methodName.'()',
45-
sprintf('%s/%s.html#method_%s', $this->symfonyApiUrl, str_replace('\\', '/', $className), $methodName),
45+
sprintf('%s/%s.php#method_%s', $this->githubUrl, str_replace('\\', '/', $className), $methodName),
4646
[],
4747
[
4848
'title' => sprintf('%s::%s()', $className, $methodName),

src/Reference/NamespaceReference.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
class NamespaceReference extends Reference
1818
{
19-
private $symfonyApiUrl;
19+
private $githubUrl;
2020

21-
public function __construct(string $symfonyApiUrl)
21+
public function __construct(string $githubUrl)
2222
{
23-
$this->symfonyApiUrl = $symfonyApiUrl;
23+
$this->githubUrl = $githubUrl;
2424
}
2525

2626
public function getName(): string
@@ -35,7 +35,7 @@ public function resolve(Environment $environment, string $data): ResolvedReferen
3535
return new ResolvedReference(
3636
$environment->getCurrentFileName(),
3737
$className->afterLast('\\'),
38-
sprintf('%s/%s.html', $this->symfonyApiUrl, $className->replace('\\', '/')),
38+
sprintf('%s/%s', $this->githubUrl, $className->replace('\\', '/')),
3939
[],
4040
[
4141
'title' => $className,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<p><a href="https://api.symfony.com/4.0/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.html" class="reference external" title="Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel">ContainerAwareHttpKernel</a></p>
1+
<p><a href="https://github.com/symfony/symfony/blob/4.0/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php" class="reference external" title="Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel" rel="external noopener noreferrer" target="_blank">ContainerAwareHttpKernel</a></p>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<p><a href="https://api.symfony.com/4.0/Symfony/Component/HttpFoundation/RequestStack.html#method_getCurrentRequest" class="reference external" title="Symfony\Component\HttpFoundation\RequestStack::getCurrentRequest()">getCurrentRequest()</a></p>
1+
<p><a href="https://github.com/symfony/symfony/blob/4.0/src/Symfony/Component/HttpFoundation/RequestStack.php#method_getCurrentRequest" class="reference external" title="Symfony\Component\HttpFoundation\RequestStack::getCurrentRequest()" rel="external noopener noreferrer" target="_blank">getCurrentRequest()</a></p>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<p><a href="https://api.symfony.com/4.0/Symfony/Component/HttpFoundation.html" class="reference external" title="Symfony\Component\HttpFoundation">HttpFoundation</a></p>
1+
<p><a href="https://github.com/symfony/symfony/blob/4.0/src/Symfony/Component/HttpFoundation" class="reference external" title="Symfony\Component\HttpFoundation" rel="external noopener noreferrer" target="_blank">HttpFoundation</a></p>

tests/fixtures/expected/main/datetime.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ <h1 id="datetimetype-field"><a class="headerlink" href="#datetimetype-field" tit
4444
</tr>
4545
<tr>
4646
<td>Class</td>
47-
<td><a href="https://api.symfony.com/4.0/Symfony/Component/Form/Extension/Core/Type/DateTimeType.html" class="reference external" title="Symfony\Component\Form\Extension\Core\Type\DateTimeType">DateTimeType</a></td>
47+
<td><a href="https://github.com/symfony/symfony/blob/4.0/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php" class="reference external" title="Symfony\Component\Form\Extension\Core\Type\DateTimeType" rel="external noopener noreferrer" target="_blank">DateTimeType</a></td>
4848
</tr>
4949
<tr>
5050
<td>Ref</td>
@@ -65,8 +65,8 @@ <h3 id="the-date-format-option"><a class="headerlink" href="#the-date-format-opt
6565
<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="24" height="24" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg>
6666
<span>Tip</span>
6767
</p><p>This is a little tip about something! We an also talk about specific
68-
methods: <a href="https://api.symfony.com/4.0/Symfony/Component/BrowserKit/Client.html#method_doRequest" class="reference external" title="Symfony\Component\BrowserKit\Client::doRequest()">doRequest()</a>.
69-
Or a namespace: <a href="https://api.symfony.com/4.0/Symfony/Component/Validator/Constraints.html" class="reference external" title="Symfony\Component\Validator\Constraints">Constraints</a>.
68+
methods: <a href="https://github.com/symfony/symfony/blob/4.0/src/Symfony/Component/BrowserKit/Client.php#method_doRequest" class="reference external" title="Symfony\Component\BrowserKit\Client::doRequest()" rel="external noopener noreferrer" target="_blank">doRequest()</a>.
69+
Or a namespace: <a href="https://github.com/symfony/symfony/blob/4.0/src/Symfony/Component/Validator/Constraints.php" class="reference external" title="Symfony\Component\Validator\Constraints" rel="external noopener noreferrer" target="_blank">Constraints</a>.
7070
Or a PHP function: <a href="https://secure.php.net/manual/en/function.parse-ini-file.php" class="reference external" title="parse_ini_file" rel="external noopener noreferrer" target="_blank">parse_ini_file</a>.
7171
Or a PHP method! <a href="https://secure.php.net/manual/en/locale.getdefault.php" class="reference external" title="Locale" rel="external noopener noreferrer" target="_blank">Locale::getDefault()</a>.</p>
7272
</div>

0 commit comments

Comments
 (0)