Skip to content

Fix: Global Repository Can't Return Null#53

Merged
tdwesten merged 2 commits intotdwesten:mainfrom
tylerdak:fix/global-repo-find-return-null
Apr 4, 2025
Merged

Fix: Global Repository Can't Return Null#53
tdwesten merged 2 commits intotdwesten:mainfrom
tylerdak:fix/global-repo-find-return-null

Conversation

@tylerdak
Copy link
Contributor

@tylerdak tylerdak commented Apr 2, 2025

I noticed Statamic Builder's GlobalRepository::find method is unable to return null from parent::find. There's a check that parent::find's result isn't falsey, but returning null is proper behavior of GlobalRepository::find. If the result is falsey ::find does not return in Statamic Builder's implementation, which is a violation of its return type ?GlobalSet, causing an error to be thrown.

This pull request removes the falsey check and returns the parent::find result no questions asked. Test included (checkout 3ef6e1d to get the test to fail).

@tdwesten
Copy link
Owner

tdwesten commented Apr 4, 2025

Oh nice! Thanks!

@tdwesten tdwesten merged commit 599f66f into tdwesten:main Apr 4, 2025
3 checks passed
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