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 = '5.0';
protected static function deprecatedClass(string $new_class, string $old_class = null): void
$old_class = static::getDeprecatedNamespace($old_class);
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 $old_namespace = null): string
return $old_namespace ?: static::class;
protected static function deprecated(string $message, ...$args): void
trigger_deprecation('andrey-helldar/support', static::$next_version, $message, ...$args);
trigger_deprecation
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
/** @scrutinizer ignore-call */