You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One problem with the method in-which inline instance creation works, is most IDEs have no way to know how to provide code hints for the arguments passed into the constructor. It would be nice if it were possible to register loader items using method chaining instead. This would make it possible to sanitize these items individually for children classes, and make the IDE provide the hints needed to actually set these up.
I personally find myself looking up the documentation to set up loader items all the dang time, and it would be nice if I didn't have to rely so heavily on the documentation to make sense of how to set these things up. I think a setter pattern would really help with this.
This would provide a third way to register something. The array-based method, providing a class directly, and a setter-based method.
Some things to consider:
The behavior of loaders is to make these values largely immutable. Once they're set, it shouldn't be possible to set them again. The setter-based method should work in this way, too, and there would need to be an easy way to ensure that these values, once set, can't be overridden afterward.
This pattern would also make it possible to do something that's not currently possible - to set a loader value after something is registered. Would this be considered an anti-pattern? EG:
// Set most of the values on-registrationunderpin()->meta()->add( 'meta_name', [
'key' => 'meta_key',
'description' => 'Meta description',
'name' => 'Meta Name',
'default_value' => false
] );
// Later on, after registration, set the type.underpin()->meta()->get( 'meta_name' )->set_type( 'some_dynamic_type' );
The text was updated successfully, but these errors were encountered:
One problem with the method in-which inline instance creation works, is most IDEs have no way to know how to provide code hints for the arguments passed into the constructor. It would be nice if it were possible to register loader items using method chaining instead. This would make it possible to sanitize these items individually for children classes, and make the IDE provide the hints needed to actually set these up.
I personally find myself looking up the documentation to set up loader items all the dang time, and it would be nice if I didn't have to rely so heavily on the documentation to make sense of how to set these things up. I think a setter pattern would really help with this.
Current signature example:
Potential signature example:
This would provide a third way to register something. The array-based method, providing a class directly, and a setter-based method.
Some things to consider:
The text was updated successfully, but these errors were encountered: