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

[Form][OptionsResolver] Show deprecated options definition on debug:form command#27667

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:masterfromyceruto:debug_deprecated_options
Sep 4, 2018

Conversation

@yceruto
Copy link
Member

@ycerutoyceruto commentedJun 20, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Next move after#27277.

It will look like this:

Use--show-deprecated option to show form types with deprecated options (example):
debug_types_with_deprecated_options

Use--show-deprecated option to show deprecated options of the given form type (example):
debug_deprecated_options_from_type

Deprecated option (example):
debug_deprecated_option_text

debug_deprecated_option_json

linaori, Koc, and yceruto reacted with thumbs up emojigeoffrey-brier reacted with heart emoji
@linaori
Copy link
Contributor

Will it be possible to use this command to findall form types that have a deprecated option, and see which of those options are deprecated per type? That would make fixing them a walk in the park!

@nicolas-grekasnicolas-grekas added this to thenext milestoneJun 21, 2018
@yceruto
Copy link
MemberAuthor

yceruto commentedJun 21, 2018
edited
Loading

@iltar sure, I'll add an option--show-deprecated to filter the result ondebug:form anddebug:form <type>.

Status: Needs Work

OskarStark reacted with thumbs up emoji

@ycerutoycerutoforce-pushed thedebug_deprecated_options branch 2 times, most recently from69cf93f to150c14dCompareJune 24, 2018 21:45
@yceruto
Copy link
MemberAuthor

Added--show-deprecated option to the comand:

Use the --show-deprecated option to display form types with deprecated options or the deprecated options of the given form type:

php %command.full_name% --show-deprecated
php %command.full_name% ChoiceType --show-deprecated

Status: Needs Review

(Travis failures aren't related)

@ycerutoycerutoforce-pushed thedebug_deprecated_options branch 2 times, most recently froma42dfa2 to64f444bCompareJuly 3, 2018 11:06
@yceruto
Copy link
MemberAuthor

Any update about this?

@ogizanagi you're working on this command in the past, so will be great to have your opinion on this! thanks. :)

@ogizanagiogizanagi self-requested a reviewJuly 7, 2018 16:36
Copy link
Contributor

@ogizanagiogizanagi left a comment

Choose a reason for hiding this comment

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

Makes sense. Thanks@yceruto for working on this!

/**
* @return string|\Closure
*
* @throws NoConfigurationException on no configured normalizer
Copy link
Contributor

Choose a reason for hiding this comment

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

on no configured deprecation

return$definition;
}

protectedfunctionfilterTypesByDeprecated(array$types):array
Copy link
Contributor

Choose a reason for hiding this comment

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

To be consistent with current code, should this rather live in the command and pass deprecated types & options to the descriptor as$options, so the descriptors' responsibility sticks to handling output?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I agree, but in that case should we to movecollectOptions(),getParentOptionsResolver(), etc, too?

Copy link
Contributor

@ogizanagiogizanagiJul 15, 2018
edited
Loading

Choose a reason for hiding this comment

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

I guess it's okay as we aim to describe OptionResolver and ResolvedFormTypeInterface instances. What is a bit weird here to me is injecting the form registry as an option.
But no strong opinion.

yceruto reacted with thumbs up emoji
Copy link
MemberAuthor

@ycerutoycerutoJul 15, 2018
edited
Loading

Choose a reason for hiding this comment

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

Okay, done.

for ($i =0;$i <$count; ++$i) {
$cells =array();
foreach (array_keys($headers)as$group) {
if (isset($options[$group][$i])) {
Copy link
Contributor

@ogizanagiogizanagiJul 15, 2018
edited
Loading

Choose a reason for hiding this comment

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

Could be simplified a bit I guess:

diff --git a/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.phpindex 1e63aa0c68..3702d2f6b1 100644--- a/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php+++ b/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php@@ -130,17 +130,12 @@ class TextDescriptor extends Descriptor         for ($i = 0; $i < $count; ++$i) {             $cells = array();             foreach (array_keys($headers) as $group) {-                if (isset($options[$group][$i])) {-                    $option = $options[$group][$i];--                    if (\is_string($option) && \in_array($option, $this->requiredOptions, true)) {-                        $option .= ' <info>(required)</info>';-                    }--                    $cells[] = $option;-                } else {-                    $cells[] = null;+                $option = $options[$group][$i] ?? null;+                if (\is_string($option) && \in_array($option, $this->requiredOptions, true)) {+                    $option .= ' <info>(required)</info>';                 }++                $cells[] = $option;             }             $tableRows[] = $cells;         }

@ycerutoycerutoforce-pushed thedebug_deprecated_options branch from64f444b tof02ee12CompareJuly 15, 2018 18:31
@yceruto
Copy link
MemberAuthor

yceruto commentedJul 15, 2018
edited
Loading

Thanks for the review@ogizanagi! I've fixed most comments. (AppVeyor & Travis failures are unrelated)

@ycerutoycerutoforce-pushed thedebug_deprecated_options branch 4 times, most recently from676e79d tocde4c4bCompareJuly 15, 2018 21:07
@ycerutoycerutoforce-pushed thedebug_deprecated_options branch 2 times, most recently fromb2cf002 to856578cCompareJuly 30, 2018 19:49
@yceruto
Copy link
MemberAuthor

Rebased and ready.

Copy link
Member

@fabpotfabpot 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 comments

->setDefinition(array(
newInputArgument('class', InputArgument::OPTIONAL,'The form type class'),
newInputArgument('option', InputArgument::OPTIONAL,'The form type option'),
newInputOption('show-deprecated',null, InputOption::VALUE_NONE,'Used to show deprecated options in form types'),
Copy link
Member

Choose a reason for hiding this comment

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

Display deprecated options in form types

<info>php %command.full_name% ChoiceType choice_value</info>
Use the <info>--show-deprecated</info> option to display form types with deprecated options or the deprecated options of the given form type:
Copy link
Member

Choose a reason for hiding this comment

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

Should be cut at around 80 chars

@ycerutoycerutoforce-pushed thedebug_deprecated_options branch from856578c to87c209dCompareSeptember 4, 2018 13:42
@yceruto
Copy link
MemberAuthor

@fabpot comments addressed, thanks! (AppVeyor failure is unrelated)

@fabpot
Copy link
Member

Thank you@yceruto.

@fabpotfabpot merged commit87c209d intosymfony:masterSep 4, 2018
fabpot added a commit that referenced this pull requestSep 4, 2018
…tion on debug:form command (yceruto)This PR was merged into the 4.2-dev branch.Discussion----------[Form][OptionsResolver] Show deprecated options definition on debug:form command| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Next move after#27277.It will look like this:Use `--show-deprecated` option to show form types with deprecated options (example):![debug_types_with_deprecated_options](https://user-images.githubusercontent.com/2028198/41823977-970c7c98-77d6-11e8-9e97-30dcedc316ac.png)Use `--show-deprecated` option to show deprecated options of the given form type (example):![debug_deprecated_options_from_type](https://user-images.githubusercontent.com/2028198/41823980-a4d6bd8e-77d6-11e8-95ed-39926ffd6235.png)Deprecated option (example):![debug_deprecated_option_text](https://user-images.githubusercontent.com/2028198/41689091-04e6b7dc-74bd-11e8-87d0-90729eac4bb3.png)![debug_deprecated_option_json](https://user-images.githubusercontent.com/2028198/41689105-142b5c5c-74bd-11e8-9232-1f30237bcf69.png)Commits-------87c209d Show deprecated options definition on debug:form command
@ycerutoyceruto deleted the debug_deprecated_options branchSeptember 4, 2018 15:29
@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
This was referencedNov 3, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@ogizanagiogizanagiogizanagi left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

6 participants

@yceruto@linaori@fabpot@ogizanagi@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp