This commit is contained in:
Fabien Potencier 2020-02-04 09:03:00 +01:00
parent ce29631cd8
commit a3e49f30c7
49 changed files with 91 additions and 91 deletions

View File

@ -73,7 +73,7 @@ class MergeDoctrineCollectionListener implements EventSubscriberInterface
*/
public function onBind(FormEvent $event)
{
if (__CLASS__ === \get_class($this)) {
if (__CLASS__ === static::class) {
$this->bc = false;
} else {
// parent::onBind() has been called

View File

@ -104,10 +104,10 @@ EOF
$decorated = $io->isDecorated();
// BC to be removed in 4.0
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, 'getTwigEnvironment');
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', \get_class($this).'::getTwigEnvironment'), E_USER_DEPRECATED);
@trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), E_USER_DEPRECATED);
$this->twig = $this->getTwigEnvironment();
}

View File

@ -105,10 +105,10 @@ EOF
$io = new SymfonyStyle($input, $output);
// BC to be removed in 4.0
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, 'getTwigEnvironment');
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', \get_class($this).'::getTwigEnvironment'), E_USER_DEPRECATED);
@trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), E_USER_DEPRECATED);
$this->twig = $this->getTwigEnvironment();
}

View File

@ -1141,7 +1141,7 @@ abstract class FrameworkExtensionTest extends TestCase
protected function createContainerFromFile($file, $data = [], $resetCompilerPasses = true, $compile = true)
{
$cacheKey = md5(\get_class($this).$file.serialize($data));
$cacheKey = md5(static::class.$file.serialize($data));
if ($compile && isset(self::$containerCache[$cacheKey])) {
return self::$containerCache[$cacheKey];
}

View File

@ -68,6 +68,6 @@ abstract class AbstractWebTestCase extends BaseWebTestCase
protected static function getVarDir()
{
return 'FB'.substr(strrchr(\get_called_class(), '\\'), 1);
return 'FB'.substr(strrchr(static::class, '\\'), 1);
}
}

View File

@ -68,6 +68,6 @@ class AbstractWebTestCase extends BaseWebTestCase
protected static function getVarDir()
{
return 'SB'.substr(strrchr(\get_called_class(), '\\'), 1);
return 'SB'.substr(strrchr(static::class, '\\'), 1);
}
}

View File

@ -54,7 +54,7 @@ class ApcuAdapterTest extends AdapterTestCase
public function testVersion()
{
$namespace = str_replace('\\', '.', \get_class($this));
$namespace = str_replace('\\', '.', static::class);
$pool1 = new ApcuAdapter($namespace, 0, 'p1');
@ -79,7 +79,7 @@ class ApcuAdapterTest extends AdapterTestCase
public function testNamespace()
{
$namespace = str_replace('\\', '.', \get_class($this));
$namespace = str_replace('\\', '.', static::class);
$pool1 = new ApcuAdapter($namespace.'_1', 0, 'p1');

View File

@ -55,7 +55,7 @@ class Command
*/
public static function getDefaultName()
{
$class = \get_called_class();
$class = static::class;
$r = new \ReflectionProperty($class, 'defaultName');
return $class === $r->class ? static::$defaultName : null;
@ -348,7 +348,7 @@ class Command
public function getDefinition()
{
if (null === $this->definition) {
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($this)));
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
}
return $this->definition;

View File

@ -34,7 +34,7 @@ abstract class AbstractNode implements NodeInterface
public function getNodeName()
{
if (null === $this->nodeName) {
$this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', \get_called_class());
$this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class);
}
return $this->nodeName;

View File

@ -81,7 +81,7 @@ class Compiler
if (\func_num_args() >= 3) {
$priority = func_get_arg(2);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED);

View File

@ -123,7 +123,7 @@ class PassConfig
if (\func_num_args() >= 3) {
$priority = func_get_arg(2);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED);

View File

@ -474,7 +474,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if (\func_num_args() >= 3) {
$priority = func_get_arg(2);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED);

View File

@ -65,7 +65,7 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
*/
public function getAlias()
{
$className = \get_class($this);
$className = static::class;
if ('Extension' != substr($className, -9)) {
throw new BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.');
}
@ -79,7 +79,7 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
*/
public function getConfiguration(array $config, ContainerBuilder $container)
{
$class = \get_class($this);
$class = static::class;
if (false !== strpos($class, "\0")) {
return null; // ignore anonymous classes

View File

@ -31,7 +31,7 @@ abstract class AbstractConfigurator
return \call_user_func_array([$this, 'set'.$method], $args);
}
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', static::class, $method));
}
/**

View File

@ -42,7 +42,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
{
$this->container = $container;
$class = \get_class($this);
$class = static::class;
if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) {
$class = get_parent_class($class);
}

View File

@ -40,7 +40,7 @@ class Node
$attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true)));
}
$repr = [str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', \get_class($this)).'('.implode(', ', $attributes)];
$repr = [str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', static::class).'('.implode(', ', $attributes)];
if (\count($this->nodes)) {
foreach ($this->nodes as $node) {
@ -76,7 +76,7 @@ class Node
public function toArray()
{
throw new \BadMethodCallException(sprintf('Dumping a "%s" instance is not supported yet.', \get_class($this)));
throw new \BadMethodCallException(sprintf('Dumping a "%s" instance is not supported yet.', static::class));
}
public function dump()

View File

@ -52,7 +52,7 @@ abstract class AbstractType implements FormTypeInterface
*/
public function getBlockPrefix()
{
return StringUtil::fqcnToBlockPrefix(\get_class($this)) ?: '';
return StringUtil::fqcnToBlockPrefix(static::class) ?: '';
}
/**

View File

@ -273,7 +273,7 @@ class ChoiceType extends AbstractType
// Set by the user
if (true !== $choicesAsValues) {
throw new \RuntimeException(sprintf('The "choices_as_values" option of the %s should not be used. Remove it and flip the contents of the "choices" option instead.', \get_class($this)));
throw new \RuntimeException(sprintf('The "choices_as_values" option of the %s should not be used. Remove it and flip the contents of the "choices" option instead.', static::class));
}
@trigger_error('The "choices_as_values" option is deprecated since Symfony 3.1 and will be removed in 4.0. You should not use it anymore.', E_USER_DEPRECATED);

View File

@ -42,7 +42,7 @@ class RedirectResponse extends Response
throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status));
}
if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, \CASE_LOWER))) {
if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, CASE_LOWER))) {
$this->headers->remove('cache-control');
}
}

View File

@ -133,7 +133,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
}
if (!headers_sent() && filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN)) {
if (!$this->sessionName) {
throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', \get_class($this)));
throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', static::class));
}
$sessionCookie = sprintf(' %s=', urlencode($this->sessionName));
$sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId));

View File

@ -137,7 +137,7 @@ class NativeSessionStorage implements SessionStorageInterface
return true;
}
if (\PHP_SESSION_ACTIVE === session_status()) {
if (PHP_SESSION_ACTIVE === session_status()) {
throw new \RuntimeException('Failed to start the session: already started by PHP.');
}
@ -193,7 +193,7 @@ class NativeSessionStorage implements SessionStorageInterface
public function regenerate($destroy = false, $lifetime = null)
{
// Cannot regenerate the session ID for non-active sessions.
if (\PHP_SESSION_ACTIVE !== session_status()) {
if (PHP_SESSION_ACTIVE !== session_status()) {
return false;
}
@ -341,7 +341,7 @@ class NativeSessionStorage implements SessionStorageInterface
*/
public function setOptions(array $options)
{
if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
if (headers_sent() || PHP_SESSION_ACTIVE === session_status()) {
return;
}
@ -401,7 +401,7 @@ class NativeSessionStorage implements SessionStorageInterface
}
$this->saveHandler = $saveHandler;
if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
if (headers_sent() || PHP_SESSION_ACTIVE === session_status()) {
return;
}

View File

@ -65,7 +65,7 @@ abstract class AbstractProxy
*/
public function isActive()
{
return \PHP_SESSION_ACTIVE === session_status();
return PHP_SESSION_ACTIVE === session_status();
}
/**

View File

@ -236,7 +236,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
}
if (!isset($this->bundleMap[$name])) {
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, \get_class($this)));
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, static::class));
}
if (true === $first) {
@ -583,7 +583,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$oldContainer = null;
if ($fresh = $cache->isFresh()) {
// Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
$errorLevel = error_reporting(E_ALL ^ E_WARNING);
$fresh = $oldContainer = false;
try {
if (file_exists($cache->getPath()) && \is_object($this->container = include $cache->getPath())) {
@ -651,7 +651,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
}
if (null === $oldContainer && file_exists($cache->getPath())) {
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
$errorLevel = error_reporting(E_ALL ^ E_WARNING);
try {
$oldContainer = include $cache->getPath();
} catch (\Throwable $e) {

View File

@ -105,6 +105,6 @@ class Logger extends AbstractLogger
$message = strtr($message, $replacements);
}
return sprintf('%s [%s] %s', date(\DateTime::RFC3339), $level, $message).\PHP_EOL;
return sprintf('%s [%s] %s', date(\DateTime::RFC3339), $level, $message).PHP_EOL;
}
}

View File

@ -39,7 +39,7 @@ class ContainerControllerResolverTest extends ControllerResolverTest
$controller = $resolver->getController($request);
$this->assertInstanceOf(\get_class($this), $controller[0]);
$this->assertInstanceOf(static::class, $controller[0]);
$this->assertSame('controllerMethod1', $controller[1]);
}

View File

@ -99,7 +99,7 @@ class RequestDataCollectorTest extends TestCase
'"Regular" callable',
[$this, 'testControllerInspection'],
[
'class' => RequestDataCollectorTest::class,
'class' => self::class,
'method' => 'testControllerInspection',
'file' => __FILE__,
'line' => $r1->getStartLine(),

View File

@ -186,7 +186,7 @@ class LoggerTest extends TestCase
public function testFormatter()
{
$this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile, function ($level, $message, $context) {
return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).\PHP_EOL;
return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).PHP_EOL;
});
$this->logger->error('An error', ['foo' => 'bar']);

View File

@ -109,9 +109,9 @@ class Collator
public function asort(&$array, $sortFlag = self::SORT_REGULAR)
{
$intlToPlainFlagMap = [
self::SORT_REGULAR => \SORT_REGULAR,
self::SORT_NUMERIC => \SORT_NUMERIC,
self::SORT_STRING => \SORT_STRING,
self::SORT_REGULAR => SORT_REGULAR,
self::SORT_NUMERIC => SORT_NUMERIC,
self::SORT_STRING => SORT_STRING,
];
$plainSortFlag = isset($intlToPlainFlagMap[$sortFlag]) ? $intlToPlainFlagMap[$sortFlag] : self::SORT_REGULAR;

View File

@ -201,9 +201,9 @@ class NumberFormatter
* @see https://php.net/round
*/
private static $phpRoundingMap = [
self::ROUND_HALFDOWN => \PHP_ROUND_HALF_DOWN,
self::ROUND_HALFEVEN => \PHP_ROUND_HALF_EVEN,
self::ROUND_HALFUP => \PHP_ROUND_HALF_UP,
self::ROUND_HALFDOWN => PHP_ROUND_HALF_DOWN,
self::ROUND_HALFEVEN => PHP_ROUND_HALF_EVEN,
self::ROUND_HALFUP => PHP_ROUND_HALF_UP,
];
/**
@ -357,7 +357,7 @@ class NumberFormatter
// The original NumberFormatter does not support this format type
if (self::TYPE_CURRENCY === $type) {
trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING);
trigger_error(__METHOD__.'(): Unsupported format type '.$type, E_USER_WARNING);
return false;
}
@ -513,7 +513,7 @@ class NumberFormatter
$type = (int) $type;
if (self::TYPE_DEFAULT === $type || self::TYPE_CURRENCY === $type) {
trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING);
trigger_error(__METHOD__.'(): Unsupported format type '.$type, E_USER_WARNING);
return false;
}

View File

@ -93,7 +93,7 @@ class CombinedStore implements StoreInterface, LoggerAwareInterface
public function waitAndSave(Key $key)
{
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', static::class));
}
/**

View File

@ -70,7 +70,7 @@ class MemcachedStore implements StoreInterface
public function waitAndSave(Key $key)
{
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', static::class));
}
/**

View File

@ -73,7 +73,7 @@ class RedisStore implements StoreInterface
public function waitAndSave(Key $key)
{
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', static::class));
}
/**

View File

@ -81,7 +81,7 @@ class SemaphoreStore implements StoreInterface
if (\PHP_VERSION_ID >= 50601) {
$acquired = @sem_acquire($resource, !$blocking);
} elseif (!$blocking) {
throw new NotSupportedException(sprintf('The store "%s" does not supports non blocking locks.', \get_class($this)));
throw new NotSupportedException(sprintf('The store "%s" does not supports non blocking locks.', static::class));
} else {
$acquired = @sem_acquire($resource);
}

View File

@ -29,15 +29,15 @@ while ($read || $write) {
$n = stream_select($r, $w, $e, 5);
if (false === $n) {
die(ERR_SELECT_FAILED);
exit(ERR_SELECT_FAILED);
} elseif ($n < 1) {
die(ERR_TIMEOUT);
exit(ERR_TIMEOUT);
}
if (in_array(STDOUT, $w) && strlen($out) > 0) {
$written = fwrite(STDOUT, (string) $out, 32768);
if (false === $written) {
die(ERR_WRITE_FAILED);
exit(ERR_WRITE_FAILED);
}
$out = (string) substr($out, $written);
}
@ -48,7 +48,7 @@ while ($read || $write) {
if (in_array(STDERR, $w) && strlen($err) > 0) {
$written = fwrite(STDERR, (string) $err, 32768);
if (false === $written) {
die(ERR_WRITE_FAILED);
exit(ERR_WRITE_FAILED);
}
$err = (string) substr($err, $written);
}
@ -65,7 +65,7 @@ while ($read || $write) {
if (false === $str || feof(STDIN)) {
$read = null;
if (!feof(STDIN)) {
die(ERR_READ_FAILED);
exit(ERR_READ_FAILED);
}
}
}

View File

@ -46,7 +46,7 @@ class Route
foreach ($data as $key => $value) {
$method = 'set'.str_replace('_', '', $key);
if (!method_exists($this, $method)) {
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, \get_class($this)));
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, static::class));
}
$this->$method($value);
}

View File

@ -55,7 +55,7 @@ abstract class ObjectRouteLoader extends Loader
$loaderObject = $this->getServiceObject($serviceString);
if (!\is_object($loaderObject)) {
throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject)));
throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', static::class, \gettype($loaderObject)));
}
if (!method_exists($loaderObject, $method)) {

View File

@ -216,7 +216,7 @@ abstract class AbstractToken implements TokenInterface
*/
public function __toString()
{
$class = \get_class($this);
$class = static::class;
$class = substr($class, strrpos($class, '\\') + 1);
$roles = [];

View File

@ -26,7 +26,7 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
return true;
}
return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>=');
return version_compare(\extension_loaded('sodium') ? SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>=');
}
/**
@ -79,15 +79,15 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
private function encodePasswordNative($raw)
{
return password_hash($raw, \PASSWORD_ARGON2I);
return password_hash($raw, PASSWORD_ARGON2I);
}
private function encodePasswordSodiumFunction($raw)
{
$hash = sodium_crypto_pwhash_str(
$raw,
\SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
\SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
);
sodium_memzero($raw);

View File

@ -27,7 +27,7 @@ abstract class AbstractGuardAuthenticator implements AuthenticatorInterface
*/
public function supports(Request $request)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Implement the "%s::supports()" method in class "%s" instead.', __METHOD__, AuthenticatorInterface::class, \get_class($this)), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Implement the "%s::supports()" method in class "%s" instead.', __METHOD__, AuthenticatorInterface::class, static::class), E_USER_DEPRECATED);
return true;
}

View File

@ -61,10 +61,10 @@ abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator
*/
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
{
@trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', \get_class($this)), E_USER_DEPRECATED);
@trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', static::class), E_USER_DEPRECATED);
if (!method_exists($this, 'getDefaultSuccessRedirectUrl')) {
throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in %s.', \get_class($this)));
throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in %s.', static::class));
}
$targetPath = null;

View File

@ -52,7 +52,7 @@ class LogoutUrlGenerator
if (\func_num_args() >= 6) {
$context = func_get_arg(5);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('The "%s()" method will have a 6th `string $context = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);

View File

@ -34,13 +34,13 @@ class Groups
public function __construct(array $data)
{
if (!isset($data['value']) || !$data['value']) {
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', \get_class($this)));
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', static::class));
}
$value = (array) $data['value'];
foreach ($value as $group) {
if (!\is_string($group)) {
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of strings.', \get_class($this)));
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of strings.', static::class));
}
}

View File

@ -31,11 +31,11 @@ class MaxDepth
public function __construct(array $data)
{
if (!isset($data['value'])) {
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', \get_class($this)));
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', static::class));
}
if (!\is_int($data['value']) || $data['value'] <= 0) {
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', \get_class($this)));
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', static::class));
}
$this->maxDepth = $data['value'];

View File

@ -304,10 +304,10 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
if (\func_num_args() >= 6) {
$format = func_get_arg(5);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Method %s::%s() will have a 6th `string $format = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED);
@trigger_error(sprintf('Method %s::%s() will have a 6th `string $format = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', static::class, __FUNCTION__), E_USER_DEPRECATED);
}
}

View File

@ -193,7 +193,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (\func_num_args() > 2) {
$context = func_get_arg(2);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('The "%s()" method will have a third `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
@ -214,7 +214,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (\func_num_args() > 3) {
$context = func_get_arg(3);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('The "%s()" method will have a fourth `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
@ -292,7 +292,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (\func_num_args() > 1) {
$context = func_get_arg(1);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
@ -313,7 +313,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (\func_num_args() > 1) {
$context = func_get_arg(1);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);

View File

@ -70,7 +70,7 @@ abstract class Constraint
public static function getErrorName($errorCode)
{
if (!isset(static::$errorNames[$errorCode])) {
throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, \get_called_class()));
throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class));
}
return static::$errorNames[$errorCode];
@ -115,7 +115,7 @@ abstract class Constraint
if (\is_array($options) && isset($options['value']) && !property_exists($this, 'value')) {
if (null === $defaultOption) {
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', \get_class($this)));
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class));
}
$options[$defaultOption] = $options['value'];
@ -136,7 +136,7 @@ abstract class Constraint
}
} elseif (null !== $options && !(\is_array($options) && 0 === \count($options))) {
if (null === $defaultOption) {
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', \get_class($this)));
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class));
}
if (\array_key_exists($defaultOption, $knownOptions)) {
@ -148,11 +148,11 @@ abstract class Constraint
}
if (\count($invalidOptions) > 0) {
throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), \get_class($this)), $invalidOptions);
throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), static::class), $invalidOptions);
}
if (\count($missingOptions) > 0) {
throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), \get_class($this)), array_keys($missingOptions));
throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), static::class), array_keys($missingOptions));
}
}
@ -176,7 +176,7 @@ abstract class Constraint
return;
}
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, \get_class($this)), [$option]);
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
}
/**
@ -202,7 +202,7 @@ abstract class Constraint
return $this->groups;
}
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, \get_class($this)), [$option]);
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
}
/**
@ -266,7 +266,7 @@ abstract class Constraint
*/
public function validatedBy()
{
return \get_class($this).'Validator';
return static::class.'Validator';
}
/**

View File

@ -38,15 +38,15 @@ abstract class AbstractComparison extends Constraint
if (\is_array($options)) {
if (!isset($options['value']) && !isset($options['propertyPath'])) {
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', \get_class($this)));
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', static::class));
}
if (isset($options['value']) && isset($options['propertyPath'])) {
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', \get_class($this)));
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', static::class));
}
if (isset($options['propertyPath']) && !class_exists(PropertyAccess::class)) {
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option.', \get_class($this)));
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option.', static::class));
}
}

View File

@ -71,11 +71,11 @@ abstract class Composite extends Constraint
$constraint = \get_class($constraint);
}
throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, \get_class($this)));
throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, static::class));
}
if ($constraint instanceof Valid) {
throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', \get_class($this)));
throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', static::class));
}
}
@ -99,7 +99,7 @@ abstract class Composite extends Constraint
$excessGroups = array_diff($constraint->groups, $this->groups);
if (\count($excessGroups) > 0) {
throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), \get_class($this)));
throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), static::class));
}
} else {
$constraint->groups = $this->groups;

View File

@ -48,7 +48,7 @@ class Stub
{
$properties = [];
if (!isset(self::$defaultProperties[$c = \get_class($this)])) {
if (!isset(self::$defaultProperties[$c = static::class])) {
self::$defaultProperties[$c] = get_class_vars($c);
foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) {