Skip to content

Commit f98e365

Browse files
authored
Merge pull request #89 from samsonasik/drop-php80
[v5] Drop php <8.0 support
2 parents f33bc58 + f5e0c4a commit f98e365

File tree

9 files changed

+33
-53
lines changed

9 files changed

+33
-53
lines changed

.github/workflows/rector_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php-versions: ['7.3']
16+
php-versions: ['8.1']
1717
steps:
1818
- name: Setup PHP Action
1919
uses: shivammathur/setup-php@v2

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ It is a Laminas module as session toolbar for [LaminasDeveloperTools](https://gi
1818

1919
You can reload, clear, add, update, and remove your sessions data.
2020

21-
> This is README for version ^4.0 which only support Laminas 3 with php ^7.3|~8.0.
21+
> This is README for version ^5.0 which only support Laminas 3 with php ^8.1
22+
23+
> For version ^4.0, you can read at [version 4.x.x readme](https://github.com/samsonasik/SanSessionToolbar/blob/4.x.x/README.md) which support Laminas 3 and php ^7.3|~8.0.
2224
2325
> For version ^3.0, you can read at [version 3.x.x readme](https://github.com/samsonasik/SanSessionToolbar/blob/3.x.x/README.md) which support Laminas 3 and php ^7.2.
2426

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919
],
2020
"require": {
21-
"php": "^7.3|~8.0",
21+
"php": "^8.1",
2222
"laminas/laminas-json": "^2.5 || ^3.0",
2323
"laminas/laminas-mvc": "^3.0",
2424
"laminas/laminas-session": "^2.8.4"
@@ -30,9 +30,9 @@
3030
"laminas/laminas-mvc-plugin-flashmessenger": "^1.0",
3131
"laminas/laminas-router": "^3.0",
3232
"laminas/laminas-serializer": "^2.5",
33-
"laminas/laminas-test": "^4.0",
33+
"laminas/laminas-test": "^4.10",
3434
"phpspec/prophecy-phpunit": "^2.0",
35-
"phpunit/phpunit": "^9.4",
35+
"phpunit/phpunit": "^10.4",
3636
"rector/rector": "dev-main"
3737
},
3838
"conflict": {

rector.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22

33
use Rector\Config\RectorConfig;
4-
use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
4+
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
5+
use Rector\PHPUnit\Set\PHPUnitSetList;
56

67
return RectorConfig::configure()
78
->withPreparedSets(
@@ -13,16 +14,14 @@
1314
true, // naming
1415
)
1516
->withPhpSets(
16-
false,
17-
false,
18-
false,
19-
false,
20-
false,
21-
true, // php73
17+
php81: true
2218
)
19+
->withSets([
20+
PHPUnitSetList::PHPUNIT_100
21+
])
2322
->withPaths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/test'])
2423
->withRootFiles()
25-
->withImportNames()
24+
->withImportNames(removeUnusedImports: true)
2625
->withSkip([
27-
CallableThisArrayToAnonymousFunctionRector::class,
26+
FirstClassCallableRector::class
2827
]);

src/Collector/SessionCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getPriority()
6666
*/
6767
public function collect(MvcEvent $mvcEvent)
6868
{
69-
$this->data['san-session'] = $this->data['san-session'] ?? [];
69+
$this->data['san-session'] ??= [];
7070
}
7171

7272
/**

src/Controller/SessionToolbarController.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,11 @@
3535
*/
3636
final class SessionToolbarController extends AbstractActionController
3737
{
38-
/**
39-
* @var RendererInterface
40-
*/
41-
private $viewRenderer;
42-
43-
/**
44-
* @var SessionManagerInterface
45-
*/
46-
private $sessionManager;
47-
4838
/**
4939
* Construct.
5040
*/
51-
public function __construct(RendererInterface $viewRenderer, SessionManagerInterface $sessionManager)
41+
public function __construct(private readonly RendererInterface $viewRenderer, private readonly SessionManagerInterface $sessionManager)
5242
{
53-
$this->viewRenderer = $viewRenderer;
54-
$this->sessionManager = $sessionManager;
5543
}
5644

5745
/**

test/Collector/SessionCollectorTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
namespace SanSessionToolbarTest\Collector;
2121

22+
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
2223
use Laminas\Mvc\MvcEvent;
2324
use Laminas\Session\Container;
2425
use PHPUnit\Framework\TestCase;
@@ -66,9 +67,7 @@ public function testGetPriority()
6667
$this->assertEquals(10, $this->sessionCollector->getPriority());
6768
}
6869

69-
/**
70-
* @runInSeparateProcess
71-
*/
70+
#[RunInSeparateProcess]
7271
public function testGetSessionData()
7372
{
7473
$this->sessionContainer->word = 'zaf8go6i';
@@ -100,9 +99,7 @@ public function testGetSessionData()
10099
], $this->sessionCollector->getSessionData());
101100
}
102101

103-
/**
104-
* @runInSeparateProcess
105-
*/
102+
#[RunInSeparateProcess]
106103
public function testGetSessionDataForEmpty()
107104
{
108105
$this->sessionContainer->offsetUnset('word');

test/Manager/SessionMangerTest.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
namespace SanSessionToolbarTest\Manager;
2121

22+
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
23+
use PHPUnit\Framework\Attributes\DataProvider;
2224
use Laminas\Session\Container;
2325
use PHPUnit\Framework\TestCase;
2426
use SanSessionToolbar\Manager\SessionManager;
@@ -43,9 +45,7 @@ protected function setUp(): void
4345
$this->manager = new SessionManager();
4446
}
4547

46-
/**
47-
* @runInSeparateProcess
48-
*/
48+
#[RunInSeparateProcess]
4949
public function testSessionIsNotStartedAlready()
5050
{
5151
$sessionManager = new SessionManager();
@@ -71,9 +71,7 @@ public function testGetSessionData()
7171
$this->assertEquals($sessionData, $this->manager->getSessionData());
7272
}
7373

74-
/**
75-
* @dataProvider provideClearSession
76-
*/
74+
#[DataProvider('provideClearSession')]
7775
public function testClearSession($byContainer, $result)
7876
{
7977
$fooContainer = new Container('Foo');
@@ -83,17 +81,15 @@ public function testClearSession($byContainer, $result)
8381
$this->assertEquals($result, $this->manager->getSessionData());
8482
}
8583

86-
public function provideClearSession()
84+
public static function provideClearSession()
8785
{
8886
return [
8987
['Default', ['Foo' => ['foo' => 'fooValue']]],
9088
[null, []],
9189
];
9290
}
9391

94-
/**
95-
* @dataProvider provideSessionSettingData
96-
*/
92+
#[DataProvider('provideSessionSettingData')]
9793
public function testSessionSetting($container, $keysession, $value, $options, $result)
9894
{
9995
$fooContainer = new Container('Foo');
@@ -102,7 +98,7 @@ public function testSessionSetting($container, $keysession, $value, $options, $r
10298
$this->assertEquals($result, $this->manager->sessionSetting($container, $keysession, $value, $options));
10399
}
104100

105-
public function provideSessionSettingData()
101+
public static function provideSessionSettingData()
106102
{
107103
return [
108104
['Default', 'foo', null, [], false],

test/ModuleTest.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
namespace SanSessionToolbarTest;
2121

22+
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
23+
use PHPUnit\Framework\Attributes\DataProvider;
2224
use Laminas\Mvc\MvcEvent;
2325
use Laminas\Mvc\Application;
2426
use Laminas\EventManager\EventManager;
@@ -49,27 +51,23 @@ protected function setUp(): void
4951
$this->module = new Module();
5052
}
5153

52-
/**
53-
* @runInSeparateProcess
54-
*/
54+
#[RunInSeparateProcess]
5555
public function testOnBootstrapOnSessionNotExists()
5656
{
5757
$objectProphecy = $this->prophesize(MvcEvent::class);
5858
$this->assertNull($this->module->onBootstrap($objectProphecy->reveal()));
5959
}
6060

61-
public function provideHasMessages()
61+
public static function provideHasMessages()
6262
{
6363
return [
6464
[false],
6565
[true],
6666
];
6767
}
6868

69-
/**
70-
* @dataProvider provideHasMessages
71-
* @runInSeparateProcess
72-
*/
69+
#[DataProvider('provideHasMessages')]
70+
#[RunInSeparateProcess]
7371
public function testOnBootstrap($hasMessages)
7472
{
7573
$objectProphecy = $this->prophesize(MvcEvent::class);

0 commit comments

Comments
 (0)