-
-
Notifications
You must be signed in to change notification settings - Fork 699
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
[Nette] forms setRequired(false) #28
Conversation
[TriggerExtractor] init
Just note: in specific cases, this may be an incompatible change. |
I don't actually understand it... this is just first example. Could you provide cases to make it compatible? |
I mean rare cases. For example: $form->addText('name')
->addCondition($form::FILLED)
->addRule(...)
->addRule(...);
$form['name']
->addRule(...); // this rule is called regardless of whether it is filled in (Nette 2.4 triggers warning here that will force you to decide whether the field is required or not) Automatically changed code: $form->addText('name')
->setRequired(false)
->addRule(...)
->addRule(...);
$form['name']
->addRule(...); // now is this rule called only when input is filled (no warning is triggered) |
Thanks. I haven't seen such use case yet. So there should be added another refactoring, that adds |
Yes, when there is addRule(), there must be setRequired(). But every such changes must be checked by the programmer, because in some cases it can change the function. |
Sure, the aim is to keep programmer out of manually work and keep only checking. Something like code review. Thanks, I will look on that later |
rectorphp/rector-src@15be298 [Config] update duplicate Skip fixture config (#28)
* [Config] Remove duplicate Skip fixture config * uupdate to */Fixture*/*
Closes #27
What is the function?
I really didn't get it from the forum, so at the moment it works like this:
Find on variable of
Nette\Application\UI\Form
type:and replace it by:
Could you confirm/help me with that @dg && @petrvacha?