Skip to content

Cleanup deprecation notices and clean up code inline with php8.1#63

Merged
frankdekker merged 15 commits intomasterfrom
Solve-constraint-constructor-deprecation-notices
Dec 17, 2025
Merged

Cleanup deprecation notices and clean up code inline with php8.1#63
frankdekker merged 15 commits intomasterfrom
Solve-constraint-constructor-deprecation-notices

Conversation

@frankdekker
Copy link
Member

@frankdekker frankdekker commented Nov 30, 2025

Breaking change: yes
Fixes: #57

As of Symfony 8. the $options argument of Constraint is no longer used. InConstraint however still uses this constructor to fill the values argument.

Changed InConstraint constructor to require values parameter.

@frankdekker frankdekker requested a review from a team as a code owner November 30, 2025 21:12
@frankdekker frankdekker requested review from bram123 and Copilot and removed request for Copilot November 30, 2025 21:12
Copilot AI review requested due to automatic review settings November 30, 2025 21:14
Copy link

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 modernizes the codebase to align with PHP 8.1+ standards and removes Symfony deprecation notices in preparation for Symfony 8 compatibility. The primary breaking change is the refactoring of InConstraint constructor to accept values as a direct parameter instead of through the options array.

Key changes include:

  • Refactored InConstraint to use a modern constructor signature compatible with Symfony 8
  • Modernized PHP syntax using typed properties, constructor property promotion, union types, and match expressions
  • Updated CI/CD matrix to test against PHP 8.4 and Symfony 8.0
  • Removed obsolete type safety test that's now handled by PHP's type system

Reviewed changes

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

Show a summary per file
File Description
src/Constraint/Type/InConstraint.php Refactored constructor to accept $values as first parameter instead of options array, compatible with Symfony 8
src/Constraint/Type/InConstraintValidator.php Updated validate method signature with mixed type hint
src/Constraint/Type/IntegerNumberValidator.php Updated validate method signature with mixed type hint
src/Constraint/Type/FloatNumberValidator.php Updated validate method signature with mixed type hint
src/Constraint/Type/BooleanValueValidator.php Updated validate method signature with mixed type hint
src/Constraint/ConstraintResolver.php Updated InConstraint instantiation to use new constructor signature
src/Constraint/ConstraintMapItem.php Modernized with constructor property promotion
src/Constraint/ConstraintMap.php Added typed property declaration
src/Constraint/ConstraintCollectionBuilder.php Added typed properties and return types
src/ConstraintFactory.php Refactored with constructor property promotion using readonly properties
src/Rule/Rule.php Modernized with constructor property promotion
src/Rule/RuleParser.php Updated type hints, replaced switch with match expression, used str_contains()
src/Rule/RuleList.php Added typed properties and modern union type hints
src/Utility/Arrays.php Improved array type documentation with int|string keys
tests/Unit/Constraint/Type/InConstraintTest.php Updated test to use new constructor signature
tests/Unit/Constraint/Type/InConstraintValidatorTest.php Updated tests with typed properties and new constructor
tests/Unit/Constraint/Type/IntegerNumberValidatorTest.php Modernized with typed properties and union type parameters
tests/Unit/Constraint/Type/FloatNumberValidatorTest.php Modernized with typed properties and union type parameters
tests/Unit/Constraint/Type/BooleanValueValidatorTest.php Modernized with typed properties, union types, and removed unused import
tests/Unit/Constraint/ConstraintResolverTest.php Updated test expectations for new InConstraint constructor
tests/Unit/Constraint/ConstraintMapItemTest.php Cleaned up by inlining boolean literal
tests/Unit/ConstraintFactoryTest.php Removed unnecessary false parameter (uses default value)
tests/Unit/Rule/RuleParserTest.php Removed obsolete type safety test, updated property types
tests/Unit/Utility/ArraysTest.php Improved PHPDoc with explicit int|string array keys, fixed grammar
tests/Integration/FieldValidationTest.php Modernized with typed properties and union type parameters
tests/Integration/AbstractIntegrationTestCase.php Added typed properties and modern union types
.github/workflows/test.yml Added PHP 8.4, 8.5 and Symfony 8.0 to test matrix
phpstan-baseline.neon Updated baseline for improved array type specificity
Comments suppressed due to low confidence (1)

.github/workflows/test.yml:56

  • PHP 8.5 does not exist as of January 2025. The current PHP versions are 8.1, 8.2, 8.3, and 8.4. This will cause the coverage job to fail. Consider using PHP 8.4 instead.
    steps:

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

@frankdekker frankdekker marked this pull request as draft November 30, 2025 21:28
@frankdekker frankdekker marked this pull request as ready for review December 16, 2025 16:59
@frankdekker frankdekker merged commit 1fbc253 into master Dec 17, 2025
24 checks passed
@frankdekker frankdekker deleted the Solve-constraint-constructor-deprecation-notices branch December 17, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Symfony 7.3 deprecation notices

3 participants