Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use class constant in validators #17420

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 1 commit into from
Closed

Use class constant in validators #17420

wants to merge 1 commit into from

Conversation

Koc
Copy link
Contributor

@Koc Koc commented Jan 18, 2016

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

@Koc
Copy link
Contributor Author

Koc commented Jan 18, 2016

should I replace everywhere string class names with constant?

@Tobion
Copy link
Contributor

Tobion commented Jan 18, 2016

See #16666, #16648 etc

@Tobion
Copy link
Contributor

Tobion commented Jan 18, 2016

@symfony/deciders I would propose to accept ::class usage at places that developers are often facing and that are often used as template for new code. This eliminates alot of those PRs, makes code more readable and better exposes best practices. One of those places is FormFactoryInterface as people should use create($type = FormType::class) instead of create($type = 'Symfony\Component\Form\Extension\Core\Type\FormType') anyway according to our doc. So it would be strange if the Form component doesn't follow it's own best practices. The change proposed here is also one of those cases that should be accepted as it will be used for custom validators.

Those interfaces and classes are not changing often anyway. But we should avoid doing those changes in test files as it's more a pain to merge things and keep things consistent. We add tests often in 2.3 where ::class cannot be used and thus it would be too painful to change that in 3.0 again and again.

@fabpot
Copy link
Member

fabpot commented Jan 25, 2016

I don't see why it would be a "best practice". The result is exactly the same and as demonstrated by this PR, the gain in terms of readability is very minimal. Being the one who merge branches the most, I'm 👎 for this change.

@Koc
Copy link
Contributor Author

Koc commented Jan 25, 2016

@fabpot find usages support in IDE and ctrl+click are good additions.

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.

4 participants