Skip to content

Commit a54ca06

Browse files
committed
style: fix codebase with PHPStan's help
1 parent 24ddca0 commit a54ca06

File tree

8 files changed

+17
-33
lines changed

8 files changed

+17
-33
lines changed

DependencyInjection/Security/Factory/OAuthFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
1717
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
18-
use Symfony\Component\DependencyInjection\ContainerBuilder;
1918
use Symfony\Component\DependencyInjection\ChildDefinition;
19+
use Symfony\Component\DependencyInjection\ContainerBuilder;
2020
use Symfony\Component\DependencyInjection\DefinitionDecorator;
2121
use Symfony\Component\DependencyInjection\Reference;
2222

Form/Type/AuthorizeFormType.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Form\AbstractType;
1818
use Symfony\Component\Form\FormBuilderInterface;
1919
use Symfony\Component\OptionsResolver\OptionsResolver;
20-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
2120

2221
/**
2322
* @author Chris Jones <[email protected]>
@@ -35,16 +34,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3534
$builder->add('scope', $hiddenType);
3635
}
3736

38-
/**
39-
* {@inheritdoc}
40-
*
41-
* @todo Remove it when bumping requirements to SF 2.7+
42-
*/
43-
public function setDefaultOptions(OptionsResolverInterface $resolver)
44-
{
45-
$this->configureOptions($resolver);
46-
}
47-
4837
/**
4938
* {@inheritdoc}
5039
*/

Security/Authentication/Provider/OAuthProvider.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ public function authenticate(TokenInterface $token)
119119
return $token;
120120
}
121121
} catch (OAuth2ServerException $e) {
122-
if (!method_exists('Symfony\Component\Security\Core\Exception\AuthenticationException', 'setToken')) {
123-
// Symfony 2.1
124-
throw new AuthenticationException('OAuth2 authentication failed', null, 0, $e);
125-
}
126-
127122
throw new AuthenticationException('OAuth2 authentication failed', 0, $e);
128123
}
129124

Security/Firewall/OAuthListener.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
2222
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2323
use Symfony\Component\Security\Core\Exception\AuthenticationException;
24-
use Symfony\Component\Security\Core\SecurityContextInterface;
2524
use Symfony\Component\Security\Http\Firewall\ListenerInterface;
2625

2726
/**
@@ -32,7 +31,7 @@
3231
class OAuthListener implements ListenerInterface
3332
{
3433
/**
35-
* @var TokenStorageInterface|SecurityContextInterface
34+
* @var TokenStorageInterface
3635
*/
3736
protected $securityContext;
3837

@@ -47,15 +46,15 @@ class OAuthListener implements ListenerInterface
4746
protected $serverService;
4847

4948
/**
50-
* @param TokenStorageInterface|SecurityContextInterface $tokenStorage the token storage
51-
* @param AuthenticationManagerInterface $authenticationManager the authentication manager
52-
* @param OAuth2 $serverService
53-
* @param mixed $securityContext
49+
* @param TokenStorageInterface $tokenStorage the token storage
50+
* @param AuthenticationManagerInterface $authenticationManager the authentication manager
51+
* @param OAuth2 $serverService
52+
* @param mixed $securityContext
5453
*/
5554
public function __construct($securityContext, AuthenticationManagerInterface $authenticationManager, OAuth2 $serverService)
5655
{
57-
if (!$securityContext instanceof TokenStorageInterface && !$securityContext instanceof SecurityContextInterface) {
58-
throw new \InvalidArgumentException('Wrong type for OAuthListener, it has to implement TokenStorageInterface or SecurityContextInterface');
56+
if (!$securityContext instanceof TokenStorageInterface) {
57+
throw new \InvalidArgumentException('Wrong type for OAuthListener, it has to implement TokenStorageInterface');
5958
}
6059
if ($securityContext instanceof SecurityContextInterface) {
6160
@trigger_error(sprintf('Injecting SecurityContextInterface into %1$s::__construct is deprecated since 1.6 and will be removed in 2.0.', __CLASS__), E_USER_DEPRECATED);

Tests/DependencyInjection/FOSOAuthServerExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* file that was distributed with this source code.
1212
*/
1313

14-
namespace DependencyInjection;
14+
namespace FOS\OAuthServerBundle\Tests\DependencyInjection;
1515

1616
use Symfony\Component\Config\FileLocator;
1717
use Symfony\Component\Routing\Loader\XmlFileLoader;

Tests/Storage/OAuthStorageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* file that was distributed with this source code.
1212
*/
1313

14-
namespace FOS\OAuth2ServiceBundle\Tests\Storage;
14+
namespace FOS\OAuthServerBundle\Tests\Storage;
1515

1616
use FOS\OAuthServerBundle\Model\AccessToken;
1717
use FOS\OAuthServerBundle\Model\AuthCode;

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
"require": {
1919
"php": "^7.1",
2020
"friendsofsymfony/oauth2-php": "~1.1",
21-
"symfony/framework-bundle": "~2.8|~3.0|^4.0",
22-
"symfony/security-bundle": "~2.8|~3.0|^4.0",
21+
"symfony/framework-bundle": "~3.0|^4.0",
22+
"symfony/security-bundle": "~3.0|^4.0",
2323
"symfony/dependency-injection": "^2.8|~3.0|^4.0"
2424
},
2525
"require-dev": {
26-
"symfony/class-loader": "~2.8|~3.0|^4.0",
27-
"symfony/yaml": "~2.8|~3.0|^4.0",
28-
"symfony/form": "~2.8|~3.0|^4.0",
29-
"symfony/console": "~2.8|~3.0|^4.0",
26+
"symfony/class-loader": "~3.0|^4.0",
27+
"symfony/yaml": "~3.0|^4.0",
28+
"symfony/form": "~3.0|^4.0",
29+
"symfony/console": "~3.0|^4.0",
30+
"symfony/templating": "~3.0|^4.0",
3031
"willdurand/propel-typehintable-behavior": "^1.0.4",
3132
"propel/propel1": "^1.6.5",
3233
"phing/phing": "~2.4",

0 commit comments

Comments
 (0)