From d97e51e84cb15231664db9bdee5a9c96d797a939 Mon Sep 17 00:00:00 2001 From: Michele Sangalli Date: Fri, 21 Jan 2022 12:26:53 +0100 Subject: [PATCH] Fix access to static property form 'self::' to 'static::' --- src/Test/WebTestCase.php | 20 ++++++++++---------- tests/Command/CommandTest.php | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Test/WebTestCase.php b/src/Test/WebTestCase.php index c4476202..d1a25023 100644 --- a/src/Test/WebTestCase.php +++ b/src/Test/WebTestCase.php @@ -88,7 +88,7 @@ protected function runCommand(string $name, array $params = [], bool $reuseKerne static::ensureKernelShutdown(); } - $kernel = static::bootKernel(['environment' => self::$env]); + $kernel = static::bootKernel(['environment' => static::$env]); $kernel->boot(); } else { $kernel = $this->getContainer()->get('kernel'); @@ -208,10 +208,10 @@ public function isDecorated(bool $decorated): void */ private function getDependencyInjectionContainer(): ContainerInterface { - $cacheKey = self::$env; + $cacheKey = static::$env; if (empty($this->containers[$cacheKey])) { $kernel = static::createKernel([ - 'environment' => self::$env, + 'environment' => static::$env, ]); $kernel->boot(); @@ -229,7 +229,7 @@ private function getDependencyInjectionContainer(): ContainerInterface protected static function createKernel(array $options = []): KernelInterface { if (!isset($options['environment'])) { - $options['environment'] = self::$env; + $options['environment'] = static::$env; } return parent::createKernel($options); @@ -253,9 +253,9 @@ public function __set($name, $value) throw new \Exception(sprintf('There is no property with name "%s"', $name)); } - @trigger_error('Setting "environment" property is deprecated, please use self::$env.', \E_USER_DEPRECATED); + @trigger_error('Setting "environment" property is deprecated, please use static::$env.', \E_USER_DEPRECATED); - self::$env = $value; + static::$env = $value; } public function __isset($name) @@ -264,7 +264,7 @@ public function __isset($name) throw new \Exception(sprintf('There is no property with name "%s"', $name)); } - @trigger_error('Checking "environment" property is deprecated, please use self::$env.', \E_USER_DEPRECATED); + @trigger_error('Checking "environment" property is deprecated, please use static::$env.', \E_USER_DEPRECATED); return true; } @@ -275,9 +275,9 @@ public function __get($name) throw new \Exception(sprintf('There is no property with name "%s"', $name)); } - @trigger_error('Getting "environment" property is deprecated, please use self::$env.', \E_USER_DEPRECATED); + @trigger_error('Getting "environment" property is deprecated, please use static::$env.', \E_USER_DEPRECATED); - return self::$env; + return static::$env; } /** @@ -496,7 +496,7 @@ protected function createClientWithParams(array $params, ?string $username = nul static::ensureKernelShutdown(); } - $client = static::createClient(['environment' => self::$env], $params); + $client = static::createClient(['environment' => static::$env], $params); if ($this->firewallLogins) { // has to be set otherwise "hasPreviousSession" in Request returns false. diff --git a/tests/Command/CommandTest.php b/tests/Command/CommandTest.php index c4110504..25559236 100644 --- a/tests/Command/CommandTest.php +++ b/tests/Command/CommandTest.php @@ -76,7 +76,7 @@ public function testRunCommandWithInputs(): void public function testRunCommandWithoutOptionsAndNotReuseKernel(bool $useEnv): void { if ($useEnv) { - self::$env = 'test'; + static::$env = 'test'; } else { $this->environment = 'test'; } @@ -96,7 +96,7 @@ public function testRunCommandWithoutOptionsAndNotReuseKernel(bool $useEnv): voi // Run command and reuse kernel if ($useEnv) { - self::$env = 'prod'; + static::$env = 'prod'; } else { $this->environment = 'prod'; }