-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add image formats to Faker\Provider\Image
#473
Conversation
Phpcs is failing. Can you review? |
I fixed the above issues, but I am unable to run |
Pipeline is green, will do final review tomorrow so we can merge |
LGTM |
Adding a method in an interface is a BC break. |
Interesting, there is a job in the pipeline that checks for backwards compatibility and it has passed for the current pull request: https://github.com/FakerPHP/Faker/actions/runs/2293913195 |
What is the reason for this PR?
The placeholder.com API allows for a few image formats, whereas
image()
andimageUrl()
inFaker\Provider\Image
defaulted topng
.Author's checklist
Summary of changes
Added a static array to
Faker\Provider\Image
which contains allowable image formats (per Placeholder). Appended$format
argument to bothImage::image()
andImage::imageUrl()
which defaults to 'png'. Throw an exception inImage::imageUrl()
if an invalid format is received. Wrote unit tests for all the image formats andIllegalArgumentException
.Review checklist