Skip to content

How to explain a contrib/custom field type to PHPstan #473

Answered by mglaman
mxr576 asked this question in Q&A
Discussion options

You must be logged in to vote

Right now there is no way unless you're extremely verbose

$field_item = $entity->get('field_bar')->first();
assert($field_item instanceof MyFieldItem);

A goal of #343 was to allow mapping fields to entity types. I guess this could happen as configuration without that! So the feature would be a field mapping alongside the entity mapping to say "this field has X field item list class and Y field item class"

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mglaman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants