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

Console table cleanup#19406

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

Closed
ReenExe wants to merge8 commits intosymfony:masterfromReenExeContributor:console-table-cleanup
Closed

Console table cleanup#19406

ReenExe wants to merge8 commits intosymfony:masterfromReenExeContributor:console-table-cleanup

Conversation

@ReenExe
Copy link
Contributor

@ReenExeReenExe commentedJul 22, 2016
edited
Loading

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

if (!self::$styles[$name]) {
thrownewInvalidArgumentException(sprintf('Style "%s" is not defined.',$name));
if (isset(self::$styles[$name])) {
returnself::$styles[$name];
Copy link
Member

Choose a reason for hiding this comment

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

What is the advantage of this change?

Copy link
ContributorAuthor

@ReenExeReenExeJul 23, 2016
edited
Loading

Choose a reason for hiding this comment

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

$array = ['default' =>newTableStyle(),];if (!$array['name']) {}// undefined offset 'name'

Choose a reason for hiding this comment

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

I'd keep the original order: throw, then return, which means changing this line to
if (empty(self::$styles[$name])) { (usingempty() to keep throwing when defined but value is== false)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

@ReenExe did you forget to push?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@nicolas-grekas, now good? Or need change?
Sorry, hard understand what need change after last comment

Choose a reason for hiding this comment

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

yes, needs change to me

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@nicolas-grekas, need addreviewed label?

Choose a reason for hiding this comment

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

but I don't see any change on the discussed line/code block, did you forget to push?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, is my mistake
i extract method toresolveStyle

if ($nameinstanceof TableStyle) {return$name;        }if (isset(self::$styles[$name])) {returnself::$styles[$name];        }thrownewInvalidArgumentException(sprintf('Style "%s" is not defined.',$name));

And ingetStyleDefinition change

if (!self::$styles[$name]) {thrownewInvalidArgumentException(sprintf('Style "%s" is not defined.',$name));        }returnself::$styles[$name];

to

if (isset(self::$styles[$name])) {returnself::$styles[$name];        }thrownewInvalidArgumentException(sprintf('Style "%s" is not defined.',$name));

But after review need changes to:

if (empty(self::$styles[$name])) {thrownewInvalidArgumentException(sprintf('Style "%s" is not defined.',$name));        }returnself::$styles[$name];

So a think must be same code - and make same changes in both places

}

/**
* @expectedException \InvalidArgumentException
Copy link
Member

@nicolas-grekasnicolas-grekasJul 28, 2016
edited
Loading

Choose a reason for hiding this comment

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

\Symfony\Component\Console\Exception\InvalidArgumentException

@nicolas-grekas
Copy link
Member

👍

}

if (!self::$styles[$name]) {
if (empty(self::$styles[$name])) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not usingisset() here?

Choose a reason for hiding this comment

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

By my suggestion: using isset would be written as:
if (isset(self::$styles[$name]) && !self::$styles[$name]) {
which happens to be exactly whatempty() does.

Copy link
Member

Choose a reason for hiding this comment

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

When can the style be falsy?

Choose a reason for hiding this comment

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

I don't know :)

Copy link
Member

Choose a reason for hiding this comment

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

Reading the code, it looks like it is defined with an object or not defined at all. So, I think we should keepisset() as before in the newresolveStyle() method and change this one to useisset() as well. Whenever possible, I tend to avoid usingempty().

Copy link
ContributorAuthor

@ReenExeReenExeJul 28, 2016
edited
Loading

Choose a reason for hiding this comment

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

@fabpot, before little change - what prefer?
1

if ($nameinstanceof TableStyle) {return$name;        }if (!isset(self::$styles[$name])) {thrownewInvalidArgumentException(sprintf('Style "%s" is not defined.',$name));        }returnself::$styles[$name];

or
2:

if ($nameinstanceof TableStyle) {return$name;        }if (isset(self::$styles[$name])) {returnself::$styles[$name];        }thrownewInvalidArgumentException(sprintf('Style "%s" is not defined.',$name));

As for me is2

Copy link
Member

Choose a reason for hiding this comment

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

Ok for 2

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done

@fabpot
Copy link
Member

fabpot commentedJul 28, 2016
edited
Loading

LGTM now. Can you submit another PR for Symfony 2.7 (keep this one open as it's going to be merged as well for more recent versions of Symfony)?

@ReenExe
Copy link
ContributorAuthor

ReenExe commentedJul 28, 2016
edited
Loading

@fabpot, try with cherry-pick but have conflicts. Can i make new PR in 2.7 (arm move changes) and close this PR?

@ReenExe
Copy link
ContributorAuthor

ReenExe commentedJul 28, 2016
edited
Loading

Also in 2.7

  1. abcent methodTable::setColumnStyle
  2. Use\InvalidArgumentException instead\Symfony\...\InvalidArgumentException

@nicolas-grekas
Copy link
Member

you should close this one yes, then open a new one against 2.7, then if you'd like another one against the first branch where setColumnStyle exists (and so on).

@fabpot
Copy link
Member

No, please, don't close this one.@ReenExe You are right, that's why I need a specific PR for 2.7. This one will still be merged for the additional changes. Thanks.

@fabpotfabpot closed thisJul 28, 2016
@fabpotfabpot reopened thisJul 28, 2016
@ReenExe
Copy link
ContributorAuthor

ReenExe commentedJul 28, 2016
edited
Loading

@fabpot, i will try, but conflict stay between branches - it's normal?
In next time first changes make to 2.7 and next in master? (maybe miss some manual from Contributing)

@fabpot
Copy link
Member

Just submit a PR on 2.7 and I will take care of merge conflict myself.

@ReenExe
Copy link
ContributorAuthor

Make new PR - thats only covers bugfix#19470

@ReenExe
Copy link
ContributorAuthor

@fabpot, i see this after try submit (make my branch frommaster)
first-symfony-pr-conflict

fabpot pushed a commit that referenced this pull requestJul 28, 2016
fabpot added a commit that referenced this pull requestJul 28, 2016
This PR was squashed before being merged into the 2.7 branch (closes#19470).Discussion----------undefined offset fix (#19406)| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Commits-------9813888 undefined offset fix (#19406)
fabpot added a commit that referenced this pull requestJul 28, 2016
* 2.7:  undefined offset fix (#19406)  [EventDispatcher] Removed unused variable
@fabpot
Copy link
Member

Thank you@ReenExe.

fabpot added a commit that referenced this pull requestJul 28, 2016
This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes#19406).Discussion----------Console table cleanup| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes `notice`| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Commits-------217274b Console table cleanup
@fabpotfabpot closed thisJul 28, 2016
fabpot added a commit that referenced this pull requestJul 30, 2016
* 2.8:  Minor fixes  [Console] Overcomplete argument exception message tweak.  fixed bad auto merge  Console table cleanup  undefined offset fix (#19406)  [EventDispatcher] Removed unused variable
fabpot added a commit that referenced this pull requestJul 30, 2016
* 3.0:  Minor fixes  [Console] Overcomplete argument exception message tweak.  fixed bad auto merge  Console table cleanup  undefined offset fix (#19406)  [EventDispatcher] Removed unused variable
fabpot added a commit that referenced this pull requestJul 30, 2016
* 3.1:  Minor fixes  [Cache] Fix abstract AdapterTestCase cache property  [Console] Overcomplete argument exception message tweak.  fixed bad auto merge  Console table cleanup  undefined offset fix (#19406)  [EventDispatcher] Removed unused variable
This was referencedJul 30, 2016
nicolas-grekas added a commit that referenced this pull requestAug 5, 2016
* 2.8:  Relax 1 test failing with latest PHP versions  bumped Symfony version to 2.8.10  Remove usage of __CLASS__ outside of a class  [HttpKernel] Fix variable conflicting name  [Process] Fix double-fread() when reading unix pipes  [Process] Fix AbstractPipes::write() for a situation seen on HHVM (at least)  [Validator] Fix dockblock typehint in XmlFileLoader  bumped Symfony version to 2.8.10  updated VERSION for 2.8.9  updated CHANGELOG for 2.8.9  bumped Symfony version to 2.7.17  updated VERSION for 2.7.16  update CONTRIBUTORS for 2.7.16  updated CHANGELOG for 2.7.16  Minor fixes  [Console] Overcomplete argument exception message tweak.  fixed bad auto merge  Console table cleanup  undefined offset fix (#19406)  [EventDispatcher] Removed unused variableConflicts:CHANGELOG-2.7.mdCHANGELOG-3.0.mdsrc/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.phpsrc/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.phpsrc/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.phpsrc/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.phpsrc/Symfony/Component/Console/Tests/Helper/TableTest.phpsrc/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container9.phpsrc/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.phpsrc/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.phpsrc/Symfony/Component/HttpKernel/Kernel.php
@fabpotfabpot mentioned this pull requestSep 3, 2016
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.

6 participants

@ReenExe@nicolas-grekas@fabpot@sstok@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp