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] Remove internal arguments from the api#21350

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

Conversation

@GuilhemN
Copy link
Contributor

@GuilhemNGuilhemN commentedJan 19, 2017
edited by xabbuh
Loading

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

Reopening of#21230 because of@xabbuh's comment.

This PR removes internal constructor arguments of theParser class.
This should break nothing as they are only used to build errors message and are clearly meant for internal uses.

This would allow to have a nicer api for#21194 (comment).

@fabpot
Copy link
Member

Can you rebase to get rid of the merge commit?

@GuilhemNGuilhemNforce-pushed theREMOVEINTERNALARGUMENTS branch from06706f2 to847fda8CompareJanuary 19, 2017 21:39
@GuilhemN
Copy link
ContributorAuthor

Sure, sorry.

@xabbuh
Copy link
Member

FYI, I have updated the "Deprecations?" row of the PR description to match the actual changes.

Copy link
Member

@xabbuhxabbuh left a comment

Choose a reason for hiding this comment

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

I just left some minor comments about the wording of the deprecation message. Otherwise, the changes look good to me.

$this->totalNumberOfLines =$totalNumberOfLines;
$this->skippedLineNumbers =$skippedLineNumbers;
if (func_num_args() >0) {
@trigger_error(sprintf('Constructor arguments $offset, $totalNumberOfLines, $skippedLineNumbers of %s are deprecated and will be removed in 4.0',self::class),E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

The constructor arguments [...]

GuilhemN reacted with thumbs up emoji
Yaml
----

* Constructor arguments`$offset`,`$totalNumberOfLines` and
Copy link
Member

Choose a reason for hiding this comment

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

The constructor arguments [...]

----

* Constructor arguments`$offset`,`$totalNumberOfLines` and
`$skippedLineNumbers` of`Parser` are deprecated and will be
Copy link
Member

Choose a reason for hiding this comment

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

[...] of theParser class [...]


* Duplicate mapping keys lead to a`ParseException`.

* Constructor arguments`$offset`,`$totalNumberOfLines` and
Copy link
Member

Choose a reason for hiding this comment

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

I would make the she changes as in the other upgrade file here too.

@javiereguiluz
Copy link
Member

👍 after the changes proposed by@xabbuh

$this->offset =$offset;
$this->totalNumberOfLines =$totalNumberOfLines;
$this->skippedLineNumbers =$skippedLineNumbers;
if (func_num_args() >0) {
Copy link
Contributor

@TaluuTaluuJan 20, 2017
edited
Loading

Choose a reason for hiding this comment

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

instead of having to do aif func > 0,if func_args > 1, ..., you can leave the optionnal parameters in the constructor (just undocument those) and just check iffunc_num_args > 0 to trigger the deprecation :

<?php$f =function ($a =null,$b =null,array$c =array()){var_dump(func_num_args());if (func_num_args() >0) {trigger();    }// ...}$f();// output 0, no deprecation$f(1);// output 1, deprecation// and so on

It's cleaner IMO (and less conditionnals too)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

But then they'll be automatically inserted by IDEs. Imo it is better to remove them to ensure people won't use deprecated arguments and only know it by executing the code.

@GuilhemNGuilhemNforce-pushed theREMOVEINTERNALARGUMENTS branch from847fda8 toe176c09CompareJanuary 20, 2017 18:18
@GuilhemN
Copy link
ContributorAuthor

@xabbuh I fixed your comments.

* @param int|null $totalNumberOfLines The overall number of lines being parsed
* @param int[] $skippedLineNumbers Number of comment lines that have been skipped by the parser
*/
publicfunction__construct($offset =0,$totalNumberOfLines =null,array$skippedLineNumbers =array())
Copy link
Member

Choose a reason for hiding this comment

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

If we usefunc_get_arg(), we should remove the arguments here.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

👍, i forgot to revert it.

@xabbuh
Copy link
Member

Thank you@GuilhemN.

GuilhemN reacted with hooray emoji

@GuilhemNGuilhemN deleted the REMOVEINTERNALARGUMENTS branchJanuary 21, 2017 07:51
@fabpotfabpot mentioned this pull requestMay 1, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@TaluuTaluuTaluu left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@GuilhemN@fabpot@xabbuh@javiereguiluz@Taluu@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp