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

[DI] FileLoaders: Allow to explicit type to load#20611

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:masterfromogizanagi:feature/dic/file_loaders_type
Jan 10, 2017
Merged

[DI] FileLoaders: Allow to explicit type to load#20611

fabpot merged 1 commit intosymfony:masterfromogizanagi:feature/dic/file_loaders_type
Jan 10, 2017

Conversation

@ogizanagi
Copy link
Contributor

@ogizanagiogizanagi commentedNov 23, 2016
edited
Loading

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

(fabbot will scream out regarding the PR fixtures)

Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

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

👍

returnfalse;
}

if (null !==$type &&'ini' ===$type) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would make these the final returns, ie.return 'ini' === $type;

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Indeed it's better 👍 Thanks.

@chalasr
Copy link
Member

👍

returntrue;
}

returnnull !==$type &&'ini' ===$type;
Copy link
Member

Choose a reason for hiding this comment

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

return 'ini' === $type; should be enough

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oops. Forgot to update after#20611 (comment)... Thanks.

Choose a reason for hiding this comment

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

Shouldn't we checktype first? If I set this option explicitly, I expect it to have top priority:

publicfunctionsupports($resource,$type =null){if (!is_string($resource)) {returnfalse;    }return'ini' ===$type ||'ini' ===pathinfo($resource,PATHINFO_EXTENSION);}

Copy link
Member

Choose a reason for hiding this comment

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

@javiereguiluz the extension is checked only when the type is null. So there is no question of priority

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

the type will have priority if explicitly provided with current implementation, as the above condition has anull === $type check.

The difference with your snippet is that the loader won't returntrue in case the type was explicitly provided, but notini and the extension isini (another loader should try)

Copy link
Member

@javiereguiluzjaviereguiluzJan 10, 2017
edited
Loading

Choose a reason for hiding this comment

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

the loader won't return true in case the type was explicitly provided, but not ini and the extension is ini (another loader should try)

@ogizanagi in that case, this code will be: ...
Maybe I'm missing something here.

updated: I see my mistake now. Thanks!

@stof maybe "priority" is not the best word, but the new behavior is:"do whatever "type" tells you ... if it doesn't tell you anything, fall back to the file extension".

ogizanagi reacted with laugh emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

What I meant is calling:

  1. supports('services.ini, 'ini') should returntrue
  2. supports('services.foo, 'ini') should returntrue
  3. supports('services.ini, 'yaml') should returnfalse

The third case will be erroneous with your suggestion.

@stof
Copy link
Member

This is a new feature IMO, not a bugfix (we never said thattype: yml was intended to trigger the YAML loader, so we cannot consider this behavior as buggy)

@xabbuh
Copy link
Member

@stof The PR is already labelled as a feature and is based on themaster branch. :)

@nicolas-grekasnicolas-grekas added this to the3.x milestoneDec 6, 2016
returntrue;
}

returnnull !==$type &&'php' ===$type;
Copy link
Member

Choose a reason for hiding this comment

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

null !== $type should be removed in all loaders. It is useless as the condition'php' === $type already ensures is is not null

Copy link
ContributorAuthor

@ogizanagiogizanagiJan 10, 2017
edited
Loading

Choose a reason for hiding this comment

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

Don't know what happened here, I'm pretty sure I fixed this a long time ago... Thanks.

@javiereguiluz
Copy link
Member

👍

Status: reviewed

@fabpot
Copy link
Member

Thank you@ogizanagi.

@fabpotfabpot merged commit6b660c2 intosymfony:masterJan 10, 2017
fabpot added a commit that referenced this pull requestJan 10, 2017
…anagi)This PR was merged into the 3.3-dev branch.Discussion----------[DI] FileLoaders: Allow to explicit type to load| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#20308| License       | MIT| Doc PR        | Not yet(fabbot will scream out regarding the PR fixtures)Commits-------6b660c2 [DI] FileLoaders: Allow to explicit type to load
@ogizanagiogizanagi deleted the feature/dic/file_loaders_type branchJanuary 10, 2017 17:56
@nicolas-grekasnicolas-grekas modified the milestones:3.x,3.3Mar 24, 2017
@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

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@stofstofstof left review comments

@xabbuhxabbuhxabbuh left review comments

+1 more reviewer

@ro0NLro0NLro0NL left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

9 participants

@ogizanagi@chalasr@stof@xabbuh@javiereguiluz@fabpot@ro0NL@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp