Skip to content

Commit

Permalink
fix: deprecation msg about AbstractDependencyProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Aug 17, 2024
1 parent ae23f24 commit 1a17f86
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Gacela\Framework\AbstractProvider;
use Gacela\Framework\ClassResolver\AbstractClassResolver;

use function dirname;

/**
* @psalm-suppress DeprecatedClass
*/
Expand All @@ -23,12 +25,16 @@ public function resolve(object|string $caller): ?AbstractProvider
/** @var ?AbstractDependencyProvider $resolved */
$resolved = $this->doResolve($caller);

if ($resolved !== null) {
trigger_deprecation('gacela-project/gacela', '1.8', sprintf(
'Use %s. %s will be removed in version 2.0',
AbstractProvider::class,
if ($resolved instanceof AbstractDependencyProvider) {
/** @psalm-suppress PossiblyUndefinedArrayOffset, PossiblyNullArgument */
trigger_deprecation(
'gacela-project/gacela',
'1.8',
"`%s` is deprecated and will be removed in version 2.0.\nUse `%s` instead. Where? Check your module `%s`",
AbstractDependencyProvider::class,
));
AbstractProvider::class,
basename(dirname(debug_backtrace()[3]['file'])), // @phpstan-ignore-line
);
}

return $resolved;
Expand Down

0 comments on commit 1a17f86

Please sign in to comment.