Skip to content

Make webware-core an optional dependency - #39

Merged
tyrsson merged 1 commit into
1.0.xfrom
tyrsson-optional-webware-core
Nov 14, 2026
Merged

tyrsson merged 1 commit into
1.0.xfrom
tyrsson-optional-webware-core

Conversation

@tyrsson

@tyrsson tyrsson commented Nov 14, 2026

Copy link
Copy Markdown
Member

Summary

Moves webware/webware-core out of require and into require-dev with the same constraint (^1.0.0-alpha.6), and adds a suggest entry for it. Core is only needed to filter navigation by ACL. Without it the helper builds with a null ACL and includes every route in the navigation.

Why

webware-core requires laminas-inputfilter: 3.0.x-dev, php-db/phpdb: ^0.6.x-dev, laminas-permissions-acl and mezzio-authentication, so every consumer that only wants the view helper inherited two dev-branch constraints. PR #37 already made the ACL optional at runtime, so the hard dependency is no longer needed.

Runtime audit

Every Webware\Core reference in src is a nullable parameter or property type, an AclInterface::class string constant, or an instanceof check. NavigationFactory calls has() before get(); NavigationMiddleware only calls setAcl() when instanceof passes, which is false when core is absent. No path fatals without core installed.

Evidence

composer why webware/webware-core before: requires webware/webware-core (^1.0.0-alpha.6). After: requires (for development) webware/webware-core (^1.0.0-alpha.6). The lock now lists core and its transitive dependencies under packages-dev.

A scratch copy outside the repository (composer.json, composer.lock and src only) was installed with composer install --no-dev:

  • vendor/webware/webware-core is absent and composer why webware/webware-core reports "Could not find package".
  • interface_exists is false for both core interfaces.
  • A script built NavigationFilterIterator with a null user and a null ACL (two admin routes matched, the public route excluded), then built View\Helper\Navigation over a real RouteCollector and rendered the menu (one top-level item with one child).

Tests

NavigationFactoryTest now asserts the factory leaves the ACL null when the container lacks it, replacing the instance-only assertion.

Gates

  • mago format --check: clean
  • mago lint: clean
  • mago analyze: clean
  • mago guard: clean
  • phpunit: 29 tests, 54 assertions, OK

Move webware/webware-core from require to require-dev with the same
constraint and add a suggest entry. Core is only needed to filter
navigation by ACL; without it the helper builds with a null ACL.

NavigationFactoryTest now asserts the factory leaves the ACL null when
the container does not have one.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tyrsson
tyrsson merged commit fdc364f into 1.0.x Nov 14, 2026
12 checks passed
@tyrsson
tyrsson deleted the tyrsson-optional-webware-core branch November 14, 2026 05:15
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