Skip to content

Commit

Permalink
Merge pull request #2516 from briannesbitt/fix/support-classmap-autho…
Browse files Browse the repository at this point in the history
…ritative

Support classmap-authoritative composer option
  • Loading branch information
kylekatarnls authored Dec 3, 2021
2 parents 67f34dc + 846d7d1 commit 8c2a18c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ jobs:
- php: 8.0
laravel: true

name: ${{ matrix.laravel && 'Laravel compatibility - ' || '' }}${{ matrix.coverage && 'Coverage - ' || '' }}PHP ${{ matrix.php }} - ${{ matrix.setup || 'stable' }} - ubuntu
- php: 8.0
laravel: true
classmap-authoritative: true

name: ${{ matrix.laravel && 'Laravel compatibility - ' || '' }}${{ matrix.classmap-authoritative && 'classmap-authoritative - ' || '' }}${{ matrix.coverage && 'Coverage - ' || '' }}PHP ${{ matrix.php }} - ${{ matrix.setup || 'stable' }} - ubuntu

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -88,7 +92,7 @@ jobs:
composer remove --no-update kylekatarnls/multi-tester --no-interaction;
fi;
${{ matrix.php >= 8.1 && 'composer require --no-update phpunit/phpunit:^8.5.14 --no-interaction;' || '' }}
composer update --prefer-dist --no-progress --prefer-${{ matrix.setup || 'stable' }} ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }};
composer update --prefer-dist --no-progress --prefer-${{ matrix.setup || 'stable' }} ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }} ${{ matrix.classmap-authoritative && '--classmap-authoritative' || '' }};
- name: Run test suite
run: |
Expand Down
4 changes: 2 additions & 2 deletions lazy/Carbon/TranslatorStrongType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use Symfony\Component\Translation\MessageCatalogueInterface;

if (!class_exists(Translator::class, false)) {
class Translator extends AbstractTranslator implements TranslatorStrongTypeInterface
if (!class_exists(LazyTranslator::class, false)) {
class LazyTranslator extends AbstractTranslator implements TranslatorStrongTypeInterface
{
public function trans(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string
{
Expand Down
4 changes: 2 additions & 2 deletions lazy/Carbon/TranslatorWeakType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Carbon;

if (!class_exists(Translator::class, false)) {
class Translator extends AbstractTranslator
if (!class_exists(LazyTranslator::class, false)) {
class LazyTranslator extends AbstractTranslator
{
/**
* Returns the translation.
Expand Down
5 changes: 5 additions & 0 deletions src/Carbon/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ class_exists(TranslatorInterface::class)
require $transMethod->hasReturnType()
? __DIR__.'/../../lazy/Carbon/TranslatorStrongType.php'
: __DIR__.'/../../lazy/Carbon/TranslatorWeakType.php';

class Translator extends LazyTranslator
{
// Proxy dynamically loaded LazyTranslator in a static way
}

0 comments on commit 8c2a18c

Please sign in to comment.