Skip to content

Commit b77fcf4

Browse files
authored
Merge pull request #27 Remove support for PHP <8.2
2 parents 9c4f0bd + 3084f02 commit b77fcf4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+221
-151
lines changed

.github/workflows/linux-php-8.0.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/linux-php-8.1.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Changelog
2+
3+
All notable changes to **parallel-sdk** are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/).
4+
5+
## `3.0.0` – 2025-07-04
6+
7+
### Added
8+
- **Domain-specific exception hierarchy**
9+
`ActionNotImplementedException`, `InvalidMessageReceivedException`, `NoWorkerDefinedException`, `TaskExecutionFailedException`, `WorkerAlreadyDefinedException`, `WorkerNotDefinedException`, plus a `ParallelException` value object to serialise task-side errors.
10+
- `Scheduler::runTask()` now surfaces worker exceptions through `TaskExecutionFailedException` for clearer diagnostics.
11+
- Adopted modern PHP 8.2 language features:
12+
* `readonly` properties and promoted constructor parameters
13+
* Precise return-type hints (e.g. `void` on closures)
14+
* `match`-style strict comparisons and assorted PSR-12 tidy-ups.
15+
16+
### Changed
17+
- **BC-BREAK:** Minimum supported PHP version raised from 8.0 → **8.2**.
18+
Consumers on <8.2 will remain on the `2.x` series.
19+
- `Scheduler::using()` now throws `WorkerAlreadyDefinedException` when attempting to re-register an existing worker with constructor args.
20+
- Error bubbling in `Scheduler::runTask()` changed from `RuntimeException` with string message to the typed `TaskExecutionFailedException`.
21+
22+
### Removed
23+
- CI workflows for PHP 8.0 & 8.1 ‒ the suite now runs on 8.2/8.3/8.4.
24+
- Legacy catch-all `RuntimeException` branches replaced with specific domain exceptions.
25+
26+
### Fixed
27+
- Sporadic race-condition when starting the runner under PHP ≥ 8.1 by ensuring a micro-sleep and event handshake.
28+
- Several docblock inaccuracies and progress-bar initialisation edge cases.
29+
30+
---
31+
32+
## [2.1.4] – 2024-xx-xx
33+
_Refer to Git history for details prior to the 3.x line._

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ An implementation of [krakjoe/parallel](https://github.com/krakjoe/parallel) PHP
77
[![Monthly Downloads](https://img.shields.io/packagist/dm/hds-solutions/parallel-sdk?style=flat-square&color=747474&label)](https://packagist.org/packages/hds-solutions/parallel-sdk)
88
[![Required PHP version](https://img.shields.io/packagist/dependency-v/hds-solutions/parallel-sdk/php?style=flat-square&color=006496&logo=php&logoColor=white)](https://packagist.org/packages/hds-solutions/parallel-sdk)
99

10-
[![PHP 8.0](https://img.shields.io/github/actions/workflow/status/hds-solutions/parallel-sdk/linux-php-8.0.yml?style=flat-square&logo=github&label=PHP%208.0)](https://github.com/hschimpf/parallel-sdk/actions/workflows/linux-php-8.0.yml)
11-
[![PHP 8.1](https://img.shields.io/github/actions/workflow/status/hds-solutions/parallel-sdk/linux-php-8.1.yml?style=flat-square&logo=github&label=PHP%208.1)](https://github.com/hschimpf/parallel-sdk/actions/workflows/linux-php-8.1.yml)
1210
[![PHP 8.2](https://img.shields.io/github/actions/workflow/status/hds-solutions/parallel-sdk/linux-php-8.2.yml?style=flat-square&logo=github&label=PHP%208.2)](https://github.com/hschimpf/parallel-sdk/actions/workflows/linux-php-8.2.yml)
1311
[![PHP 8.3](https://img.shields.io/github/actions/workflow/status/hds-solutions/parallel-sdk/linux-php-8.3.yml?style=flat-square&logo=github&label=PHP%208.3)](https://github.com/hschimpf/parallel-sdk/actions/workflows/linux-php-8.3.yml)
1412
[![PHP 8.4](https://img.shields.io/github/actions/workflow/status/hds-solutions/parallel-sdk/linux-php-8.4.yml?style=flat-square&logo=github&label=PHP%208.4)](https://github.com/hschimpf/parallel-sdk/actions/workflows/linux-php-8.4.yml)
@@ -19,7 +17,7 @@ That allow that your code can be deployed in any environment, and if `parallel`
1917
## Installation
2018
### Dependencies
2119
You need these dependencies to execute tasks in parallel.
22-
- PHP >= 8.0 with ZTS enabled
20+
- PHP >= 8.2 with ZTS enabled
2321
- parallel PECL extension _(v1.2.5 or higher)_
2422

2523
Parallel extension documentation can be found on https://php.net/parallel.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"symfony/console": "Allows usage of a shared ProgressBar between the Workers"
1616
},
1717
"require": {
18-
"php": "^8.0"
18+
"php": "^8.2"
1919
},
2020
"autoload": {
2121
"files": [
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace HDSSolutions\Console\Parallel\Exceptions;
4+
5+
use RuntimeException;
6+
7+
final class ActionNotImplementedException extends RuntimeException {
8+
9+
public function __construct(string $action) {
10+
parent::__construct(sprintf('Action "%s" not yet implemented', $action));
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace HDSSolutions\Console\Parallel\Exceptions;
4+
5+
use RuntimeException;
6+
7+
final class InvalidMessageReceivedException extends RuntimeException {
8+
9+
public function __construct() {
10+
parent::__construct('Invalid message received!');
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace HDSSolutions\Console\Parallel\Exceptions;
4+
5+
use RuntimeException;
6+
7+
final class NoWorkerDefinedException extends RuntimeException {
8+
9+
public function __construct() {
10+
parent::__construct('No worker is defined');
11+
}
12+
13+
}

src/Exceptions/ParallelException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Throwable;
66

7-
final class ParallelException {
7+
final readonly class ParallelException {
88

99
private string $message;
1010

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace HDSSolutions\Console\Parallel\Exceptions;
4+
5+
use RuntimeException;
6+
7+
final class TaskExecutionFailedException extends RuntimeException {
8+
9+
public function __construct(ParallelException $exception) {
10+
parent::__construct($exception->getMessage());
11+
}
12+
13+
}

0 commit comments

Comments
 (0)