Respect xsi:type information better#39
Merged
veewee merged 1 commit intophp-soap:mainfrom Sep 26, 2025
Merged
Conversation
e518f39 to
b5648d4
Compare
b5648d4 to
07e34a2
Compare
722bca1 to
cbe86e3
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR improves the handling of xsi:type information in SOAP encoding/decoding by better supporting type detection and encoding. The changes centralize xsi:type logic, introduce new encoders for better type handling, and add comprehensive test coverage.
- Introduces new encoders (
XsiTypeEncoder,MatchingValueEncoder,FixedIsoEncoder) for better xsi:type handling - Refactors xsi:type detection logic from
ElementValueBuildertoXsiAttributeBuilderfor better centralization - Adds comprehensive test cases to verify xsi:type encoding/decoding behavior
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/PhpCompatibility/Implied/ImpliedSchema015Test.php | New test for xsi:type handling with class-based objects |
| tests/PhpCompatibility/Implied/ImpliedSchema014Test.php | New test for xsi:type handling with stdClass objects |
| tests/PhpCompatibility/Implied/ImpliedSchema012Test.php | Updates expected XML to use correct xsi:type |
| tests/PhpCompatibility/Implied/ImpliedSchema011Test.php | Updates expected XML to use correct xsi:type |
| tests/PhpCompatibility/Implied/ImpliedSchema010Test.php | Updates expected XML to use correct xsi:type |
| tests/PhpCompatibility/Implied/ImpliedSchema009Test.php | Updates expected XML to use correct xsi:type |
| tests/PhpCompatibility/AbstractCompatibilityTests.php | Adds debug statement for testing |
| src/Xml/Writer/XsiAttributeBuilder.php | Major refactor to centralize xsi:type logic |
| src/Xml/Writer/ElementValueBuilder.php | Removes xsi:type logic and delegates to XsiAttributeBuilder |
| src/Xml/Reader/ElementValueReader.php | Removes xsi:type detection logic |
| src/TypeInference/XsiTypeDetector.php | Refactors to separate type detection from encoder detection |
| src/EncoderRegistry.php | Removes OptionalElementEncoder wrapper and adds new helper methods |
| src/Encoder/XsiTypeEncoder.php | New encoder specifically for handling xsi:type encoding/decoding |
| src/Encoder/SoapEnc/SoapObjectEncoder.php | Updates to use centralized xsi:type logic |
| src/Encoder/SoapEnc/SoapArrayEncoder.php | Updates to use centralized xsi:type logic |
| src/Encoder/SoapEnc/ApacheMapEncoder.php | Updates to use centralized xsi:type logic |
| src/Encoder/SimpleType/EncoderDetector.php | Integrates XsiTypeEncoder into simple type detection |
| src/Encoder/ObjectEncoder.php | Updates to use centralized xsi:type logic |
| src/Encoder/MatchingValueEncoder.php | New encoder for value-based encoder selection |
| src/Encoder/FixedIsoEncoder.php | New encoder for fixed ISO transformations |
| src/Encoder/EncoderDetector.php | Integrates XsiTypeEncoder into encoder detection |
| examples/encoders/simpleType/anyType-with-xsi-info.php | Updates to use new centralized API |
| examples/encoders/complexType/matching-value.php | New example demonstrating MatchingValueEncoder usage |
| composer.json | Updates dependency version |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
cbe86e3 to
3e44681
Compare
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
This PR adds better support for encoding and decoding
xsi:typeinformation.This PR improves the handling of xsi:type information in SOAP encoding/decoding by better supporting type detection and encoding. The changes centralize xsi:type logic, introduce new encoders for better type handling, and add comprehensive test coverage.
Object:
Transcodes to:
For XSD:
With encoder configuration: