Repository navigation
Conversation
Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>
xixi-box
requested review from
CodeWithKyrian,
Nyholm,
chr-hertel and
soyuka
as code owners
November 22, 2026 13:44
This branch has not been deployed
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.
Fixes #768
PHPStan at level max rejects built-in handlers passed to the client builder because the handler interface declares its result type invariant. Declare the return-only result type covariant so elicitation, sampling, and roots handlers satisfy the existing builder contract while preserving PHP signatures and runtime behavior.
Fixes #768.
Tests:
vendor/bin/phpstan analyse --level=max --debug --no-progress tests/Unit/Client/BuilderTest.php.Result: vendor/bin/phpunit tests/Unit/Client tests/Integration/ElicitationTest.php tests/Integration/SamplingTest.php tests/Integration/SamplingToolsTest.php tests/Integration/RootsTest.php tests/Integration/StatelessClientTest.php on base before adding the regression: exit 0, OK (1458 tests, 5099 assertions).
Result: vendor/bin/phpstan analyse --level=max --debug --no-progress tests/Unit/Client/BuilderTest.php on base with the regression: exit 1, argument.type for elicitation, sampling, and roots registrations in testAddRequestHandlerAcceptsConcreteResultTypes.
Result: vendor/bin/phpstan analyse --level=max --debug --no-progress tests/Unit/Client/BuilderTest.php on patched: exit 0, [OK] No errors.
Result: vendor/bin/phpstan analyse --no-progress --level=max tests/Integration/ElicitationTest.php on base: exit 1 with the reported argument.type diagnostic at the existing elicitation registration.
Result: vendor/bin/phpstan analyse --level=max --no-progress tests/Integration/ElicitationTest.php src/Client/Handler/Request/RequestHandlerInterface.php on patched: exit 0, [OK] No errors.
Result: vendor/bin/phpunit --filter testAddRequestHandlerAcceptsConcreteResultTypes tests/Unit/Client/BuilderTest.php --log-junit /tmp/oss-scout-php-sdk-builder-junit.xml on patched: exit 0, OK (1 test, 3 assertions).
Result: vendor/bin/phpunit tests/Unit/Client tests/Integration/ElicitationTest.php tests/Integration/SamplingTest.php tests/Integration/SamplingToolsTest.php tests/Integration/RootsTest.php tests/Integration/StatelessClientTest.php on patched: exit 0, OK (1459 tests, 5102 assertions).
Result: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run --diff --using-cache=no src/Client/Handler/Request/RequestHandlerInterface.php tests/Unit/Client/BuilderTest.php: exit 0, found 0 of 2 files that can be fixed.
Result: make -C /tmp/oss-scout-php-sdk-ci.MUKCwl ci on an isolated copy of the patched sources: exit 0. Composer stable resolved the installed dependencies, CS Fixer changed 0 files, PHPStan reported no errors, and Deptrac reported 0 violations. Full PHPUnit run including unit, integration, and interop reported Tests: 4435, Assertions: 13692, Skipped: 8.
Regression coverage:
tests/Unit/Client/BuilderTest.php.