From a5d98e478674cd81179db4a4b4631979ff0f9583 Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Mon, 28 Aug 2023 10:18:23 +0400 Subject: [PATCH] refactor(core)!: `LastDragon_ru\LaraASP\Core\Translator` and `LastDragon_ru\LaraASP\Core\Helpers\Translator`. --- packages/core/src/{ => Helpers}/Translator.php | 4 ++-- packages/core/src/{ => Helpers}/TranslatorTest.php | 5 +++-- packages/core/src/Provider/WithTranslations.php | 2 +- packages/formatter/src/PackageTranslator.php | 2 +- packages/graphql/src/PackageTranslator.php | 2 +- phpstan-baseline.neon | 10 +++++----- 6 files changed, 13 insertions(+), 12 deletions(-) rename packages/core/src/{ => Helpers}/Translator.php (95%) rename packages/core/src/{ => Helpers}/TranslatorTest.php (97%) diff --git a/packages/core/src/Translator.php b/packages/core/src/Helpers/Translator.php similarity index 95% rename from packages/core/src/Translator.php rename to packages/core/src/Helpers/Translator.php index 8e197877d..7307a547c 100644 --- a/packages/core/src/Translator.php +++ b/packages/core/src/Helpers/Translator.php @@ -1,6 +1,6 @@ <?php declare(strict_types = 1); -namespace LastDragon_ru\LaraASP\Core; +namespace LastDragon_ru\LaraASP\Core\Helpers; use Closure; use Countable; @@ -12,7 +12,7 @@ use function end; /** - * Special wrapper around Translator to help translate package's messages. + * Special wrapper around {@see TranslatorContract} to help translate package's messages. */ abstract class Translator { public function __construct( diff --git a/packages/core/src/TranslatorTest.php b/packages/core/src/Helpers/TranslatorTest.php similarity index 97% rename from packages/core/src/TranslatorTest.php rename to packages/core/src/Helpers/TranslatorTest.php index bcbdabe46..f48b78459 100644 --- a/packages/core/src/TranslatorTest.php +++ b/packages/core/src/Helpers/TranslatorTest.php @@ -1,10 +1,11 @@ <?php declare(strict_types = 1); -namespace LastDragon_ru\LaraASP\Core; +namespace LastDragon_ru\LaraASP\Core\Helpers; use Illuminate\Contracts\Translation\Translator; +use LastDragon_ru\LaraASP\Core\Helpers\Translator as PackageTranslator; +use LastDragon_ru\LaraASP\Core\Package; use LastDragon_ru\LaraASP\Core\Testing\Package\TestCase; -use LastDragon_ru\LaraASP\Core\Translator as PackageTranslator; use LastDragon_ru\LaraASP\Testing\Utils\WithTranslations; use PHPUnit\Framework\Attributes\CoversClass; diff --git a/packages/core/src/Provider/WithTranslations.php b/packages/core/src/Provider/WithTranslations.php index a15f7e5e9..8fc44b103 100644 --- a/packages/core/src/Provider/WithTranslations.php +++ b/packages/core/src/Provider/WithTranslations.php @@ -3,7 +3,7 @@ namespace LastDragon_ru\LaraASP\Core\Provider; use Illuminate\Support\ServiceProvider; -use LastDragon_ru\LaraASP\Core\Translator; +use LastDragon_ru\LaraASP\Core\Helpers\Translator; /** * @see Translator diff --git a/packages/formatter/src/PackageTranslator.php b/packages/formatter/src/PackageTranslator.php index 81a986bf4..cb8c102b5 100644 --- a/packages/formatter/src/PackageTranslator.php +++ b/packages/formatter/src/PackageTranslator.php @@ -3,7 +3,7 @@ namespace LastDragon_ru\LaraASP\Formatter; use Illuminate\Contracts\Translation\Translator as TranslatorContract; -use LastDragon_ru\LaraASP\Core\Translator; +use LastDragon_ru\LaraASP\Core\Helpers\Translator; class PackageTranslator extends Translator { public function __construct(TranslatorContract $translator) { diff --git a/packages/graphql/src/PackageTranslator.php b/packages/graphql/src/PackageTranslator.php index 8e42942a2..00cccf0a9 100644 --- a/packages/graphql/src/PackageTranslator.php +++ b/packages/graphql/src/PackageTranslator.php @@ -3,7 +3,7 @@ namespace LastDragon_ru\LaraASP\GraphQL; use Illuminate\Contracts\Translation\Translator as TranslatorContract; -use LastDragon_ru\LaraASP\Core\Translator; +use LastDragon_ru\LaraASP\Core\Helpers\Translator; class PackageTranslator extends Translator { public function __construct(TranslatorContract $translator) { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1e9d21642..5c66fbab9 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,15 +1,15 @@ parameters: ignoreErrors: + - + message: "#^Parameter \\#1 \\$translations of method LastDragon_ru\\\\LaraASP\\\\Testing\\\\Package\\\\TestCase\\:\\:setTranslations\\(\\) expects array\\<string, array\\<string, string\\>\\>\\|\\(callable\\(LastDragon_ru\\\\LaraASP\\\\Core\\\\Helpers\\\\TranslatorTest, string, string\\)\\: array\\<string, array\\<string, string\\>\\>\\)\\|null, array\\<string, array\\<string, string\\>\\>\\|\\(callable\\(static, string, string\\)\\: array\\<string, array\\<string, string\\>\\>\\)\\|null given\\.$#" + count: 2 + path: packages/core/src/Helpers/TranslatorTest.php + - message: "#^Cannot call method once\\(\\) on mixed\\.$#" count: 1 path: packages/core/src/Observer/DispatcherTest.php - - - message: "#^Parameter \\#1 \\$translations of method LastDragon_ru\\\\LaraASP\\\\Testing\\\\Package\\\\TestCase\\:\\:setTranslations\\(\\) expects array\\<string, array\\<string, string\\>\\>\\|\\(callable\\(LastDragon_ru\\\\LaraASP\\\\Core\\\\TranslatorTest, string, string\\)\\: array\\<string, array\\<string, string\\>\\>\\)\\|null, array\\<string, array\\<string, string\\>\\>\\|\\(callable\\(static, string, string\\)\\: array\\<string, array\\<string, string\\>\\>\\)\\|null given\\.$#" - count: 2 - path: packages/core/src/TranslatorTest.php - - message: "#^Parameter \\#1 \\$offset of method LastDragon_ru\\\\LaraASP\\\\Eloquent\\\\Iterators\\\\IteratorImpl\\<TItem of Illuminate\\\\Database\\\\Eloquent\\\\Model\\>\\:\\:setOffset\\(\\) expects int\\|string\\|null, mixed given\\.$#" count: 1