[13.x] Convert File::types() from static to instance method#59247
Closed
AnnoyingTechnology wants to merge 2 commits intolaravel:13.xfrom
Closed
[13.x] Convert File::types() from static to instance method#59247AnnoyingTechnology wants to merge 2 commits intolaravel:13.xfrom
AnnoyingTechnology wants to merge 2 commits intolaravel:13.xfrom
Conversation
File::types() was a static factory that returned new static(), silently discarding all prior chain configuration (max, dimensions, allowSvg, etc.) when called on an existing instance. This makes types() an instance method returning $this, consistent with extensions() and the rest of the fluent builder API. Fixes laravel#59242
Member
|
Breaking change day of release. |
Author
|
When should this be re-open @taylorotwell ? Is there a way to document this silent validation bypass in the meantime ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
File::types()is a static factory that returnsnew static(). When called in a fluent chain(
File::image()->max(1)->types(['jpg'])), PHP invokes the static method and returns a freshobject, silently discarding all prior configuration.
This makes
types()an instance method returning$this, consistent withextensions()and therest of the fluent builder API.
Breaking change:
File::types([...])as a static entry point no longer works. Replace withRule::file()->types([...])Fixes #59242
Fixes #59242