Skip to content

Modernize the library - #69

Merged
lyrixx merged 4 commits into
mainfrom
modernize
Sep 27, 2026
Merged

lyrixx merged 4 commits into
mainfrom
modernize

Conversation

@lyrixx

@lyrixx lyrixx commented Sep 26, 2026

Copy link
Copy Markdown
Member

This PR modernizes the library. It can be reviewed commit by commit.

1. Drop support for unmaintained versions

  • PHP >= 8.2 (PHP 8.1 is EOL)
  • symfony/http-client: ^6.4|^7.4|^8.1 (5.4, 7.0-7.3 and 8.0 are no longer maintained)
  • psr/log: ^2|^3
  • Switch from symfony/phpunit-bridge to phpunit/phpunit (11.5, 12, 13)
  • CI: actions/checkout@v5, hashicorp/consul:2.0 (the consul image is deprecated), prefer-lowest on PHP 8.2

2. Use PHP 8.2 features

  • readonly classes and properties, constructor property promotion
  • first-class callable syntax, array_is_list(), catch without variable, mixed
  • inline the trivial $params arrays in services
  • split MultiSemaphore::acquireResources() into smaller pieces. This also fixes
    a bug: the metadata of a resource leaked into the next one when acquiring many
    resources (wrong cas index, wrong sessions list)

No BC break on the public API.

3. Bug fix: Session::create() without arguments

Session::create() sent [] instead of {}, and Consul rejects it with a 400.
This broke LockHandler::lock() (and the README example). Tests added for
LockHandler and TXN.

4. README

New README with badges, features, configuration (CONSUL_HTTP_ADDR, ACL token,
custom client / logger), a services table linked to the Consul API docs, error
handling, a richer cookbook, and a compatibility table. All snippets were run
against a Consul 2.0 agent.

* PHP >= 8.2
* symfony/http-client ^6.4|^7.4|^8.1
* psr/log ^2|^3
* Switch from symfony/phpunit-bridge to phpunit/phpunit
* Update CI (actions/checkout, hashicorp/consul image)
* readonly classes and properties
* constructor property promotion
* first-class callable syntax, array_is_list(), catch without variable
* inline trivial $params arrays in services
* split MultiSemaphore::acquireResources() and fix the metadata of a
  previous resource leaking into the next one
Consul expects a JSON object, but an empty array was sent. This also
broke LockHandler::lock().

Add tests for LockHandler and TXN.
@lyrixx
lyrixx merged commit da88145 into main Sep 27, 2026
7 checks passed
@lyrixx
lyrixx deleted the modernize branch September 27, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant