Skip to content

Commit 4db0a7f

Browse files
authored
Merge pull request #38 from dotkernel/issue-36
Issue #36: Remove PHP 8.1 and add PHP 8.4 & 8.5 support
2 parents c79e5c1 + 5a8eec0 commit 4db0a7f

File tree

7 files changed

+24
-28
lines changed

7 files changed

+24
-28
lines changed

.github/workflows/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
- ubuntu-latest
1616

1717
php:
18-
- "8.1"
1918
- "8.2"
2019
- "8.3"
2120
- "8.4"
21+
- "8.5"
2222

2323
steps:
2424
- name: Checkout

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
- ubuntu-latest
1616

1717
php:
18-
- "8.1"
1918
- "8.2"
2019
- "8.3"
2120
- "8.4"
21+
- "8.5"
2222

2323
steps:
2424
- name: Checkout

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Documentation is available at: https://docs.dotkernel.org/dot-event/.
1111
## Badges
1212

1313
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-event)
14-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-event/4.3.0)
14+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-event/4.4.0)
1515

1616
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-event)](https://github.com/dotkernel/dot-event/issues)
1717
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-event)](https://github.com/dotkernel/dot-event/network)

SECURITY.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
## Supported Versions
44

5-
65
| Version | Supported | PHP Version |
76
|---------|--------------------|-----------------------------------------------------------------------------------------------------------|
8-
| 4.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-event/4.0.0) |
9-
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-event/3.4.2) |
7+
| 4.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-event/4.4.0) |
8+
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-event/3.5.0) |
109
| <= 2.x | :x: | |
1110

12-
1311
## Reporting Potential Security Issues
1412

1513
If you have encountered a potential security vulnerability in this project,
@@ -25,7 +23,7 @@ When reporting issues, please provide the following information:
2523
We request that you contact us via the email address above and give the
2624
project contributors a chance to resolve the vulnerability and issue a new
2725
release prior to any public exposure; this helps protect the project's
28-
users, and provides them with a chance to upgrade and/or update in order to
26+
users and provides them with a chance to upgrade and/or update to
2927
protect their applications.
3028

3129

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"require": {
20-
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
20+
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
2121
"laminas/laminas-eventmanager": "^3.4",
2222
"laminas/laminas-servicemanager": "^3.10 || ^4.0",
2323
"psr/http-message": "^1.0 || ^2.0"
@@ -46,8 +46,8 @@
4646
],
4747
"cs-check": "phpcs",
4848
"cs-fix": "phpcbf",
49-
"test": "phpunit --colors=always",
50-
"static-analysis": "phpstan analyse --memory-limit 1G"
49+
"static-analysis": "phpstan analyse --memory-limit 1G",
50+
"test": "phpunit --colors=always"
5151
},
5252
"config": {
5353
"allow-plugins": {

docs/book/v4/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Dotkernel's event manager package.
77
## Badges
88

99
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-event)
10-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-event/4.3.0)
10+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-event/4.4.0)
1111

1212
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-event)](https://github.com/dotkernel/dot-event/issues)
1313
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-event)](https://github.com/dotkernel/dot-event/network)

docs/book/v4/usage.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
This tutorial explores various examples of dot-event usages.
44

5-
To start using events you will need the following things:
5+
To start using events, you will need the following things:
66

77
- An **Event**
8-
- One or more **listeners** that will be registered on the application config ( ``ConfigProvider`` )
8+
- One or more **listeners** that will be registered on the application config (`ConfigProvider`)
99
- An instance of **EventManager** from the **container** so you can trigger the events
1010

11-
The listeners needs to be registered in the `ConfigProvider`, under the `['dot-event']` key.
11+
The listeners need to be registered in the `ConfigProvider`, under the `['dot-event']` key.
1212

1313
## Example
1414

1515
The below example will implement an event for update users.
1616

17-
Every event needs to extends `Dot\Event\Event`:
17+
Every event needs to extend `Dot\Event\Event`:
1818

1919
```php
2020
class UserEvent extends Event
@@ -31,7 +31,7 @@ class UserEvent extends Event
3131
```
3232

3333
We use the concept of listener aggregates because with this approach in a single class we can listen to multiple events.
34-
If you pay attention, in the above event we have 2 events `pre.update.user` and `post.update.user`.
34+
If you pay attention, in the above event we have two events `pre.update.user` and `post.update.user`.
3535

3636
Every listener needs to extend `Dot\Event\ControllerEventListenerInterface`.
3737
The interface defines two methods `attach()` and `detach()`.
@@ -110,10 +110,10 @@ class MyService
110110

111111
You can attach multiple listeners to the same event but with different logic.
112112

113-
All listeners are executed in the order in which they are attached. However, you can provide a priority value and you can influence the order of the execution.
113+
All listeners are executed in the order in which they are attached. However, you can provide a priority value, and you can influence the order of the execution.
114114

115-
- Higher priority values execute earlier.
116-
- Lower (negative) priority values execute later.
115+
- Higher priority values execute earlier
116+
- Lower (negative) priority values execute later
117117

118118
```php
119119
class UserEventListener implements DotEventListenerInterface
@@ -136,12 +136,12 @@ class UserEventListener implements DotEventListenerInterface
136136
}
137137
```
138138

139-
As you can notice, we attach the same event name to listeners, so once we trigger the event both callback will run one after another.
140-
But because we provide priority, the second attach will run first because has a higher priority.
139+
As you can notice, we attach the same event name to listeners, so once we trigger the event, both callbacks will run one after another.
140+
But because we provide priority, the second attachment will run first because it has a higher priority.
141141

142142
## Short-circuiting the execution
143143

144-
Sometimes you have more listeners to an event, and you may want to stop the execution of the event if something is wrong in one of the listeners.
144+
Sometimes you have more listeners to an event, and you may want to stop the execution of the event if something is wrong with one of the listeners.
145145

146146
```php
147147

@@ -152,29 +152,27 @@ Sometimes you have more listeners to an event, and you may want to stop the exec
152152

153153
public function onUserPostUpdateSecond(UserEvent $event)
154154
{
155-
156155
// this will not execute
157-
158156
}
159157
```
160158

161159
## Returns
162160

163-
You can return whatever you want in a listener callback. All events trigger returns an instance of `Laminas\EventManager\ResponseCollection` so you can have information if the event has stopped, or if event returned some expected object.
161+
You can return whatever you want in a listener callback.
162+
All events trigger return an instance of `Laminas\EventManager\ResponseCollection` so you can have information if the event has stopped, or if event returned some expected object.
164163

165164
```php
166165
class MyService
167166
{
168167
#[Dot\AnnotatedServices\Attribute\Inject(EventManagerInterface::class)]
169168
public function __construct(private EventManagerInterface $eventManager)
170169
{
171-
172170
}
173171

174172
public function update()
175173
{
176174
/** @var Laminas\EventManager\ResponseCollection $result */
177-
$result = $this->eventManager->triggerEvent(new UserEvent(UserEvent::EVENTS_POST_UPDATE, params: ['user' => $user]));
175+
$result = $this->eventManager->triggerEvent(new UserEvent(UserEvent::EVENTS_POST_UPDATE, params: ['user' => $user]));
178176
$result->stopped(); // true or false if propagation is stopped
179177
$result->first(); // what last listener has returned (on multiple listeners it uses LIFO mode)
180178
}

0 commit comments

Comments
 (0)