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

[Yaml] Allow using _ in some numeric notations#18486

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
xabbuh merged 1 commit intosymfony:masterfromTaluu:yaml-integer-groups
May 14, 2016

Conversation

@Taluu
Copy link
Contributor

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

Allows to use the_ to group "big" ints, as suggested in the yaml integer type specification. As discussed in#18094, we should check if it is still part of the 1.2 specification, but I don't really see why not ? I can't see anywhere anything saying it is not valid anymore... as there are links to these types in some other specs.

This is#18096, but targetted on master as this is considered as a new feature. I also support the dump of such values as only strings. I think I should change how it is dumped thoug, and use the escape filter instead though (as I was misusing the data provider and it provided strange results at the time)

@fabpot
Copy link
Member

👍

case0 ===strpos($scalar,'!!float'):
return (float)substr($scalar,8);
casepreg_match('{^[+-]?[0-9][0-9_]*$}',$scalar):
$scalar =str_replace('_','', (string)$scalar);
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment saying that the fallthrough is intentional, to avoid mistakes in the future

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

will do as soon as i get my hands on my dev env

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

done

@stof
Copy link
Member

👍
Status: reviewed

@nicolas-grekas could you check why a test is failing when removing a folder ?

@nicolas-grekas
Copy link
Member

@stof this issue has already been fixed a few days ago hopefully

@dunglas
Copy link
Member

👍

@fabpot
Copy link
Member

Should be merged when master becomes 3.2.

returnself::evaluateBinaryScalar(substr($scalar,9));
casepreg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/',$scalar):
return (float)str_replace(',','',$scalar);
casepreg_match('/^(-|\+)?[0-9][0-9,_]*(\.[0-9_]+)?$/',$scalar):
Copy link
Member

Choose a reason for hiding this comment

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

This will support numbers mixing, and_. I am not convinced we should support that.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

IMO, removing, (which is not in the yaml spec AFAIK) would be a bc break, so that's why I kept it. Adding a deprecation is also not within the scope of this PR IMO

Copy link
Member

Choose a reason for hiding this comment

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

I agree that the deprecation should be added in a separate PR. But imo we should only support numbers here that contain either commas or underscores:

casepreg_match('/^(-|\+)?[0-9][0-9,]*(\.[0-9]+)?$/',$scalar):casepreg_match('/^(-|\+)?[0-9][0-9_]*(\.[0-9_]+)?$/',$scalar):// ...

In a new PR we can then add the deprecation trigger after the firstcase.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

OK, I can indeed split this case into two cases

Copy link
Member

Choose a reason for hiding this comment

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

Why? Isn't1_200,2_200 valid?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

If you're referring to float, isn't it1_200.2_200 ? Looking athttp://yaml.org/type/float.html, in the regexp there is no, in fact (while there is a_)

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I meant1_200.2_200

Copy link
ContributorAuthor

@TaluuTaluuApr 22, 2016
edited
Loading

Choose a reason for hiding this comment

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

So yes, we are keeping that, it is just the, that should be deprecated as it's nowhere in the yaml specs

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

This case was split as suggested

@xabbuh
Copy link
Member

👍

@xabbuh
Copy link
Member

Thank you@Taluu.

@xabbuhxabbuh merged commite6da11c intosymfony:masterMay 14, 2016
xabbuh added a commit that referenced this pull requestMay 14, 2016
This PR was merged into the 3.2-dev branch.Discussion----------[Yaml] Allow using _ in some numeric notations| Q             | A| ------------- | ---| Branch        | master| Bug fix?      | no ?| New feature?  | yes ?| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#18094| License       | MIT| Doc PR        | ~Allows to use the `_` to group "big" ints, as suggested in the yaml integer type specification. As discussed in#18094, we should check if it is still part of the 1.2 specification, but I don't really see why not ? I can't see anywhere anything saying it is not valid anymore... as there are links to these types in some other specs.This is#18096, but targetted on master as this is considered as a new feature. I also support the dump of such values as only strings. I think I should change how it is dumped thoug, and use the escape filter instead though (as I was misusing the data provider and it provided strange results at the time)Commits-------e6da11c [Yaml] Allow using _ in some numeric notations
@TaluuTaluu deleted the yaml-integer-groups branchOctober 19, 2016 15:53
@fabpotfabpot mentioned this pull requestOct 27, 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.

8 participants

@Taluu@fabpot@stof@nicolas-grekas@dunglas@xabbuh@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp