Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix #17993 - Deprecated callable strings#18020

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromSimperfit:master
Apr 15, 2016

Conversation

@Simperfit
Copy link
Contributor

QA
Branchmaster
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?no
Fixed tickets#17993
LicenseMIT
Doc PR

Is this ok ?

@Simperfit
Copy link
ContributorAuthor

Thank you, I didn't understand the issue correctly.

I've changed my fix.


if (is_string($preferredChoices) && !is_callable($preferredChoices)) {
$preferredChoices =newPropertyPath($preferredChoices);
}elseif(is_string($preferredChoices) &&is_callable($preferredChoices)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

missing space after elseif

@HeahDude
Copy link
Contributor

Not on these methods for sure.

if (is_string($value) && !is_callable($value)) {
$value =newPropertyPath($value);
}elseif (is_string($value) &&is_callable($value)) {
@trigger_error('createListFromChoices() treats callable strings as callable and is deprecated since version 3.0.',E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

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

since version 3.1 (for now)

@HeahDude
Copy link
Contributor

You could perhaps wrap the callable string in a closure inside thoseelseif to prevent the fatal error.

elseif (is_string($label) &&is_callable($label)) {    @trigger_error('createView() - $label - treats callable strings as callable and is deprecated since version 3.0.',E_USER_DEPRECATED);$label =function ($choice)use ($label) {return$label($choice);    };}

@Simperfit
Copy link
ContributorAuthor

I have no errors doing the tests except of one in PasswordEncoder.

Thanks@HeahDude for the help

if (is_string($value) && !is_callable($value)) {
$value =newPropertyPath($value);
}elseif (is_string($value) &&is_callable($value)) {
@trigger_error('createListFromChoices() treats callable strings as callable and is deprecated since version 3.1.',E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's deprecated, what's the recommended thing to do instead? What will happen in 4.0? Please add this to the deprecation messages (and upgrade guide)

Copy link
Contributor

Choose a reason for hiding this comment

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

@iltar is right. You should change each message to something like :

'Treating strings as callable is deprecated since version 3.1 and will throw an error in 4.0. You should use a "\Closure" instead.'

@HeahDude
Copy link
Contributor

I have no errors doing the tests except of one in PasswordEncoder.

What error are you talking about ?

@Simperfit
Copy link
ContributorAuthor

Nevermind, no error anymore

@fabpot
Copy link
Member

@Simperfit What about adding some unit tests?

@Simperfit
Copy link
ContributorAuthor

@fabpot I added one, will add one for each method

@xabbuh
Copy link
Member

Looks like this needs another rebase. It contains some unrelated changes.

Status: Needs work

@Simperfit
Copy link
ContributorAuthor

@xabbuh Sorry for the unrelated changes, I've missed my rebase.

return$value($choices);
};

return$value($choices);
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to do all the stuff beside triggering the deprecation? Shouldn't the following code already handle the callback properly?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I've followed the instruction of someone since I don't wanted to make bad things,
But you're right, adding the test without any code is the right thing to do.

Thanks

@SimperfitSimperfitforce-pushed themaster branch 4 times, most recently fromcd2bf8e to22f8264CompareMarch 7, 2016 19:20
@Simperfit
Copy link
ContributorAuthor

@fabpot I've added one test for each method, is it ok like that ? Thank you.

* Using callable strings as choice options in ChoiceType has been deprecated
in favor of`PropertyPath`. Use a "\Closure" instead

Before:
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok now you got one extra here

@Simperfit
Copy link
ContributorAuthor

I've rebased and added/removed the space :p

@SimperfitSimperfitforce-pushed themaster branch 2 times, most recently fromc3b996d to12975bdCompareApril 1, 2016 19:04
```php
'choice_value' => 'range',
'choice_label' => function ($choice) {
return strtoupper($choice);
Copy link
Contributor

Choose a reason for hiding this comment

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

You misunderstood the "four" space here mean four for this line only.

Now on got one extra space from line 23 to 37 and missing 3 here one 35 :p

Sorry, after that we're done, thank you for working on this PR :)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I hope this time it's ok :p

Np :)

-`"form.type.submit"`
-`"form.type.reset"`

`ArrayAccess` in`ResizeFormListener::preSubmit` method has been removed
Copy link
Contributor

Choose a reason for hiding this comment

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

to not conflict with master it must be before your change

ok just remove it

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

oops sorry

@HeahDude
Copy link
Contributor

Looks perfect now :) Thanks@Simperfit!

This one is ready to merge now.

Deprecate or revert470b140 ? ping@symfony/decoders

@Simperfit
Copy link
ContributorAuthor

ping@Tobion@fabpot@dunglas

`ArrayAccess` in`ResizeFormListener::preSubmit` method has been removed.

* Using callable strings as choice options in ChoiceType has been deprecated
in favor of`PropertyPath`. Use a "\Closure" instead
Copy link
Member

Choose a reason for hiding this comment

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

The sentence as is must be added to theUPGRADE-3.1.md file. In this file it should read like "Using callable strings as choice options in ChoiceType has been removed in favor of passingPropertyPath instances."

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
ContributorAuthor

Choose a reason for hiding this comment

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

is it ok like this@HeahDude@xabbuh ?

`ArrayAccess` in`ResizeFormListener::preSubmit` method has been removed.

* Using callable strings as choice options in ChoiceType has been removed in favor of passing PropertyPath instances.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would replace "has been removed" by "is not supported anymore".

But please wait for a symfony decider to tell you if it's ok. Thanks :)

Copy link
Member

Choose a reason for hiding this comment

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

You are right. That sounds a bit better.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

done :)

`ArrayAccess` in`ResizeFormListener::preSubmit` method

* Using callable strings as choice options in`ChoiceType` has been deprecated
and will be used as`PropertyPath` instead of callable in Symfony 4.0.
Copy link
Member

Choose a reason for hiding this comment

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

missing space at the beginning of the line

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@fabpot space added.

@Simperfit
Copy link
ContributorAuthor

i've rebased with master.
ping@fabpot@webmozart@Tobion

@fabpot
Copy link
Member

IIRC, we were waiting for@Tobion's opinion about merging or reverting instead.

@Tobion
Copy link
Contributor

I would revert but I'm ok with both ways.

@fabpot
Copy link
Member

Thank you@Simperfit.

@fabpotfabpot merged commit191b495 intosymfony:masterApr 15, 2016
fabpot added a commit that referenced this pull requestApr 15, 2016
This PR was merged into the 3.1-dev branch.Discussion----------fix#17993 - Deprecated callable strings| Q             | A| ------------- | ---| Branch        | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | no| Fixed tickets |#17993| License       | MIT| Doc PR        |Is this ok ?- [x] Rebase when#18057 is mergedCommits-------191b495fix#17993 - Deprecated callable strings
@Simperfit
Copy link
ContributorAuthor

NP@fabpot.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

10 participants

@Simperfit@HeahDude@fabpot@xabbuh@webmozart@Tobion@stof@linaori@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp