-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Huge improve in autocomplete / refactoring / usability for programmers - return specific type instead of generic one #907
Comments
What about |
These are two separate things. This should be must have everywhere, i.e. to support only FQ class names. My point is drop support for User almost everywhere, see https://github.com/atk4/ui/search?l=PHP&q=%22add%28%22 |
It is not easy to avoid |
@georgehristov I know, but seed is passed to the newly created object (more specifically a factory). So if we pass seed directly to a constructor of the new object and then add it to the parent (via proposed |
@mvorisek It should be fine that way I guess, but it will be huge backward-incompatible change. |
The |
Proposed steps to implement:
Before the 2nd step is implemented (and if impossible) the new code should look like:
@georgehristov, @DarkSide666 wdyt? |
String and Array seed must be supported due to reasons I mentioned above |
Can you provide an example, which can not be converted to:
|
You need to be able to take the seed as array, create the object and add it to the owner. Of course you can convert this to the code you listed but you need to write the complete factory method code every time you'd like to convert the array to an object of the specified class. |
A lot of code constructs look like:
in better case there is an extra type hint like:
This is a feature request to add
__construct
optionaddTo
(and maybe some generic option for things likeaddField
) like:which should be equivalent of
$form = $app->add('Form');
.This will hugely improve utocomplete / refactoring / usability for programmers.
All usages and examples should be converted to the new syntax.
$app->add('Form')
syntax should be dropped in the new 2.x branch and only$app->add($obj)
should be supported. We should aim step by step for 100% refactorability.The text was updated successfully, but these errors were encountered: