for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Helldar\Support\Concerns;
/**
* If you use this trait, you need to install the dependency:.
*
* composer require symfony/deprecation-contracts
*/
trait Deprecation
{
protected static $next_version = '4.0';
protected static function deprecatedClass(string $new_class): void
$old_class = static::getDeprecatedNamespace();
static::deprecated(
'The %s class has been deprecated and will be removed in version %s, use %s instead.',
$old_class,
static::$next_version,
$new_class
);
}
protected static function deprecatedMethod(string $old_method, string $new_class, string $new_method = null): void
$namespace = static::getDeprecatedNamespace();
'The %s::%s() method has been deprecated and will be removed in version %s, use %s::%s() instead.',
$namespace,
$old_method,
$new_class,
$new_method ?: $old_method
protected static function getDeprecatedNamespace(): string
return static::class;
protected static function deprecated(string $message, ...$args): void
trigger_deprecation('andrey-helldar/support', static::$next_version, $message, ...$args);