for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Spiral\Core\Config;
/**
* @internal
*/
final class DeprecationProxy extends Proxy
{
* @param class-string $interface
class-string
0
public function __construct(
string $interface,
bool $singleton = false,
private readonly string|\BackedEnum|null $scope = null,
private readonly ?string $version = null,
private readonly ?string $message = null,
) {
if (($scope === null || $version === null) && $message === null) {
throw new \InvalidArgumentException('Scope and version or custom message must be provided.');
}
parent::__construct($interface, $singleton);
* @return class-string
* @deprecated
public function getInterface(): string
$message = $this->message ?? \sprintf(
'Using `%s` outside of the `%s` scope is deprecated and will be impossible in version %s.',
$this->interface,
$this->scope instanceof \BackedEnum ? $this->scope->value : $this->scope,
value
BackedEnum
instanceof
$this->version,
);
@\trigger_error($message, \E_USER_DEPRECATED);
return parent::getInterface();
Spiral\Core\Config\Proxy::getInterface()
If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated annotation
ignore-deprecated
return /** @scrutinizer ignore-deprecated */ parent::getInterface();
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.