Skip to content

Conversation

othercodes
Copy link
Contributor

No description provided.

@othercodes othercodes requested a review from Copilot October 13, 2025 02:08
Copy link

@Copilot 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 adds support for union types in the IsModel trait, enabling the make() method to properly validate parameters that accept multiple types (e.g., int|float|string).

  • Added union type validation logic in the validateConstructorParameters method
  • Introduced a new validateUnionType method to handle complex type checking
  • Updated error messages and type imports for better consistency

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/IsModel.php Core implementation of union type support with validation logic and error handling
tests/Fixtures/TypeSafety/FlexibleValue.php Test fixture class demonstrating union types with int|float|string and nullable parameters
tests/TypeValidationTest.php Comprehensive test coverage for union type scenarios including error cases and nullable types
Comments suppressed due to low confidence (1)

tests/TypeValidationTest.php:1

  • The __toString() method returns $this->label when it's not null, but the test on line 101 expects the string representation to be '42', not 'Label'. This will cause the test to fail when a label is provided.
<?php

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@othercodes othercodes merged commit 0aa04c7 into main Oct 13, 2025
6 checks passed
@othercodes othercodes deleted the feature/union-type-support branch October 13, 2025 02:11
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