Skip to content

Commit a94de9e

Browse files
committed
minor symfony#40967 [Translation] [Loco] Remove SCHEME const (OskarStark)
This PR was merged into the 5.3-dev branch. Discussion ---------- [Translation] [Loco] Remove SCHEME const | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> For consistency, we do it this way in mailer and notifier cc `@welcoMattic` Commits ------- 34be4a5 [Translation] [Loco] Remove SCHEME const
2 parents 01602ef + 34be4a5 commit a94de9e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Symfony/Component/Translation/Bridge/Loco/LocoProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(HttpClientInterface $client, LoaderInterface $loader
4848

4949
public function __toString(): string
5050
{
51-
return sprintf('%s://%s', LocoProviderFactory::SCHEME, $this->endpoint);
51+
return sprintf('loco://%s', $this->endpoint);
5252
}
5353

5454
public function write(TranslatorBagInterface $translatorBag): void

src/Symfony/Component/Translation/Bridge/Loco/LocoProviderFactory.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
*/
2727
final class LocoProviderFactory extends AbstractProviderFactory
2828
{
29-
public const SCHEME = 'loco';
3029
private const HOST = 'localise.biz/api/';
3130

3231
private $client;
@@ -47,8 +46,8 @@ public function __construct(HttpClientInterface $client, LoggerInterface $logger
4746
*/
4847
public function create(Dsn $dsn): ProviderInterface
4948
{
50-
if (self::SCHEME !== $dsn->getScheme()) {
51-
throw new UnsupportedSchemeException($dsn, self::SCHEME, $this->getSupportedSchemes());
49+
if ('loco' !== $dsn->getScheme()) {
50+
throw new UnsupportedSchemeException($dsn, 'loco', $this->getSupportedSchemes());
5251
}
5352

5453
$endpoint = sprintf('%s%s', 'default' === $dsn->getHost() ? self::HOST : $dsn->getHost(), $dsn->getPort() ? ':'.$dsn->getPort() : '');
@@ -64,6 +63,6 @@ public function create(Dsn $dsn): ProviderInterface
6463

6564
protected function getSupportedSchemes(): array
6665
{
67-
return [self::SCHEME];
66+
return ['loco'];
6867
}
6968
}

0 commit comments

Comments
 (0)