Skip to content

Fix #43: annotate batch() and getDefaultDriver() on the Quantum facade - #94

Merged
corgab merged 2 commits into
mainfrom
fix/43-facade-batch-method
Sep 10, 2026
Merged

Fix #43: annotate batch() and getDefaultDriver() on the Quantum facade#94
corgab merged 2 commits into
mainfrom
fix/43-facade-batch-method

Conversation

@corgab

@corgab corgab commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

QuantumManager::batch() is public, documented in the README and reachable through the facade at runtime, but Quantum's docblock did not list it as an @method static annotation, so IDE completion and Larastan treated Quantum::batch() as undefined. getDefaultDriver() was missing for the same reason, and two existing annotations advertised narrower parameter types than the manager accepts.

Plan

Make the facade docblock faithful to the manager and add a test that keeps it that way: every public method the manager declares must be annotated, no annotation may name a method the manager no longer has, and each annotated return type must match the declared one.

Changes

  • src/Facades/Quantum.php: @method static BatchBuilder batch(array<array-key, CircuitBuilder> $circuits, ?string $driver = null) (the manager runs array_values() on the input, so keyed arrays are valid), @method static string getDefaultDriver(), and driver(string|\UnitEnum|null $driver = null) to match Manager::driver(), which resolves enum cases through driverAlias().
  • tests/Unit/Facades/QuantumFacadeTest.php (new): parses the @method lines (tolerating an omitted return type and generics with spaces) and checks three things by reflection: every method QuantumManager declares is annotated; no annotation is stale; annotated return types match declared ones.

No runtime change, no config change, no new dependencies.

Tests

The first test fails on main (batch and getDefaultDriver missing); the return-type test would catch a wrong annotation such as batch() returning CircuitBuilder.

Local: pint passed, pest 793 tests passed.

Closes #43

Quantum::batch() worked at runtime through Facade::__callStatic() but was
missing from the @method annotations, so IDEs and static analysis treated
it as undefined. The docblock now lists every public method QuantumManager
declares, and a test compares the annotations with the manager's public
methods so the two cannot drift apart again.

Closes #43
batch() accepts any array of circuits, since the manager reindexes it, and
driver() accepts the enum cases Manager::driver() resolves through
driverAlias(). The drift test now parses each annotation, checks the two
lists in both directions and compares the annotated return types with the
declared ones, instead of only looking for method names.
@corgab
corgab merged commit 1ce5bb0 into main Sep 10, 2026
5 checks passed
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.

[facade] Quantum facade docblock is missing @method for batch()

1 participant