Skip to content

Put a flag on what morph class to return from a child#147

Open
mattzuba wants to merge 1 commit intotighten:mainfrom
mattzuba:fix-for-reflection-lazy-proxy
Open

Put a flag on what morph class to return from a child#147
mattzuba wants to merge 1 commit intotighten:mainfrom
mattzuba:fix-for-reflection-lazy-proxy

Conversation

@mattzuba
Copy link

#33 updated the getMorphClass method to return the parent's morph class. Livewire supports using ReflectionClass::newLazyProxy if running on PHP 8.4+. This causes issues when the ReflectionClass instance is created using the parent class, but the callback function returns the child. So for my use case, I needed to return the parent::getMorphClass value from the child, not the parent classes getMorphClass value.

This change adds a simple boolean flag/property that can be added to child classes to use parent::getMorphClass. Also maintains backwards compatibility with what #33 implemented to not break anyone. Test cases to replicate included as well.

@mattzuba mattzuba force-pushed the fix-for-reflection-lazy-proxy branch from 908603a to 91f072c Compare February 12, 2026 00:33
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