From bc900dfd9952a2302479376bede03296200b7467 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <theo.fidry@gmail.com>
Date: Tue, 2 May 2023 14:50:13 +0200
Subject: [PATCH 01/10] cs: Apply the configured CS rules

---
 .../AuthorizationRequestUserResolvingListenerTrait.php        | 2 ++
 src/Model/AccessTokenInterface.php                            | 4 +---
 src/Model/AuthorizationCodeInterface.php                      | 4 +---
 src/Model/RefreshTokenInterface.php                           | 4 +---
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/EventListener/AuthorizationRequestUserResolvingListenerTrait.php b/src/EventListener/AuthorizationRequestUserResolvingListenerTrait.php
index 8e95d4f2..f9d4861d 100644
--- a/src/EventListener/AuthorizationRequestUserResolvingListenerTrait.php
+++ b/src/EventListener/AuthorizationRequestUserResolvingListenerTrait.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace League\Bundle\OAuth2ServerBundle\EventListener;
 
 use League\Bundle\OAuth2ServerBundle\Event\AuthorizationRequestResolveEvent;
diff --git a/src/Model/AccessTokenInterface.php b/src/Model/AccessTokenInterface.php
index f1056830..dca46d1a 100644
--- a/src/Model/AccessTokenInterface.php
+++ b/src/Model/AccessTokenInterface.php
@@ -4,15 +4,13 @@
 
 namespace League\Bundle\OAuth2ServerBundle\Model;
 
-use DateTimeInterface;
-
 interface AccessTokenInterface
 {
     public function __toString(): string;
 
     public function getIdentifier(): string;
 
-    public function getExpiry(): DateTimeInterface;
+    public function getExpiry(): \DateTimeInterface;
 
     public function getUserIdentifier(): ?string;
 
diff --git a/src/Model/AuthorizationCodeInterface.php b/src/Model/AuthorizationCodeInterface.php
index fc8abe86..83c37987 100644
--- a/src/Model/AuthorizationCodeInterface.php
+++ b/src/Model/AuthorizationCodeInterface.php
@@ -4,15 +4,13 @@
 
 namespace League\Bundle\OAuth2ServerBundle\Model;
 
-use DateTimeInterface;
-
 interface AuthorizationCodeInterface
 {
     public function __toString(): string;
 
     public function getIdentifier(): string;
 
-    public function getExpiryDateTime(): DateTimeInterface;
+    public function getExpiryDateTime(): \DateTimeInterface;
 
     public function getUserIdentifier(): ?string;
 
diff --git a/src/Model/RefreshTokenInterface.php b/src/Model/RefreshTokenInterface.php
index 46ead423..865c5a5a 100644
--- a/src/Model/RefreshTokenInterface.php
+++ b/src/Model/RefreshTokenInterface.php
@@ -4,15 +4,13 @@
 
 namespace League\Bundle\OAuth2ServerBundle\Model;
 
-use DateTimeInterface;
-
 interface RefreshTokenInterface
 {
     public function __toString(): string;
 
     public function getIdentifier(): string;
 
-    public function getExpiry(): DateTimeInterface;
+    public function getExpiry(): \DateTimeInterface;
 
     public function getAccessToken(): ?AccessTokenInterface;
 

From 985d6a3418c20d4a6a6c647791bcab3e669b6ff5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20H=C3=A9lias?= <maximehelias16@gmail.com>
Date: Thu, 11 May 2023 16:57:18 +0200
Subject: [PATCH 02/10] Used DoctrineOrmMappingsPass instead of the extends

---
 .../RegisterDoctrineOrmMappingPass.php        | 25 -------------------
 src/LeagueOAuth2ServerBundle.php              | 13 ++++++++--
 2 files changed, 11 insertions(+), 27 deletions(-)
 delete mode 100644 src/DependencyInjection/CompilerPass/RegisterDoctrineOrmMappingPass.php

diff --git a/src/DependencyInjection/CompilerPass/RegisterDoctrineOrmMappingPass.php b/src/DependencyInjection/CompilerPass/RegisterDoctrineOrmMappingPass.php
deleted file mode 100644
index 90f2f37d..00000000
--- a/src/DependencyInjection/CompilerPass/RegisterDoctrineOrmMappingPass.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace League\Bundle\OAuth2ServerBundle\DependencyInjection\CompilerPass;
-
-use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
-use League\Bundle\OAuth2ServerBundle\Persistence\Mapping\Driver;
-use Symfony\Component\DependencyInjection\Reference;
-
-/**
- * @author Mathias Arlaud <mathias.arlaud@gmail.com>
- */
-class RegisterDoctrineOrmMappingPass extends DoctrineOrmMappingsPass
-{
-    public function __construct()
-    {
-        parent::__construct(
-            new Reference(Driver::class),
-            ['League\Bundle\OAuth2ServerBundle\Model'],
-            ['league.oauth2_server.persistence.doctrine.manager'],
-            'league.oauth2_server.persistence.doctrine.enabled'
-        );
-    }
-}
diff --git a/src/LeagueOAuth2ServerBundle.php b/src/LeagueOAuth2ServerBundle.php
index 1a3d2e49..3b241a7c 100644
--- a/src/LeagueOAuth2ServerBundle.php
+++ b/src/LeagueOAuth2ServerBundle.php
@@ -4,13 +4,15 @@
 
 namespace League\Bundle\OAuth2ServerBundle;
 
+use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
 use League\Bundle\OAuth2ServerBundle\DependencyInjection\CompilerPass\EncryptionKeyPass;
-use League\Bundle\OAuth2ServerBundle\DependencyInjection\CompilerPass\RegisterDoctrineOrmMappingPass;
 use League\Bundle\OAuth2ServerBundle\DependencyInjection\LeagueOAuth2ServerExtension;
 use League\Bundle\OAuth2ServerBundle\DependencyInjection\Security\OAuth2Factory;
+use League\Bundle\OAuth2ServerBundle\Persistence\Mapping\Driver;
 use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
+use Symfony\Component\DependencyInjection\Reference;
 use Symfony\Component\HttpKernel\Bundle\Bundle;
 
 final class LeagueOAuth2ServerBundle extends Bundle
@@ -56,7 +58,14 @@ private function configureSecurityExtension(ContainerBuilder $container): void
 
     private function configureDoctrineExtension(ContainerBuilder $container): void
     {
-        $container->addCompilerPass(new RegisterDoctrineOrmMappingPass());
+        $container->addCompilerPass(
+            new DoctrineOrmMappingsPass(
+                new Reference(Driver::class),
+                ['League\Bundle\OAuth2ServerBundle\Model'],
+                ['league.oauth2_server.persistence.doctrine.manager'],
+                'league.oauth2_server.persistence.doctrine.enabled'
+            )
+        );
         $container->addCompilerPass(new EncryptionKeyPass());
     }
 }

From e1b8148d84034c482517a6c34cb6937bc9f289e8 Mon Sep 17 00:00:00 2001
From: Nattfarinn <nattfarinn@gmail.com>
Date: Thu, 29 Jun 2023 22:53:37 +0200
Subject: [PATCH 03/10] Switch typehint strictness to use interface instead of
 implementation

---
 src/Model/RefreshToken.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Model/RefreshToken.php b/src/Model/RefreshToken.php
index 07b536f7..a212b72e 100644
--- a/src/Model/RefreshToken.php
+++ b/src/Model/RefreshToken.php
@@ -17,7 +17,7 @@ class RefreshToken implements RefreshTokenInterface
     private $expiry;
 
     /**
-     * @var AccessToken|null
+     * @var AccessTokenInterface|null
      */
     private $accessToken;
 
@@ -29,7 +29,7 @@ class RefreshToken implements RefreshTokenInterface
     /**
      * @psalm-mutation-free
      */
-    public function __construct(string $identifier, \DateTimeInterface $expiry, ?AccessToken $accessToken = null)
+    public function __construct(string $identifier, \DateTimeInterface $expiry, ?AccessTokenInterface $accessToken = null)
     {
         $this->identifier = $identifier;
         $this->expiry = $expiry;

From b4d05d85d8b04765911e5d6182c86aeefb0e99fb Mon Sep 17 00:00:00 2001
From: Vincent Langlet <VincentLanglet@users.noreply.github.com>
Date: Sun, 30 Jul 2023 11:56:12 +0200
Subject: [PATCH 04/10] Update .gitattributes

---
 .gitattributes | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.gitattributes b/.gitattributes
index 0e5aa6aa..cb4ac9ad 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,9 +1,11 @@
 /tests export-ignore
 /dev export-ignore
+/.github export-ignore
 /.editorconfig export-ignore
 /.gitattributes export-ignore
 /.gitignore export-ignore
-/.php_cs.dist export-ignore
-/.travis.yml export-ignore
+/.php-cs-fixer.dist export-ignore
 /docker-compose.yml export-ignore
 /phpunit.xml.dist export-ignore
+/.psalm.baseline.xml export-ignore
+/psalm.xml export-ignore

From a04f7b7341f292ba55f14abe5ab58cf753162bea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <theo.fidry@gmail.com>
Date: Sun, 1 Oct 2023 08:54:07 +0200
Subject: [PATCH 05/10] chore: Fix Bamarni plugin deprecations

---
 composer.json | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/composer.json b/composer.json
index 96f28b0a..39c63680 100644
--- a/composer.json
+++ b/composer.json
@@ -49,6 +49,10 @@
     "extra": {
         "branch-alias": {
             "dev-master": "0.4-dev"
+        },
+        "bamarni": {
+            "bin-links": false,
+            "forward-command": false
         }
     },
     "minimum-stability": "dev"

From eb2bfa67c394f159d50b460153a17749e0eacf79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <theo.fidry@gmail.com>
Date: Sun, 1 Oct 2023 09:01:34 +0200
Subject: [PATCH 06/10] chore: Drop support for PHP 7.4 and 8.0

Both PHP versions reached EOL and PHP 8.1 will soon too.
---
 .github/workflows/unit-tests.yml | 23 ++++-------------------
 composer.json                    |  3 +--
 2 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
index 5f61b545..9f32a125 100644
--- a/.github/workflows/unit-tests.yml
+++ b/.github/workflows/unit-tests.yml
@@ -10,32 +10,21 @@ jobs:
             fail-fast: false
             matrix:
                 #Stable supported versions
-                php: ['7.4', '8.0', '8.1', '8.2']
+                php: ['8.1', '8.2']
                 symfony: ['5.4.*', '6.2.*']
                 composer-flags: ['--prefer-stable']
                 can-fail: [false]
                 exclude:
-                    - php: '7.4'
-                      symfony: '6.2.*'
-                    - php: '8.0'
+                    - php: '8.1'
                       symfony: '6.2.*'
                 include:
                     # Lowest supported versions
-                    - php: '7.2'
+                    - php: '8.1'
                       symfony: '5.4.*'
                       composer-flags: '--prefer-stable --prefer-lowest'
                       can-fail: false
-                    # EOL PHP versions
-                    - php: '7.2'
-                      symfony: '5.4.*'
-                      composer-flags: '--prefer-stable'
-                      can-fail: false
-                    - php: '7.3'
-                      symfony: '5.4.*'
-                      composer-flags: '--prefer-stable'
-                      can-fail: false
                     # Development versions
-                    - php: '8.2'
+                    - php: '8.3'
                       symfony: '6.3.x-dev'
                       composer-flags: ''
                       can-fail: true
@@ -49,10 +38,6 @@ jobs:
             - name: "checkout"
               uses: "actions/checkout@v2"
 
-            - name: "build the PHP7 environment"
-              run: "dev/bin/docker-compose build --build-arg PHP_VERSION=${{ matrix.php }} php"
-              if: startsWith(matrix.php, '7')
-
             - name: "build the PHP8 environment"
               run: "dev/bin/docker-compose build --build-arg PHP_VERSION=${{ matrix.php }} --build-arg XDEBUG_VERSION='3.2.0' php"
               if: startsWith(matrix.php, '8')
diff --git a/composer.json b/composer.json
index 96f28b0a..acb20aca 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,7 @@
         }
     ],
     "require": {
-        "php": ">=7.2",
+        "php": "^8.1",
         "doctrine/doctrine-bundle": "^2.0.8",
         "doctrine/orm": "^2.7.1",
         "league/oauth2-server": "^8.3",
@@ -24,7 +24,6 @@
         "psr/http-factory": "^1.0",
         "symfony/event-dispatcher": "^5.4|^6.2",
         "symfony/framework-bundle": "^5.4|^6.2",
-        "symfony/polyfill-php81": "^1.22",
         "symfony/psr-http-message-bridge": "^2.0",
         "symfony/security-bundle": "^5.4|^6.2"
     },

From 7126cae8d22b1016e9796cb81d43e24f5adb54d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <theo.fidry@gmail.com>
Date: Sun, 1 Oct 2023 09:06:46 +0200
Subject: [PATCH 07/10] bump the default version of the docker image to 8.1

---
 dev/docker/Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dev/docker/Dockerfile b/dev/docker/Dockerfile
index d9db2b6e..88b3fe23 100644
--- a/dev/docker/Dockerfile
+++ b/dev/docker/Dockerfile
@@ -1,4 +1,4 @@
-ARG PHP_VERSION=7.4
+ARG PHP_VERSION=8.1
 
 FROM php:${PHP_VERSION}-cli-alpine
 LABEL maintainer="Petar Obradović <petar.obradovic@trikoder.net>"

From e9e221d52be18ea1dc6a2d4865c07f03c4e4d325 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <theo.fidry@gmail.com>
Date: Sun, 1 Oct 2023 09:13:18 +0200
Subject: [PATCH 08/10] ci: Add a monthly schedule for the pipeline

---
 .github/workflows/coding-standards.yml | 7 ++++++-
 .github/workflows/static-analysis.yml  | 7 ++++++-
 .github/workflows/unit-tests.yml       | 7 ++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml
index 2c25e959..335e76e4 100644
--- a/.github/workflows/coding-standards.yml
+++ b/.github/workflows/coding-standards.yml
@@ -1,6 +1,11 @@
 name: "coding standards"
 
-on: ["pull_request", "push"]
+on:
+    pull_request: ~
+    push: ~
+    schedule:
+        # Do not make it the first of the month and/or midnight since it is a very busy time
+        - cron: "* 10 5 * *"
 
 jobs:
     coding-standards:
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml
index 99aa0f09..2c4a1184 100644
--- a/.github/workflows/static-analysis.yml
+++ b/.github/workflows/static-analysis.yml
@@ -1,6 +1,11 @@
 name: "static analysis"
 
-on: ["pull_request", "push"]
+on:
+    pull_request: ~
+    push: ~
+    schedule:
+        # Do not make it the first of the month and/or midnight since it is a very busy time
+        - cron: "* 10 5 * *"
 
 jobs:
     static-analysis:
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
index 5f61b545..a350353d 100644
--- a/.github/workflows/unit-tests.yml
+++ b/.github/workflows/unit-tests.yml
@@ -1,6 +1,11 @@
 name: "unit tests"
 
-on: [ "pull_request", "push" ]
+on:
+    pull_request: ~
+    push: ~
+    schedule:
+        # Do not make it the first of the month and/or midnight since it is a very busy time
+        - cron: "* 10 5 * *"
 
 jobs:
     tests:

From 644852f64b4787843c5075a8c4246d17597139d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <theo.fidry@gmail.com>
Date: Sun, 1 Oct 2023 09:19:12 +0200
Subject: [PATCH 09/10] ci: Update actions/checkout version

---
 .github/workflows/coding-standards.yml | 2 +-
 .github/workflows/static-analysis.yml  | 2 +-
 .github/workflows/unit-tests.yml       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml
index 2c25e959..0c46b0bf 100644
--- a/.github/workflows/coding-standards.yml
+++ b/.github/workflows/coding-standards.yml
@@ -8,7 +8,7 @@ jobs:
         runs-on: "ubuntu-latest"
         steps:
             - name: "checkout"
-              uses: "actions/checkout@v2"
+              uses: "actions/checkout@v4"
 
             - name: "build the environment"
               run: "dev/bin/docker-compose build"
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml
index 99aa0f09..b6255e1d 100644
--- a/.github/workflows/static-analysis.yml
+++ b/.github/workflows/static-analysis.yml
@@ -8,7 +8,7 @@ jobs:
         runs-on: "ubuntu-latest"
         steps:
             - name: "checkout"
-              uses: "actions/checkout@v2"
+              uses: "actions/checkout@v4"
 
             - name: "build the environment"
               run: "dev/bin/docker-compose build"
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
index 5f61b545..f6a7829f 100644
--- a/.github/workflows/unit-tests.yml
+++ b/.github/workflows/unit-tests.yml
@@ -47,7 +47,7 @@ jobs:
 
         steps:
             - name: "checkout"
-              uses: "actions/checkout@v2"
+              uses: "actions/checkout@v4"
 
             - name: "build the PHP7 environment"
               run: "dev/bin/docker-compose build --build-arg PHP_VERSION=${{ matrix.php }} php"

From 94e4e11e6f0ebfb158f7c398fb2e7efea43a5593 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <theo.fidry@gmail.com>
Date: Sat, 14 Oct 2023 11:10:30 +0200
Subject: [PATCH 10/10] remove bamarni/composer-bin-plugin

---
 composer.json | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/composer.json b/composer.json
index 526bf61c..19c7eb4d 100644
--- a/composer.json
+++ b/composer.json
@@ -40,18 +40,11 @@
         "psr-4": { "League\\Bundle\\OAuth2ServerBundle\\Tests\\": "tests/" }
     },
     "config": {
-        "sort-packages": true,
-        "allow-plugins": {
-            "bamarni/composer-bin-plugin": true
-        }
+        "sort-packages": true
     },
     "extra": {
         "branch-alias": {
             "dev-master": "0.4-dev"
-        },
-        "bamarni": {
-            "bin-links": false,
-            "forward-command": false
         }
     },
     "minimum-stability": "dev"