Repository navigation
Make webware-core an optional dependency - #39
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves
webware/webware-coreout ofrequireand intorequire-devwith the same constraint (^1.0.0-alpha.6), and adds asuggestentry 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-corerequireslaminas-inputfilter: 3.0.x-dev,php-db/phpdb: ^0.6.x-dev,laminas-permissions-aclandmezzio-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\Corereference insrcis a nullable parameter or property type, anAclInterface::classstring constant, or aninstanceofcheck.NavigationFactorycallshas()beforeget();NavigationMiddlewareonly callssetAcl()wheninstanceofpasses, which is false when core is absent. No path fatals without core installed.Evidence
composer why webware/webware-corebefore: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 underpackages-dev.A scratch copy outside the repository (
composer.json,composer.lockandsrconly) was installed withcomposer install --no-dev:vendor/webware/webware-coreis absent andcomposer why webware/webware-corereports "Could not find package".interface_existsis false for both core interfaces.NavigationFilterIteratorwith a null user and a null ACL (two admin routes matched, the public route excluded), then builtView\Helper\Navigationover a realRouteCollectorand rendered the menu (one top-level item with one child).Tests
NavigationFactoryTestnow asserts the factory leaves the ACL null when the container lacks it, replacing the instance-only assertion.Gates
mago format --check: cleanmago lint: cleanmago analyze: cleanmago guard: cleanphpunit: 29 tests, 54 assertions, OK