Skip to content

Commit b44b11a

Browse files
Merge pull request #63 from Rareloop/chore/php-85
Upgrade to PHP 8.5
2 parents 9ab555f + e84a91d commit b44b11a

32 files changed

+88
-115
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php_version: [8.1, 8.2, 8.3, 8.4]
10+
php_version: [8.3, 8.4, 8.5]
1111
composer_flags: ['', '--prefer-lowest']
1212

1313
steps:

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
"description": "A powerful MVC framework for the modern WordPress developer. Write better, more expressive and easier to maintain code",
44
"license": "MIT",
55
"require": {
6-
"php": ">=8.1",
6+
"php": ">=8.3",
77
"php-di/php-di": "^7.1.1",
8-
"rareloop/router": "^6.0.3",
8+
"rareloop/router": "^6.1.0",
99
"psr/container": "^2.0.2",
1010
"psr/http-message": "^2",
1111
"psr/http-server-middleware": "^1.0.2",
1212
"timber/timber": "^2.3.3",
1313
"monolog/monolog": "^3.9",
1414
"illuminate/collections": "^10.49",
1515
"statamic/stringy": "^3.1.3",
16-
"laminas/laminas-diactoros": "^3.6.0",
16+
"laminas/laminas-diactoros": "^3.8.0",
1717
"rareloop/psr7-server-request-extension": "^2.2.0",
18-
"spatie/macroable": "^1.0.1",
18+
"spatie/macroable": "^2.1.0",
1919
"mindplay/middleman": "^4.0.4",
2020
"psr/log": "^2.0.0",
2121
"symfony/var-dumper": "^6.4.26",

phpunit.xml

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
12-
<testsuites>
13-
<testsuite name="Rareloop Router Test Suite">
14-
<directory>tests</directory>
15-
</testsuite>
16-
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">src/</directory>
20-
</whitelist>
21-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">src/</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Rareloop Router Test Suite">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
2213
</phpunit>

src/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ public function register($provider)
180180

181181
public function getProvider($provider)
182182
{
183-
$providerClass = is_string($provider) ? $provider : get_class($provider);
183+
$providerClass = is_string($provider) ? $provider : $provider::class;
184184

185185
return (new Collection($this->loadedProviders))->first(function ($provider) use ($providerClass) {
186-
return get_class($provider) === $providerClass;
186+
return $provider::class === $providerClass;
187187
});
188188
}
189189

src/Dcrypt/Hash.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private static function build(string $input, string $password, int $cost, ?strin
7070
*/
7171
private static function cost(int $cost): int
7272
{
73-
return $cost % \pow(2, 32);
73+
return $cost % 2 ** 32;
7474
}
7575

7676
/**

src/Dcrypt/OpensslBridge.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,7 @@ private static function mode(): string
162162

163163
$cipher = \strtolower(static::CIPHER);
164164

165-
if (isset($legacy[$cipher])) {
166-
return $legacy[$cipher];
167-
}
168-
169-
return $cipher;
165+
return $legacy[$cipher] ?? $cipher;
170166
}
171167

172168
/**

src/Dcrypt/Spritz.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Spritz extends Rc4
3636
* @param string $key Key to use for encryption
3737
* @return string
3838
*/
39+
#[\Override]
3940
public static function crypt(string $str, string $key): string
4041
{
4142
$s = self::initializeState($key);

src/Encrypter.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77

88
class Encrypter implements EncrypterContract
99
{
10-
protected $key;
11-
12-
public function __construct($key)
10+
public function __construct(protected $key)
1311
{
14-
$this->key = $key;
1512
}
1613

1714
public function encrypt($data)

src/Exceptions/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ public function render(ServerRequestInterface $request, Exception $e): ResponseI
5353

5454
protected function shouldNotReport(Exception $e)
5555
{
56-
return in_array(get_class($e), $this->dontReport);
56+
return in_array($e::class, $this->dontReport);
5757
}
5858
}

src/Http/Lumberjack.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
class Lumberjack
1515
{
16-
private $app;
17-
1816
protected $bootstrappers = [
1917
LoadConfiguration::class,
2018
RegisterExceptionHandler::class,
@@ -25,9 +23,8 @@ class Lumberjack
2523
RegisterRequestHandler::class,
2624
];
2725

28-
public function __construct(Application $app)
26+
public function __construct(private Application $app)
2927
{
30-
$this->app = $app;
3128
}
3229

3330
public function bootstrap()

0 commit comments

Comments
 (0)