Skip to content

[13.x] Fix null deprecation warnings in additional validation rules#59581

Closed
niduranga wants to merge 1 commit intolaravel:13.xfrom
niduranga:13.x
Closed

[13.x] Fix null deprecation warnings in additional validation rules#59581
niduranga wants to merge 1 commit intolaravel:13.xfrom
niduranga:13.x

Conversation

@niduranga
Copy link
Copy Markdown
Contributor


PR Description (Copy & Paste meka)

Description
Fixes the null deprecation warnings in AnyOf, ArrayRule, and Can validation rules. These rules followed an identical pattern to the issues previously fixed in Contains, DoesntContain, In, and NotIn rules (#59561), where passing a null value to internal string functions triggered deprecation warnings in PHP 8.1+.

Example

// AnyOf, ArrayRule, or Can with null values
Rule::anyOf([1, null, 'active']);
// Before: Deprecated warning (null cast to string)
// After: No warning (null cast to empty string)
Rule Fixed Reference
Contains #59561
DoesntContain #59561
In #59576
NotIn #59576
AnyOf This PR
ArrayRule This PR
Can This PR

Changes

  • src/Illuminate/Validation/Rules/AnyOf.php - Cast value to string
  • src/Illuminate/Validation/Rules/ArrayRule.php - Cast enum values to string
  • src/Illuminate/Validation/Rules/Can.php - Cast value to string for Gate

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.

2 participants