Skip to content

Conversation

@camilleislasse
Copy link
Contributor

@camilleislasse camilleislasse commented Dec 13, 2025

Q A
Bug fix? no
New feature? no
Docs? no
License MIT

The Vector constructor had duplicate validation code. The second check (line 36-38) could never be reached because the first check (line 28-30) already handles the same condition.

Given $dimensions is typed ?int:

  • null !== $dimensions = "dimensions is not null"
  • \is_int($dimensions) = "dimensions is an int"

When $dimensions is not null, it is an int. So both conditions are equivalent, making the second check unused code.

This PR:

  • Removes the unreachable duplicate check
  • Adds missing test coverage for dimension validation

@carsonbot carsonbot added Platform Issues & PRs about the AI Platform component Status: Needs Review labels Dec 13, 2025
@carsonbot carsonbot changed the title [Platform] Remove dead code in Vector constructor and add missing tests [Platform] Remove unused code in Vector constructor and add missing tests Dec 13, 2025
@chr-hertel
Copy link
Member

Good catch, thanks @camilleislasse.

@chr-hertel chr-hertel merged commit 93d31c6 into symfony:main Dec 14, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Platform Issues & PRs about the AI Platform component Status: Reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants