Skip to content

Commit f34fbe7

Browse files
authored
Add PHP 8.2 support (#50)
* Add PHP 8.1 and drop 7.4 in test coverage * Resolve 8.2 deprecation warnings * Update dependencies * Update minimum Timber version Timber v1.24 adds support for PHP 8.2 --------- Co-authored-by: Joe Lambert <joe@rareloop.com>
1 parent e66e6d9 commit f34fbe7

File tree

8 files changed

+80
-63
lines changed

8 files changed

+80
-63
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: [7.4, 8.0, 8.1]
10+
php_version: [8.0, 8.1, 8.2]
1111
composer_flags: ['', '--prefer-lowest']
1212

1313
steps:

composer.json

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,34 @@
66
"php": ">=7.3||>=8.0",
77
"php-di/php-di": "^6.4.0",
88
"rareloop/router": "^6.0.2",
9-
"psr/container": "^1.0",
10-
"psr/http-message": "^1.0",
11-
"psr/http-server-middleware": "^1.0",
9+
"psr/container": "^1.1.2",
10+
"psr/http-message": "^1.1",
11+
"psr/http-server-middleware": "^1.0.2",
1212
"blast/facades": "^1.0",
13-
"timber/timber": "^1.21.0",
14-
"monolog/monolog": "^2.0",
13+
"timber/timber": "^1.24.0",
14+
"monolog/monolog": "^2.9.1",
1515
"http-interop/response-sender": "^1.0",
16-
"symfony/debug": "^4.1",
17-
"illuminate/collections": "^8.53.1||^9.0.0",
16+
"symfony/debug": "^4.4.44",
17+
"illuminate/collections": "^8.53.1||^9.52.16",
1818
"statamic/stringy": "^3.1.3",
19-
"laminas/laminas-diactoros": "^2.4",
19+
"laminas/laminas-diactoros": "^2.25.2",
2020
"rareloop/psr7-server-request-extension": "^2.1.0",
21-
"mmeyer2k/dcrypt": "^8.0.1",
22-
"spatie/macroable": "^1.0",
23-
"mindplay/middleman": "^3.0.3",
24-
"psr/log": "^1.1",
25-
"laminas/laminas-zendframework-bridge": "^1.4",
26-
"symfony/var-dumper": "^5.0||^6.0"
21+
"mmeyer2k/dcrypt": "^8.3.1",
22+
"spatie/macroable": "^1.0.1",
23+
"mindplay/middleman": "^3.1.0",
24+
"psr/log": "^1.1.4",
25+
"laminas/laminas-zendframework-bridge": "^1.7",
26+
"symfony/var-dumper": "^5.0||^6.3.6"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": "^9.5.21",
30-
"php-coveralls/php-coveralls": "^2.0",
31-
"mockery/mockery": "^1.5.0",
32-
"brain/monkey": "~2.4.2",
33-
"squizlabs/php_codesniffer": "^3.6.0",
34-
"php-mock/php-mock": "^2.3.1",
29+
"phpunit/phpunit": "^9.6.13",
30+
"php-coveralls/php-coveralls": "^2.6",
31+
"mockery/mockery": "^1.6.6",
32+
"brain/monkey": "^2.6.1",
33+
"squizlabs/php_codesniffer": "^3.7.2",
34+
"php-mock/php-mock": "^2.4.1",
3535
"mikey179/vfsstream": "1.6.11",
36-
"antecedent/patchwork": "^2.1.21",
37-
"dms/phpunit-arraysubset-asserts": "^0.3.0"
36+
"dms/phpunit-arraysubset-asserts": "^0.3.1"
3837
},
3938
"autoload": {
4039
"psr-4": {

src/Post.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Timber\Post as TimberPost;
99
use Timber\Timber;
1010

11+
#[\AllowDynamicProperties]
1112
class Post extends TimberPost
1213
{
1314
use Macroable {
@@ -46,15 +47,15 @@ public static function __callStatic($name, $arguments)
4647
return call_user_func_array([$builder, $name], $arguments);
4748
}
4849

49-
trigger_error('Call to undefined method '.__CLASS__.'::'.$name.'()', E_USER_ERROR);
50+
trigger_error('Call to undefined method ' . __CLASS__ . '::' . $name . '()', E_USER_ERROR);
5051
}
5152

5253
/**
5354
* Create a QueryBuilder scoped to this Post type
5455
*
5556
* @return ScopedQueryBuilder
5657
*/
57-
public static function builder() : ScopedQueryBuilder
58+
public static function builder(): ScopedQueryBuilder
5859
{
5960
return new ScopedQueryBuilder(static::class);
6061
}

tests/Unit/ApplicationTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,8 @@ public function calling_detectWhenRequestHasNotBeenHandled_adds_actions()
552552

553553
class BootstrapperBootstrapTester
554554
{
555+
public $callback;
556+
555557
public function __construct($callback)
556558
{
557559
$this->callback = $callback;
@@ -560,6 +562,8 @@ public function __construct($callback)
560562

561563
abstract class TestBootstrapperBase
562564
{
565+
private BootstrapperBootstrapTester $tester;
566+
563567
public function __construct(BootstrapperBootstrapTester $tester)
564568
{
565569
$this->tester = $tester;

tests/Unit/PostQueryBuilderTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
use Rareloop\Lumberjack\Post;
1010
use Rareloop\Lumberjack\QueryBuilder;
1111
use Rareloop\Lumberjack\ScopedQueryBuilder;
12+
use Throwable;
1213

1314
class PostQueryBuilderTest extends TestCase
1415
{
1516
use \Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration,
1617
\DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
1718

19+
private Application $app;
20+
1821
public function setUp(): void
1922
{
2023
$this->app = new Application;
@@ -48,9 +51,15 @@ public function can_create_a_builder_from_static_functions()
4851
*/
4952
public function throw_error_on_missing_static_function()
5053
{
51-
$this->expectError();
54+
$errorThrown = false;
55+
56+
try {
57+
Post::missingStaticFunction();
58+
} catch (Throwable $e) {
59+
$errorThrown = true;
60+
}
5261

53-
Post::missingStaticFunction();
62+
$this->assertTrue($errorThrown);
5463
}
5564

5665
private function assertQueryBuilder($function, $params, $postType)

tests/Unit/Providers/RouterServiceProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function wp_loaded_action_is_bound()
124124
$app->register($provider);
125125
$lumberjack->bootstrap();
126126

127-
$this->assertTrue(has_action('wp_loaded', 'function ()'));
127+
$this->assertNotFalse(has_action('wp_loaded', 'function ()'));
128128
}
129129

130130
/** @test */

0 commit comments

Comments
 (0)