Skip to content

Commit 370f094

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: Use ::class keyword when possible
2 parents 514a6fd + 7143c52 commit 370f094

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
@@ -138,7 +138,7 @@ public function load(array $configs, ContainerBuilder $container)
138138
$loader->load('security_debug.php');
139139
}
140140

141-
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
141+
if (!class_exists(\Symfony\Component\ExpressionLanguage\ExpressionLanguage::class)) {
142142
$container->removeDefinition('security.expression_language');
143143
$container->removeDefinition('security.access.expression_voter');
144144
}
@@ -849,7 +849,7 @@ private function createExpression(ContainerBuilder $container, string $expressio
849849
return $this->expressions[$id];
850850
}
851851

852-
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
852+
if (!class_exists(\Symfony\Component\ExpressionLanguage\ExpressionLanguage::class)) {
853853
throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
854854
}
855855

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
@@ -597,7 +597,7 @@ public function testCustomAccessDecisionManagerService()
597597

598598
public function testAccessDecisionManagerServiceAndStrategyCannotBeUsedAtTheSameTime()
599599
{
600-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
600+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
601601
$this->expectExceptionMessage('Invalid configuration for path "security.access_decision_manager": "strategy" and "service" cannot be used together.');
602602
$this->getContainer('access_decision_manager_service_and_strategy');
603603
}
@@ -615,14 +615,14 @@ public function testAccessDecisionManagerOptionsAreNotOverriddenByImplicitStrate
615615

616616
public function testFirewallUndefinedUserProvider()
617617
{
618-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
618+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
619619
$this->expectExceptionMessage('Invalid firewall "main": user provider "undefined" not found.');
620620
$this->getContainer('firewall_undefined_provider');
621621
}
622622

623623
public function testFirewallListenerUndefinedProvider()
624624
{
625-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
625+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
626626
$this->expectExceptionMessage('Invalid firewall "main": user provider "undefined" not found.');
627627
$this->getContainer('listener_undefined_provider');
628628
}

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
@@ -42,7 +42,7 @@ public function testAddValidConfiguration(array $inputConfig, array $expectedCon
4242
*/
4343
public function testAddInvalidConfiguration(array $inputConfig)
4444
{
45-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
45+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
4646
$factory = new GuardAuthenticationFactory();
4747
$nodeDefinition = new ArrayNodeDefinition('guard');
4848
$factory->addConfiguration($nodeDefinition);
@@ -133,7 +133,7 @@ public function testExistingDefaultEntryPointUsed()
133133

134134
public function testCannotOverrideDefaultEntryPoint()
135135
{
136-
$this->expectException('LogicException');
136+
$this->expectException(\LogicException::class);
137137
// any existing default entry point is used
138138
$config = [
139139
'authenticators' => ['authenticator123'],
@@ -144,7 +144,7 @@ public function testCannotOverrideDefaultEntryPoint()
144144

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

Tests/DependencyInjection/SecurityExtensionTest.php

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

@@ -68,7 +68,7 @@ public function testInvalidCheckPath()
6868

6969
public function testFirewallWithoutAuthenticationListener()
7070
{
71-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
71+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
7272
$this->expectExceptionMessage('No authentication listener registered for firewall "some_firewall"');
7373
$container = $this->getRawContainer();
7474

@@ -89,7 +89,7 @@ public function testFirewallWithoutAuthenticationListener()
8989

9090
public function testFirewallWithInvalidUserProvider()
9191
{
92-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
92+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
9393
$this->expectExceptionMessage('Unable to create definition for "security.user.provider.concrete.my_foo" user provider');
9494
$container = $this->getRawContainer();
9595

@@ -208,7 +208,7 @@ public function testPerListenerProvider()
208208

209209
public function testMissingProviderForListener()
210210
{
211-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
211+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
212212
$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.');
213213
$container = $this->getRawContainer();
214214
$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)