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

[Routing] PhpDumper should follow coding standards#20082

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
c960657 wants to merge1 commit intosymfony:masterfromc960657:dumper-cs

Conversation

@c960657
Copy link
Contributor

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

While working on#19562 I noticed that Fabbot does not like the PHP code generated by thePhpGeneratorDumper andPhpMatcherDumper.

This patch makes the generated code comply with Symfony's conding standards.

javiereguiluz reacted with thumbs up emoji
@ro0NL
Copy link
Contributor

Im not sure this is a real issue... imo. codestyle doesnt really apply to generated code anyway.

@c960657c960657force-pushed thedumper-cs branch 2 times, most recently from2d9a0e6 to7cf4772CompareSeptember 28, 2016 21:26
@javiereguiluz
Copy link
Member

I'm 👍

I know that these generated files are critical and we shouldn't mess with them; these files are generated for computers, not humans; etc. But the proposed changes look safe and Symfony is a project that should strive for top quality in everything it does, like generating these files.

@linaori
Copy link
Contributor

We'll always be 1 step behind of the codestyle of those files. If it's really important to have them properly formatted, it should be using an up-to-date code formatter (php-cs-fixer?). Imo if readability of generated files is really an issue, I'd rather see them being formated on 1 line and use your IDE or a custom cs fixer on demand when required.

ro0NL reacted with thumbs up emojijaviereguiluz reacted with thumbs down emoji


protectedfunctionexportArray($array)
{
returnpreg_replace(array('/array \(/','/,\n *\)/','/,\n */','/\n */'),array('array(',')',',',''),var_export($array,true));

Choose a reason for hiding this comment

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

there is a risk of collision with the content of a string here, CS is not worth it imho

sstok and ro0NL reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

You are right. I thought I had this covered, but I must have missed something (I wrote this code a while back, so I don't remember my reasoning).

I cannot think of an easy way to fix this, so I think I'll just close this PR.

BTW the existing code simply strips newlines – this is also not completely kosher, but it might be enough for the specific arrays in question.


protectedfunctionexportArray($array)
{
returnpreg_replace(array('/array \(/','/,\n *\)/','/,\n */','/\n */'),array('array(',')',',',''),var_export($array,true));

Choose a reason for hiding this comment

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

collision risk again?

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

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@c960657@ro0NL@javiereguiluz@linaori@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp