Skip to content

Commit

Permalink
feature #816 Bump dependencies for v2.11 (chalasr)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.x branch.

Discussion
----------

Bump dependencies for v2.11

- lcobucci/jwt >=3.4
- symfony >=4.4
- PHP >=7.1 (as per Symfony 4.4)

Commits
-------

987cfc7 Fix CS
96ac247 Remove support for lcobucci/jwt <3.4 & symfony/* <4.4
  • Loading branch information
chalasr committed Jan 3, 2021
2 parents f6c0d9a + 987cfc7 commit 155c3d8
Show file tree
Hide file tree
Showing 83 changed files with 319 additions and 902 deletions.
44 changes: 5 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
push:

jobs:
php-56:
name: PHP 5.6 / Symfony 3.4
php-71:
name: PHP 7.1 / Symfony 4.4
runs-on: ubuntu-latest
steps:
- name: "Checkout"
Expand All @@ -17,48 +17,14 @@ jobs:
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "5.6"
php-version: "7.1"

- name: "Cache composer packages"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-5.6-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-5.6-composer-locked-"

- name: "Install Symfony 3.4"
run: "composer require symfony/symfony:3.4.* --no-update"

- name: "Install Symfony PHPUnit Bridge 3.4"
run: "composer require symfony/phpunit-bridge:3.4.* --no-update"

- name: "Install dependencies with composer"
run: "composer update --no-interaction --prefer-dist --prefer-stable"

- name: "Run PHPUnit Tests"
env:
SYMFONY_PHPUNIT_VERSION: 5.7
run: "composer test"
php-72:
name: PHP 7.2 / Symfony 4.4
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "7.2"

- name: "Cache composer packages"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-7.2-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-7.2-composer-locked-"
key: "php-7.1-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-7.1-composer-locked-"

- name: "Install Symfony 4.4"
run: "composer require symfony/symfony:4.4.* --no-update"
Expand Down
25 changes: 9 additions & 16 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(array(__DIR__))
;
$finder = PhpCsFixer\Finder::create()->in([__DIR__]);

return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers(array(
'-phpdoc_scalar',
'-extra_empty_lines',
'-unalign_double_arrow',
'-unalign_equals',
'align_double_arrow',
'newline_after_open_tag',
'ordered_use',
'short_array_syntax',
))
return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'ordered_imports' => true,
'array_syntax' => ['syntax' => 'short'],
'phpdoc_scalar' => false,
])
->setUsingCache(false)
->finder($finder)
->setFinder($finder);
;
2 changes: 1 addition & 1 deletion Command/CheckConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CheckConfigCommand extends Command

public function __construct(KeyLoaderInterface $keyLoader, $signatureAlgorithm)
{
$this->keyLoader = $keyLoader;
$this->keyLoader = $keyLoader;
$this->signatureAlgorithm = $signatureAlgorithm;

parent::__construct();
Expand Down
2 changes: 1 addition & 1 deletion Command/GenerateTokenCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(JWTTokenManagerInterface $tokenManager, \Traversable
{
parent::__construct();

$this->tokenManager = $tokenManager;
$this->tokenManager = $tokenManager;
$this->userProviders = $userProviders;
}

Expand Down
6 changes: 3 additions & 3 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('lexik_jwt_authentication');
$rootNode = \method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('lexik_jwt_authentication');

$rootNode
$treeBuilder
->getRootNode()
->addDefaultsIfNotSet()
->children()
->scalarNode('private_key_path')
Expand Down Expand Up @@ -109,7 +109,7 @@ public function getConfigTreeBuilder()
private function getTokenExtractorsNode()
{
$builder = new TreeBuilder('token_extractors');
$node = \method_exists(TreeBuilder::class, 'getRootNode') ? $builder->getRootNode() : $builder->root('token_extractors');
$node = $builder->getRootNode();
$node
->addDefaultsIfNotSet()
->children()
Expand Down
3 changes: 1 addition & 2 deletions DependencyInjection/LexikJWTAuthenticationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class LexikJWTAuthenticationExtension extends Extension
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$config = $this->processConfiguration($configuration, $configs);

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

Expand Down Expand Up @@ -63,7 +63,6 @@ public function load(array $configs, ContainerBuilder $container)
$e->setPath('lexik_jwt_authentication');

throw $e;

}

$container->setParameter('lexik_jwt_authentication.pass_phrase', $config['pass_phrase']);
Expand Down
5 changes: 2 additions & 3 deletions DependencyInjection/Security/Factory/JWTFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,8 @@ public function addConfiguration(NodeDefinition $node)
/**
* Create an entry point, by default it sends a 401 header and ends the request.
*
* @param ContainerBuilder $container
* @param string $id
* @param mixed $defaultEntryPoint
* @param string $id
* @param mixed $defaultEntryPoint
*
* @return string
*/
Expand Down
3 changes: 0 additions & 3 deletions Encoder/HeaderAwareJWTEncoderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
interface HeaderAwareJWTEncoderInterface extends JWTEncoderInterface
{
/**
* @param array $data
* @param array $header
*
* @return string the encoded token string
*
* @throws JWTEncodeFailureException If an error occurred while trying to create
Expand Down
2 changes: 0 additions & 2 deletions Encoder/JWTEncoderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
interface JWTEncoderInterface
{
/**
* @param array $data
*
* @return string the encoded token string
*
* @throws JWTEncodeFailureException If an error occurred while trying to create
Expand Down
3 changes: 0 additions & 3 deletions Encoder/LcobucciJWTEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ class LcobucciJWTEncoder implements JWTEncoderInterface, HeaderAwareJWTEncoderIn
*/
protected $jwsProvider;

/**
* @param JWSProviderInterface $jwsProvider
*/
public function __construct(JWSProviderInterface $jwsProvider)
{
$this->jwsProvider = $jwsProvider;
Expand Down
10 changes: 2 additions & 8 deletions Event/AuthenticationFailureEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Contracts\EventDispatcher\Event;

/**
* AuthenticationFailureEvent.
Expand All @@ -23,14 +24,10 @@ class AuthenticationFailureEvent extends Event
*/
protected $response;

/**
* @param AuthenticationException $exception
* @param Response $response
*/
public function __construct(AuthenticationException $exception, Response $response)
{
$this->exception = $exception;
$this->response = $response;
$this->response = $response;
}

/**
Expand All @@ -49,9 +46,6 @@ public function getResponse()
return $this->response;
}

/**
* @param Response $response
*/
public function setResponse(Response $response)
{
$this->response = $response;
Expand Down
13 changes: 3 additions & 10 deletions Event/AuthenticationSuccessEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Contracts\EventDispatcher\Event;

/**
* AuthenticationSuccessEvent.
Expand All @@ -27,15 +28,10 @@ class AuthenticationSuccessEvent extends Event
*/
protected $response;

/**
* @param array $data
* @param UserInterface $user
* @param Response $response
*/
public function __construct(array $data, UserInterface $user, Response $response)
{
$this->data = $data;
$this->user = $user;
$this->data = $data;
$this->user = $user;
$this->response = $response;
}

Expand All @@ -47,9 +43,6 @@ public function getData()
return $this->data;
}

/**
* @param array $data
*/
public function setData(array $data)
{
$this->data = $data;
Expand Down
18 changes: 0 additions & 18 deletions Event/Event.php

This file was deleted.

10 changes: 2 additions & 8 deletions Event/JWTAuthenticatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Lexik\Bundle\JWTAuthenticationBundle\Event;

use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Contracts\EventDispatcher\Event;

/**
* JWTAuthenticatedEvent.
Expand All @@ -19,14 +20,10 @@ class JWTAuthenticatedEvent extends Event
*/
protected $token;

/**
* @param array $payload
* @param TokenInterface $token
*/
public function __construct(array $payload, TokenInterface $token)
{
$this->payload = $payload;
$this->token = $token;
$this->token = $token;
}

/**
Expand All @@ -37,9 +34,6 @@ public function getPayload()
return $this->payload;
}

/**
* @param array $payload
*/
public function setPayload(array $payload)
{
$this->payload = $payload;
Expand Down
16 changes: 3 additions & 13 deletions Event/JWTCreatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Lexik\Bundle\JWTAuthenticationBundle\Event;

use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Contracts\EventDispatcher\Event;

/**
* JWTCreatedEvent.
Expand All @@ -24,15 +25,10 @@ class JWTCreatedEvent extends Event
*/
protected $user;

/**
* @param array $data
* @param UserInterface $user
* @param array $header
*/
public function __construct(array $data, UserInterface $user, array $header = [])
{
$this->data = $data;
$this->user = $user;
$this->data = $data;
$this->user = $user;
$this->header = $header;
}

Expand All @@ -44,9 +40,6 @@ public function getHeader()
return $this->header;
}

/**
* @param array $header
*/
public function setHeader(array $header)
{
$this->header = $header;
Expand All @@ -60,9 +53,6 @@ public function getData()
return $this->data;
}

/**
* @param array $data
*/
public function setData(array $data)
{
$this->data = $data;
Expand Down
10 changes: 3 additions & 7 deletions Event/JWTDecodedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Lexik\Bundle\JWTAuthenticationBundle\Event;

use Symfony\Contracts\EventDispatcher\Event;

/**
* JWTDecodedEvent.
*
Expand All @@ -19,9 +21,6 @@ class JWTDecodedEvent extends Event
*/
protected $isValid;

/**
* @param array $payload
*/
public function __construct(array $payload)
{
$this->payload = $payload;
Expand All @@ -36,9 +35,6 @@ public function getPayload()
return $this->payload;
}

/**
* @param array $payload
*/
public function setPayload(array $payload)
{
$this->payload = $payload;
Expand All @@ -54,7 +50,7 @@ public function markAsInvalid()
}

/**
* @return boolean
* @return bool
*/
public function isValid()
{
Expand Down
Loading

0 comments on commit 155c3d8

Please sign in to comment.