-
|
Currently, the I would like to mark specific properties in specific classes to allow partial absence. The motivation behind this suggestion is that while it is natural for an API to have missing properties, I want to standardize types in the server implementation. Is it realistic to implement such a feature in the future? /**
* @param int|null $age?
*/
public function __construct(int | null $age) {
}However, this might not be practical as it would require changes to the Doc parser. Another idea I came up with is adding an option to the MapperBuilder class to mark specific properties: $mapper = (new MapperBuilder())->allowUndefinedProperties([
["class" => A::class, "methods" => ["method1", "method2"]],
["class" => B::class, "methods" => ["method1", "method2"]],
])->mapper(); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hello there, sorry for the late answer. Maybe I don't understand correctly your need, but couldn't you be using default parameter values? Something like: public function __construct(int | null $age = null) {} |
Beta Was this translation helpful? Give feedback.
Hello there, sorry for the late answer. Maybe I don't understand correctly your need, but couldn't you be using default parameter values? Something like: