Skip to content

[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

Closed
wants to merge 11 commits into from
Closed

[Form] Add tel and color types #22679

wants to merge 11 commits into from

Conversation

apetitpa
Copy link

@apetitpa apetitpa commented May 9, 2017

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)
Copy link
Member

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.

Copy link
Author

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>
Copy link
Contributor

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.

Copy link
Author

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
Copy link
Contributor

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 🤔

Copy link
Author

@apetitpa apetitpa May 9, 2017

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

Copy link
Contributor

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 :)

Copy link
Author

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 !

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

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

Copy link
Author

@apetitpa apetitpa Sep 21, 2017

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

Copy link
Contributor

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(.

Copy link
Contributor

@jvasseur jvasseur Sep 21, 2017

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).

Copy link
Member

@nicolas-grekas nicolas-grekas Oct 2, 2017

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 ;) ).

@issei-m
Copy link
Contributor

issei-m commented May 9, 2017

Looks good😀
btw would "TelephoneType" be better to be named "TelType" in accordance with type-name of html5 tag? (I'm not familiar with English, so not sure the abbr like "tel" is common used though.)

@issei-m
Copy link
Contributor

issei-m commented May 9, 2017

would "TelephoneType" be better to be named "TelType" in accordance with type-name of html5 tag?

Oops, I've just missed the review-comment by @ro0NL. Never mind this comment.

@ro0NL
Copy link
Contributor

ro0NL commented May 9, 2017

my reasoning; tel === telephone, so TelephoneType is explicit/verbose. In my domain i'd also call this field $user->telephone, not $user->tel.

*/
public function getParent()
{
return __NAMESPACE__.'\TextType';
Copy link
Contributor

@ogizanagi ogizanagi May 9, 2017

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)

Copy link
Author

@apetitpa apetitpa May 9, 2017

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 ?

Copy link
Contributor

@ogizanagi ogizanagi May 9, 2017

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.

Copy link
Author

@apetitpa apetitpa May 9, 2017

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 !

@lyrixx lyrixx changed the title [Form] Add tel and color types [Form] Add telephone and color types May 11, 2017
@nicolas-grekas nicolas-grekas changed the base branch from master to 3.4 May 23, 2017 16:54
@ogizanagi
Copy link
Contributor

ogizanagi commented Sep 21, 2017

Needs rebase to fix the conflict. (Let's keep TelephoneType btw, in case there is still debate)

@apetitpa
Copy link
Author

apetitpa commented Oct 1, 2017

@ogizanagi @fabpot rebased with 3.4 (sorry for the delay)

@fabpot
Copy link
Member

fabpot commented Oct 1, 2017

@apetitpa Can you have a look at the tests, they seem to be broken by your changes.

@apetitpa
Copy link
Author

apetitpa commented Oct 2, 2017

@fabpot It's done, it's green again. Travis 7.1 failing test will be fixed when merging.

Copy link
Member

@nicolas-grekas nicolas-grekas left a 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.
Copy link
Member

@nicolas-grekas nicolas-grekas Oct 2, 2017

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

Copy link
Author

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

@apetitpa
Copy link
Author

apetitpa commented Oct 2, 2017

@nicolas-grekas It's done but I still have one concern regarding the name of the TelephoneType class. Should we keep this name or use the original suggested name which was TelType as the HTML input type

@nicolas-grekas
Copy link
Member

If HTML5 is fine with "tel", so am I.

@apetitpa apetitpa changed the title [Form] Add telephone and color types [Form] Add tel and color types Oct 2, 2017
@apetitpa
Copy link
Author

apetitpa commented Oct 2, 2017

@nicolas-grekas Done, reverted to TelType as agreed

@nicolas-grekas
Copy link
Member

Thank you @apetitpa.

@apetitpa apetitpa deleted the add-form-types branch October 2, 2017 22:21
This was referenced Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.