Skip to content

Add param conditions support to allowInInstanceOf and disallowInInstanceOf#401

Merged
spaze merged 1 commit into
mainfrom
spaze/param-conditions-allow-in-instance-of
Apr 24, 2026
Merged

Add param conditions support to allowInInstanceOf and disallowInInstanceOf#401
spaze merged 1 commit into
mainfrom
spaze/param-conditions-allow-in-instance-of

Conversation

@spaze
Copy link
Copy Markdown
Owner

@spaze spaze commented Apr 24, 2026

allowInInstanceOf and disallowInInstanceOf can now be combined with allowParamsInAllowed and allowExceptParamsInAllowed to add parameter-based conditions within the class hierarchy scope.

No new config keys - reuses the existing *InAllowed directives.

Documents all four combinations in allow-in-instance-of.md and updates allow-with-parameters.md to mention allowInInstanceOf.

…ceOf`

Combining instanceof-based directives with `allowParamsInAllowed` or `allowExceptParamsInAllowed` makes it possible to narrow which calls within a class hierarchy are reported, without introducing new config keys.
@spaze spaze self-assigned this Apr 24, 2026
Copilot AI review requested due to automatic review settings April 24, 2026 00:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the “instance-of scoped” allow/disallow directives so they can be combined with existing parameter-based conditions, enabling conditional allowances/blocks within a class hierarchy without introducing new config keys.

Changes:

  • Apply allowParamsInAllowed / allowExceptParamsInAllowed when evaluating allowInInstanceOf and disallowInInstanceOf (alias of allowExceptInInstanceOf).
  • Add a dedicated test fixture + assertions covering all four directive combinations.
  • Document the new combinations in allow-in-instance-of.md and cross-reference them from allow-with-parameters.md.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Allowed/Allowed.php Extends instance-of allow/disallow checks to optionally incorporate *ParamsInAllowed conditions.
tests/src/BarInstanceOfWithParams.php New test fixture exercising hierarchy-scoped parameter conditions.
tests/Calls/FunctionCallsTest.php Adds configuration and a new test validating the new behavior.
docs/allow-with-parameters.md Mentions that allowParamsInAllowed/allowExceptParamsInAllowed can also scope via allowInInstanceOf.
docs/allow-in-instance-of.md Documents all combinations of instance-of scoping with parameter conditions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@spaze spaze merged commit 7187876 into main Apr 24, 2026
154 checks passed
@spaze spaze deleted the spaze/param-conditions-allow-in-instance-of branch April 24, 2026 00:30
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.

2 participants