-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Add tel and color types #22679
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
Conversation
apetitpa
commented
May 9, 2017
•
edited by ogizanagi
Loading
edited by ogizanagi
Q | A |
---|---|
Branch? | 3.4 |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #22596 |
License | MIT |
Doc PR | not provided yet |
CONTRIBUTORS.md
Outdated
@@ -182,9 +182,8 @@ Symfony is the result of the work of many people who made the code better | |||
- Larry Garfield (crell) | |||
- Julien Falque (julienfalque) | |||
- Martin Schuhfuß (usefulthink) | |||
- apetitpa | |||
- Arnaud Petitpas (apetitpa) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can revert this change because that file is autogenerated, so any change will be lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not aware of this sorry, I'll do it in a minute thank you
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated> | ||
</service> | ||
<service id="form.type.color" class="Symfony\Component\Form\Extension\Core\Type\ColorType" public="true"> | ||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds wrong, a new service shouldn't be already deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I reverted this part thank you
|
||
use Symfony\Component\Form\AbstractType; | ||
|
||
class TelType extends AbstractType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i definitely prefer TelephoneType
here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was quite unsure about what name to use, so I chose the one that matches the "tel" HTML5 input name but I have to admit it is less clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think fully qualified is preferred :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll rename the class then thank you !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javiereguiluz agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still no consensus about how the class should be named ? @fabpot @nicolas-grekas @xabbuh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I'd like to finish this PR, how should I name the class ? TelType, TelephoneType, PhoneType etc ? @symfony/deciders @fabpot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either way no blocker for me :) i understand we just want type="tel" one way or another 👍 (my reasoning still stands though(.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should go with types that match the html types because that's we we tend to do instead of trying to name them based of the semantic of the field (CheckboxType
, TextareaType
, RangeType
are good examples of this).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ro0NL I think your reasoning was wrong here when stating this (about "tel"):
we should not name our class after an implementation detail
HTML5 is exactly the opposite to an implementation detail: it's a public interface, a standard, the tip of the iceberg. So we should definitely not seek to be more clever than the ppl who wrote it (we're not ;) ).
Looks good😀 |
Oops, I've just missed the review-comment by @ro0NL. Never mind this comment. |
my reasoning; tel === telephone, so TelephoneType is explicit/verbose. In my domain i'd also call this field |
*/ | ||
public function getParent() | ||
{ | ||
return __NAMESPACE__.'\TextType'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TextType::class
? (there is no reason not to use ::class
now that PHP >= 5.5.9 is required)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree but I would have to replace it in other classes too then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should only do this on new classes. We usually avoid doing changes on existing code when it doesn't fix anything nor doesn't really improve the situation, in order to avoid useless conflicts when the maintainers are merging lower branches to upper ones and interfering in git history.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ogizanagi Thank you for sharing this piece of information, I'll make the change !
Needs rebase to fix the conflict. (Let's keep |
@ogizanagi @fabpot rebased with 3.4 (sorry for the delay) |
@apetitpa Can you have a look at the tests, they seem to be broken by your changes. |
@fabpot It's done, it's green again. Travis 7.1 failing test will be fixed when merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with minor comment
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no other file in this directory has the license header, we should remove them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was suggested by fabbot, but I'll revert the changes ok
@nicolas-grekas It's done but I still have one concern regarding the name of the |
If HTML5 is fine with "tel", so am I. |
@nicolas-grekas Done, reverted to |
Thank you @apetitpa. |