From d29b56887901cc1d62d81706647ee3b9f7af512c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miloslav=20H=C5=AFla?= <miloslav.hula@gmail.com>
Date: Wed, 6 Dec 2023 12:04:10 +0100
Subject: [PATCH 1/3] PHP 8.3 is supported

---
 .github/workflows/tests.yml | 2 +-
 composer.json               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 63a6baa..155cfcf 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -8,7 +8,7 @@ jobs:
         strategy:
             fail-fast: false
             matrix:
-                php: [8.0, 8.1, 8.2]
+                php: [8.0, 8.1, 8.2, 8.3]
 
         name: PHP ${{ matrix.php }} tests
         steps:
diff --git a/composer.json b/composer.json
index 199b874..2953b9f 100644
--- a/composer.json
+++ b/composer.json
@@ -11,7 +11,7 @@
 		}
 	],
 	"require": {
-		"php": ">=8.0 <8.3"
+		"php": ">=8.0 <8.4"
 	},
 	"require-dev": {
 		"nette/tester": "^2.4"

From 699298a6c78ffba8ad0ac9988eb5e22b4783cb51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miloslav=20H=C5=AFla?= <miloslav.hula@gmail.com>
Date: Sun, 24 Nov 2024 09:53:59 +0100
Subject: [PATCH 2/3] PHP 8.4 compatibility: explicit nullables

---
 src/Github/Api.php               | 12 ++++++------
 src/Github/Http/CachedClient.php |  2 +-
 src/Github/Http/Message.php      |  2 +-
 src/Github/Http/Request.php      |  2 +-
 src/Github/Http/Response.php     |  2 +-
 src/Github/OAuth/Login.php       |  6 +++---
 src/Github/exceptions.php        |  2 +-
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/Github/Api.php b/src/Github/Api.php
index a874a83..94a0613 100644
--- a/src/Github/Api.php
+++ b/src/Github/Api.php
@@ -27,13 +27,13 @@ class Api
 	private ?OAuth\Token $token = null;
 
 
-	public function __construct(Http\IClient $client = null)
+	public function __construct(?Http\IClient $client = null)
 	{
 		$this->client = $client ?: Helpers::createDefaultClient();
 	}
 
 
-	public function setToken(OAuth\Token $token = null): static
+	public function setToken(?OAuth\Token $token = null): static
 	{
 		$this->token = $token;
 		return $this;
@@ -46,7 +46,7 @@ public function getToken(): ?OAuth\Token
 	}
 
 
-	public function setDefaultParameters(array $defaults = null): static
+	public function setDefaultParameters(?array $defaults = null): static
 	{
 		$this->defaultParameters = $defaults ?: [];
 		return $this;
@@ -189,7 +189,7 @@ public function request(Http\Request $request): Http\Response
 	 * @throws MissingParameterException  when substitution is used in URL but parameter is missing
 	 * @throws JsonException  when encoding to JSON fails
 	 */
-	public function createRequest(string $method, string $urlPath, array $parameters = [], array $headers = [], string|array|object $content = null): Http\Request
+	public function createRequest(string $method, string $urlPath, array $parameters = [], array $headers = [], string|array|object|null $content = null): Http\Request
 	{
 		if (stripos($urlPath, $this->url) === 0) {  # Allows non-HTTPS URLs
 			$baseUrl = $this->url;
@@ -225,7 +225,7 @@ public function createRequest(string $method, string $urlPath, array $parameters
 	 *
 	 * @throws ApiException
 	 */
-	public function decode(Http\Response $response, array $okCodes = null): mixed
+	public function decode(Http\Response $response, ?array $okCodes = null): mixed
 	{
 		$content = $response->getContent();
 		if (preg_match('~application/json~i', $response->getHeader('Content-Type', ''))) {
@@ -460,7 +460,7 @@ private function prefix(array $flags, string $name, string $value): string
 	}
 
 
-	private function escape(array $flags, string|int|false $value, int $maxLength = null): string
+	private function escape(array $flags, string|int|false $value, ?int $maxLength = null): string
 	{
 		$value = (string) $value;
 
diff --git a/src/Github/Http/CachedClient.php b/src/Github/Http/CachedClient.php
index 8077b08..967df83 100644
--- a/src/Github/Http/CachedClient.php
+++ b/src/Github/Http/CachedClient.php
@@ -28,7 +28,7 @@ class CachedClient implements IClient
 	 */
 	public function __construct(
 		private Storages\ICache $cache,
-		IClient $client = null,
+		?IClient $client = null,
 		private bool $forbidRecheck = false,
 	) {
 		$this->client = $client ?: Github\Helpers::createDefaultClient();
diff --git a/src/Github/Http/Message.php b/src/Github/Http/Message.php
index 90fce0e..089c548 100644
--- a/src/Github/Http/Message.php
+++ b/src/Github/Http/Message.php
@@ -35,7 +35,7 @@ public function hasHeader(string $name): bool
 	}
 
 
-	public function getHeader(string $name, string $default = null): ?string
+	public function getHeader(string $name, ?string $default = null): ?string
 	{
 		$name = strtolower($name);
 		return array_key_exists($name, $this->headers)
diff --git a/src/Github/Http/Request.php b/src/Github/Http/Request.php
index 94bc4f9..4ac0207 100644
--- a/src/Github/Http/Request.php
+++ b/src/Github/Http/Request.php
@@ -26,7 +26,7 @@ public function __construct(
 		private string $method,
 		private string $url,
 		array $headers = [],
-		string $content = null
+		?string $content = null
 	) {
 		parent::__construct($headers, $content);
 	}
diff --git a/src/Github/Http/Response.php b/src/Github/Http/Response.php
index 29b529b..be602a4 100644
--- a/src/Github/Http/Response.php
+++ b/src/Github/Http/Response.php
@@ -63,7 +63,7 @@ public function getPrevious(): ?Response
 	/**
 	 * @throws Github\LogicException
 	 */
-	public function setPrevious(Response $previous = null): static
+	public function setPrevious(?Response $previous = null): static
 	{
 		if ($this->previous) {
 			throw new Github\LogicException('Previous response is already set.');
diff --git a/src/Github/OAuth/Login.php b/src/Github/OAuth/Login.php
index 060ff4b..7a8b9da 100644
--- a/src/Github/OAuth/Login.php
+++ b/src/Github/OAuth/Login.php
@@ -29,8 +29,8 @@ class Login
 
 	public function __construct(
 		private Configuration $conf,
-		Storages\ISessionStorage $storage = null,
-		Http\IClient $client = null
+		?Storages\ISessionStorage $storage = null,
+		?Http\IClient $client = null
 	) {
 		$this->storage = $storage ?: new Storages\SessionStorage;
 		$this->client = $client ?: Github\Helpers::createDefaultClient();
@@ -47,7 +47,7 @@ public function getClient(): Http\IClient
 	 * @param  string $backUrl  URL to redirect back from GitHub when user approves the permissions request
 	 * @param  ?callable $redirectCb  makes HTTP redirect to GitHub
 	 */
-	public function askPermissions(string $backUrl, callable $redirectCb = null): void
+	public function askPermissions(string $backUrl, ?callable $redirectCb = null): void
 	{
 		/** @todo Something more safe? */
 		$state = sha1(uniqid((string) microtime(true), true));
diff --git a/src/Github/exceptions.php b/src/Github/exceptions.php
index a23ffd8..d54494e 100644
--- a/src/Github/exceptions.php
+++ b/src/Github/exceptions.php
@@ -49,7 +49,7 @@ abstract class ApiException extends RuntimeException
 		private ?Http\Response $response;
 
 
-		public function __construct(string $message = '', int $code = 0, \Exception $previous = null, Http\Response $response = null)
+		public function __construct(string $message = '', int $code = 0, ?\Exception $previous = null, ?Http\Response $response = null)
 		{
 			parent::__construct($message, $code, $previous);
 			$this->response = clone $response;

From 60d84e16c0d941c5577b395a20838c910229c8b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miloslav=20H=C5=AFla?= <miloslav.hula@gmail.com>
Date: Sun, 24 Nov 2024 09:55:16 +0100
Subject: [PATCH 3/3] PHP 8.4 is supported

---
 .github/workflows/tests.yml | 6 +++---
 composer.json               | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 155cfcf..9a4dd90 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -8,11 +8,11 @@ jobs:
         strategy:
             fail-fast: false
             matrix:
-                php: [8.0, 8.1, 8.2, 8.3]
+                php: [8.0, 8.1, 8.2, 8.3, 8.4]
 
         name: PHP ${{ matrix.php }} tests
         steps:
-            - uses: actions/checkout@v2
+            - uses: actions/checkout@v4
             - uses: shivammathur/setup-php@v2
               with:
                     php-version: ${{ matrix.php }}
@@ -21,7 +21,7 @@ jobs:
             - run: composer install --no-progress --prefer-dist
             - run: vendor/bin/tester tests -s
             - if: failure()
-              uses: actions/upload-artifact@v2
+              uses: actions/upload-artifact@v3
               with:
                   name: output
                   path: tests/**/output
diff --git a/composer.json b/composer.json
index 2953b9f..1d8b8b0 100644
--- a/composer.json
+++ b/composer.json
@@ -11,7 +11,7 @@
 		}
 	],
 	"require": {
-		"php": ">=8.0 <8.4"
+		"php": ">=8.0 <8.5"
 	},
 	"require-dev": {
 		"nette/tester": "^2.4"