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.
Unlike the NullAdapter, this adapter is always empty instead of allowing it to paginate an array of null values. Thanks to that, its generic type can fullfil types like
AdapterInterface<Foo>
with a non-nullableFoo
type.See https://phpstan.org/r/ada3d136-11fa-43f2-a5dc-dd282f008b3e for the difference it makes for phpstan and https://psalm.dev/r/cb09185906 for Psalm.
This EmptyAdapter is mostly meant to be used for conditional returns, where another branch of the execution would return a different adapter implementation (for instance to skip executing a DB query entirely when you know that the parameters you deal with cannot produce any results because they would execute a query with
WHERE true = false
).