Skip to content
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

add const to all types #455

Merged
merged 1 commit into from
Nov 1, 2018

Conversation

hAz5
Copy link
Contributor

@hAz5 hAz5 commented Sep 19, 2018

Hello Kris
I create const in interface for Form class to easy to use fields and faster to found.
When I use this package I should check the uses field every time.
when we use const we don't need search any time for special field

this form is readable than origin Form Class:

class SongForm extends Form { public function buildForm() { $this ->add('name', Form::FIELD_TEXT) ->add('lyrics', Form::FIELD_TEXTAREA) ->add('publish', Form::FIELD_CHECKBOX); } }

@kristijanhusak
Copy link
Owner

I'd rather put this into a trait instead of an interface. Interface's purpose is not for this.

@hAz5
Copy link
Contributor Author

hAz5 commented Oct 30, 2018

thank you kris but trait can not have constants .if we should not use interface we must define constants in Form Class if you agree with me i send pull request agian.
thank you.

@kristijanhusak
Copy link
Owner

@Tresa02 oh, i didn't know traits cannot have constants, never tried it.
I don't like the idea of putting it in the form class. We could have it as a separate class, something like this:

class Field {
    const TEXT = 'text';
    const TEXTAREA = 'textarea';
}

and then just use it:

$this->add(Field::TEXT)->add(Field::TEXTAREA)

@hAz5
Copy link
Contributor Author

hAz5 commented Nov 1, 2018

i fixed it
tnx kris.

@kristijanhusak
Copy link
Owner

Thanks!

@kristijanhusak kristijanhusak merged commit bb332d7 into kristijanhusak:master Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants