Skip to content

Commit 84b40f2

Browse files
committed
Use ::class keyword when possible
1 parent 1581166 commit 84b40f2

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

DependencyInjection/SecurityExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function load(array $configs, ContainerBuilder $container)
115115
$loader->load('security_debug.xml');
116116
}
117117

118-
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
118+
if (!class_exists(\Symfony\Component\ExpressionLanguage\ExpressionLanguage::class)) {
119119
$container->removeDefinition('security.expression_language');
120120
$container->removeDefinition('security.access.expression_voter');
121121
}
@@ -707,7 +707,7 @@ private function createExpression(ContainerBuilder $container, string $expressio
707707
return $this->expressions[$id];
708708
}
709709

710-
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
710+
if (!class_exists(\Symfony\Component\ExpressionLanguage\ExpressionLanguage::class)) {
711711
throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
712712
}
713713

Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AddSecurityVotersPassTest extends TestCase
2424
{
2525
public function testNoVoters()
2626
{
27-
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
27+
$this->expectException(LogicException::class);
2828
$this->expectExceptionMessage('No security voters found. You need to tag at least one with "security.voter".');
2929
$container = new ContainerBuilder();
3030
$container

Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ public function testCustomAccessDecisionManagerService()
610610

611611
public function testAccessDecisionManagerServiceAndStrategyCannotBeUsedAtTheSameTime()
612612
{
613-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
613+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
614614
$this->expectExceptionMessage('Invalid configuration for path "security.access_decision_manager": "strategy" and "service" cannot be used together.');
615615
$this->getContainer('access_decision_manager_service_and_strategy');
616616
}
@@ -628,14 +628,14 @@ public function testAccessDecisionManagerOptionsAreNotOverriddenByImplicitStrate
628628

629629
public function testFirewallUndefinedUserProvider()
630630
{
631-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
631+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
632632
$this->expectExceptionMessage('Invalid firewall "main": user provider "undefined" not found.');
633633
$this->getContainer('firewall_undefined_provider');
634634
}
635635

636636
public function testFirewallListenerUndefinedProvider()
637637
{
638-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
638+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
639639
$this->expectExceptionMessage('Invalid firewall "main": user provider "undefined" not found.');
640640
$this->getContainer('listener_undefined_provider');
641641
}

Tests/DependencyInjection/MainConfigurationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class MainConfigurationTest extends TestCase
3434

3535
public function testNoConfigForProvider()
3636
{
37-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
37+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
3838
$config = [
3939
'providers' => [
4040
'stub' => [],
@@ -48,7 +48,7 @@ public function testNoConfigForProvider()
4848

4949
public function testManyConfigForProvider()
5050
{
51-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
51+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
5252
$config = [
5353
'providers' => [
5454
'stub' => [

Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function getSuccessHandlers()
127127

128128
protected function callFactory($id, $config, $userProviderId, $defaultEntryPointId)
129129
{
130-
$factory = $this->getMockForAbstractClass('Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory', []);
130+
$factory = $this->getMockForAbstractClass(\Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory::class, []);
131131

132132
$factory
133133
->expects($this->once())

Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testAddValidConfiguration(array $inputConfig, array $expectedCon
4141
*/
4242
public function testAddInvalidConfiguration(array $inputConfig)
4343
{
44-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
44+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
4545
$factory = new GuardAuthenticationFactory();
4646
$nodeDefinition = new ArrayNodeDefinition('guard');
4747
$factory->addConfiguration($nodeDefinition);
@@ -132,7 +132,7 @@ public function testExistingDefaultEntryPointUsed()
132132

133133
public function testCannotOverrideDefaultEntryPoint()
134134
{
135-
$this->expectException('LogicException');
135+
$this->expectException(\LogicException::class);
136136
// any existing default entry point is used
137137
$config = [
138138
'authenticators' => ['authenticator123'],
@@ -143,7 +143,7 @@ public function testCannotOverrideDefaultEntryPoint()
143143

144144
public function testMultipleAuthenticatorsRequiresEntryPoint()
145145
{
146-
$this->expectException('LogicException');
146+
$this->expectException(\LogicException::class);
147147
// any existing default entry point is used
148148
$config = [
149149
'authenticators' => ['authenticator123', 'authenticatorABC'],

Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SecurityExtensionTest extends TestCase
2626
{
2727
public function testInvalidCheckPath()
2828
{
29-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
29+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
3030
$this->expectExceptionMessage('The check_path "/some_area/login_check" for login method "form_login" is not matched by the firewall pattern "/secured_area/.*".');
3131
$container = $this->getRawContainer();
3232

@@ -50,7 +50,7 @@ public function testInvalidCheckPath()
5050

5151
public function testFirewallWithoutAuthenticationListener()
5252
{
53-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
53+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
5454
$this->expectExceptionMessage('No authentication listener registered for firewall "some_firewall"');
5555
$container = $this->getRawContainer();
5656

@@ -71,7 +71,7 @@ public function testFirewallWithoutAuthenticationListener()
7171

7272
public function testFirewallWithInvalidUserProvider()
7373
{
74-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
74+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
7575
$this->expectExceptionMessage('Unable to create definition for "security.user.provider.concrete.my_foo" user provider');
7676
$container = $this->getRawContainer();
7777

@@ -190,7 +190,7 @@ public function testPerListenerProvider()
190190

191191
public function testMissingProviderForListener()
192192
{
193-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
193+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
194194
$this->expectExceptionMessage('Not configuring explicitly the provider for the "http_basic" listener on "ambiguous" firewall is ambiguous as there is more than one registered provider.');
195195
$container = $this->getRawContainer();
196196
$container->loadFromExtension('security', [

Tests/Functional/UserPasswordEncoderCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public function testNonInteractiveEncodePasswordUsesFirstUserClass()
298298

299299
public function testThrowsExceptionOnNoConfiguredEncoders()
300300
{
301-
$this->expectException('RuntimeException');
301+
$this->expectException(\RuntimeException::class);
302302
$this->expectExceptionMessage('There are no configured encoders for the "security" extension.');
303303
$application = new ConsoleApplication();
304304
$application->add(new UserPasswordEncoderCommand($this->getMockBuilder(EncoderFactoryInterface::class)->getMock(), []));

0 commit comments

Comments
 (0)