Skip to content

fix: pacify PHP 8.2 typed property guards in validation attributes & Uncastable singleton - #1204

Open
alexqem wants to merge 1 commit into
spatie:mainfrom
alexqem:fix/defensive-property-initialization
Open

alexqem wants to merge 1 commit into
spatie:mainfrom
alexqem:fix/defensive-property-initialization

Conversation

@alexqem

@alexqem alexqem commented Sep 6, 2026

Copy link
Copy Markdown

Summary

  • Validation Attributes: Initialize default protected array $fields = []; across 11 validation attributes (ArrayType, Email, Mimes, MimeTypes, NotIn, Prohibits, RequiredWith, RequiredWithAll, RequiredWithout, RequiredWithoutAll, Url) to prevent PHP 8.2 Error: Typed property must not be accessed before initialization during reflection introspection.
  • Uncastable: Convert Uncastable::$instance to private static ?self $instance = null so PHP 8.2 stops crying when inspecting uncastable types before first instantiation.

Includes Pest unit tests for default attribute parameter instantiation.

@alexqem
alexqem force-pushed the fix/defensive-property-initialization branch from 784145d to 239ce18 Compare September 6, 2026 01:20
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