Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .claude/agents/code-reviewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ Review against the checklist below, in this order of severity.
## 2. Version pins (blocking)

- `composer.json` must keep `"php": "^8.4"` and
`"lisachenko/z-engine": "~8.4.2 || ~8.5.0 || 8.6.x-dev"` — one z-engine line per
supported PHP minor, resolved by Composer against the running PHP: stable tags for 8.4
and 8.5, the `8.6.x-dev` development line for 8.6 until z-engine tags it (then it
becomes `~8.6.0` and `"prefer-stable": true` is dropped in the same change). The root
`"prefer-stable": true` is what keeps 8.4/8.5 on their tags while the dev flag is
present; a diff that removes it before then, or adds `"minimum-stability": "dev"`, is
rejected.
`"lisachenko/z-engine": "~8.4.2 || ~8.5.0 || ~8.6.0"` — one stable z-engine line per
supported PHP minor, resolved by Composer against the running PHP. A diff that adds a
development constraint, `"minimum-stability": "dev"` or `"prefer-stable"` is rejected.
- Any diff that widens either constraint beyond the minors z-engine has definitions for
(`>=8.4`, a `^8.4` z-engine constraint that would span future lines), or bypasses
`Core::init()`'s version guard, is rejected outright. Offsets into engine structures are
Expand Down
2 changes: 1 addition & 1 deletion .claude/agents/phpt-author.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ array(1) {
JIT rewrites the executor internals z-engine hooks. There is no `error_reporting` line
any more: it existed only to hide a deprecation z-engine's development line raised
(implicitly nullable parameters), and the stable releases this package requires
(`~8.4.2 || ~8.5.0`) raise none. Do not add one back — PHPUnit's `.phpt` runner forces
(`~8.4.2 || ~8.5.0 || ~8.6.0`) raise none. Do not add one back — PHPUnit's `.phpt` runner forces
`display_errors=1`, so a diagnostic reaching your captured output is real information,
not noise to suppress.
- **An operator cannot throw into userland.** `__doOperation`/`__compare` run inside an FFI
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ on:
permissions:
contents: read

# z-engine tracks one PHP minor per release line; the "~8.4.2 || ~8.5.0 || 8.6.x-dev"
# constraint lets Composer resolve the line matching each runner's PHP, so the suite
# runs on PHP 8.4, 8.5 and 8.6 in parallel. 8.4 and 8.5 resolve stable tags; 8.6
# resolves z-engine's master (branch-aliased 8.6.x-dev) until z-engine tags 8.6. The
# z-engine tracks one PHP minor per release line; the "~8.4.2 || ~8.5.0 || ~8.6.0"
# constraint lets Composer resolve the stable line matching each runner's PHP, so the
# suite runs on PHP 8.4, 8.5 and 8.6 in parallel. The
# 8.6 legs are set up exactly as z-engine's own CI sets up its 8.6 line (plain
# php-version '8.6', which setup-php serves pre-release builds for too) and, like
# there, they are required, not allowed to fail.
# php-version '8.6', the GA release) and, like there, they are required, not
# allowed to fail.
jobs:
tests:
name: Tests (PHP ${{ matrix.php }})
Expand Down
36 changes: 12 additions & 24 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ structures (`zend_class_entry`, `zval`, `zend_object_handlers`) by byte offset,
those offsets change on every PHP minor release. Running against the wrong minor
does not throw a nice exception; it reads and writes the wrong memory.

That is why z-engine is required as **`~8.4.2 || ~8.5.0 || 8.6.x-dev`**: Composer
resolves the line matching the running PHP (`8.4.x` on PHP 8.4, `8.5.x` on PHP 8.5,
z-engine `master` — branch-aliased `8.6.x-dev` — on PHP 8.6). Each line declares its
own `~8.4.0`/`~8.5.0`/`~8.6.0` platform requirement, so only one line can ever satisfy
a given runtime. 8.4 and 8.5 are stable tags; 8.6 rides the development line until
z-engine tags it. `ZEngine\Core::init()` (called from `bootstrap.php`) enforces the
That is why z-engine is required as **`~8.4.2 || ~8.5.0 || ~8.6.0`**: Composer
resolves the stable release line matching the running PHP (`8.4.x` on PHP 8.4, `8.5.x`
on PHP 8.5, `8.6.x` on PHP 8.6). Each line declares its own `~8.4.0`/`~8.5.0`/`~8.6.0`
platform requirement, so only one line can ever satisfy a given runtime. `ZEngine\Core::init()` (called from `bootstrap.php`) enforces the
exact match and aborts with a clear message. **Never "fix" an initialization failure
by loosening the constraints past the minors z-engine has definitions for, skipping
`Core::init()`, or defeating the guard.** If the environment's PHP does not satisfy
Expand Down Expand Up @@ -48,8 +46,8 @@ The suite used to carry a third line, `error_reporting=E_ALL & ~E_DEPRECATED`, f
exactly that reason: z-engine's development line declared implicitly nullable
parameters (e.g. `ZEngine\Type\OpLine::__construct()`) and PHP reported the
deprecation into every test's output. The stable releases now required
(`~8.4.2 || ~8.5.0`) declare those parameters `?Type`, the suite passes with
`error_reporting=E_ALL` forced on both minors, and the line has been removed. **Do
(`~8.4.2 || ~8.5.0 || ~8.6.0`) declare those parameters `?Type`, the suite passes with
`error_reporting=E_ALL` forced on every minor, and the line has been removed. **Do
not add it back to silence a new diagnostic** — a deprecation appearing in the
captured output is a signal about a dependency or about this library, and hiding it
only moves the failure somewhere harder to find.
Expand Down Expand Up @@ -331,24 +329,14 @@ stable under `composer cs:fix`.

## Dependency policy

- `lisachenko/z-engine` is required as **`~8.4.2 || ~8.5.0 || 8.6.x-dev`** — one line
per supported PHP minor, resolved by Composer to match the running PHP. 8.4 and 8.5
are **stable** release lines; the tilde is deliberate: it admits patch releases
- `lisachenko/z-engine` is required as **`~8.4.2 || ~8.5.0 || ~8.6.0`** — one
**stable** release line per supported PHP minor, resolved by Composer to match the
running PHP. The tilde is deliberate: it admits patch releases
within a line (`8.4.3`, `8.5.1`) but never the next minor line, which would be built
for a PHP this package does not claim to support.
- 8.6 rides z-engine's **development line**, `8.6.x-dev` (`master`, branch-aliased),
because z-engine has not tagged 8.6 yet. When it does, replace `8.6.x-dev` with the
tag's tilde constraint (`~8.6.0`) **and** drop `"prefer-stable"` in a single change.
- An explicit dev constraint carries its own root stability flag, so this package's
own installs (and CI) resolve `master` on PHP 8.6 without `"minimum-stability":
"dev"`. That flag applies to the whole package, though, so it would also admit the
`8.4`/`8.5` development branches on those minors — which is why the root carries
`"prefer-stable": true`: it keeps PHP 8.4 and 8.5 on their stable tags. Do not add
`"minimum-stability": "dev"`.
- **Stability flags do not propagate to consumers.** Until the 8.6 tag exists, a
project on PHP 8.6 must itself require `lisachenko/z-engine:8.6.x-dev` at its root
(or set `"minimum-stability": "dev"` with `"prefer-stable": true`). Consumers on 8.4
and 8.5 need nothing extra.
- Nothing in `require` is a development branch, so the root carries neither
`"minimum-stability": "dev"` nor `"prefer-stable"`, and consumers need no
stability configuration on any supported minor. Do not add either.
- PHP stays at `^8.4`, in lockstep with the set of z-engine lines this package
tracks: a new PHP minor is added here only together with the z-engine line built
for it, and never one without the other.
Expand Down
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,24 +187,15 @@ The maths is plain PHP — or plain BLAS, if you asked for it. The magic is only
- **PHP `^8.4`** — 8.4, 8.5 and 8.6 are supported in parallel. Z-Engine reads engine structures by byte offset and those offsets change on every PHP minor release, so each minor rides its own Z-Engine line; `Core::init()` refuses to boot on a mismatch rather than corrupting memory.
- **`ext-ffi` enabled**, with `ffi.enable=1` for CLI usage.
- **x64, non-thread-safe (NTS)** build — the same platform limitations as [Z-Engine](https://github.com/lisachenko/z-engine#requirements--support-matrix).
- The **matching Z-Engine minor release line**. Composer resolves it for you from the `~8.4.2 || ~8.5.0 || 8.6.x-dev` constraint; mixing a Z-Engine built for another minor is not a configuration choice, it is undefined behaviour.
- **On PHP 8.6 only:** Z-Engine has no stable 8.6 tag yet, so 8.6 rides its `8.6.x-dev` development line, and your project must allow that line at its root (see [Installation](#installation)).
- The **matching Z-Engine minor release line**. Composer resolves it for you from the `~8.4.2 || ~8.5.0 || ~8.6.0` constraint; mixing a Z-Engine built for another minor is not a configuration choice, it is undefined behaviour.

## Installation

```bash
composer require lisachenko/native-php-matrix:dev-master
```

This package requires Z-Engine as `~8.4.2 || ~8.5.0 || 8.6.x-dev` — z-engine minors track PHP minors and are not interchangeable, so Composer resolves the line matching your PHP automatically (`8.4.x` on PHP 8.4, `8.5.x` on PHP 8.5, `8.6.x-dev` on PHP 8.6). The 8.4 and 8.5 lines are **stable tags**, so no `minimum-stability` tweak is needed for them.

**On PHP 8.6**, Z-Engine is still a development branch until it tags 8.6, and Composer only honours stability flags written in *your* root `composer.json` — not the ones a dependency declares. Require the line explicitly alongside this package:

```bash
composer require lisachenko/native-php-matrix:dev-master lisachenko/z-engine:8.6.x-dev
```

(or set `"minimum-stability": "dev"` with `"prefer-stable": true` in your project). Once Z-Engine tags 8.6, this package tightens its constraint to that tag and the extra requirement can be dropped.
This package requires Z-Engine as `~8.4.2 || ~8.5.0 || ~8.6.0` — z-engine minors track PHP minors and are not interchangeable, so Composer resolves the line matching your PHP automatically (`8.4.x` on PHP 8.4, `8.5.x` on PHP 8.5, `8.6.x` on PHP 8.6). All three are **stable tags**, so no `minimum-stability` tweak is needed.

native-php-matrix itself is not tagged yet, which is why the command above asks for `dev-master`; that one dev constraint is explicit, so Composer accepts it without a root stability change. Once a native-php-matrix release is tagged, this collapses to a plain `composer require lisachenko/native-php-matrix`.

Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require": {
"php": "^8.4",
"ext-ffi": "*",
"lisachenko/z-engine": "~8.4.2 || ~8.5.0 || 8.6.x-dev"
"lisachenko/z-engine": "~8.4.2 || ~8.5.0 || ~8.6.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.75",
Expand Down Expand Up @@ -53,6 +53,5 @@
},
"config": {
"sort-packages": true
},
"prefer-stable": true
}
}