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] Remove unreachable code#25158

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:3.4fromGwendolenLynch:di-uninit-ref
Nov 26, 2017
Merged

[DI] Remove unreachable code#25158

fabpot merged 1 commit intosymfony:3.4fromGwendolenLynch:di-uninit-ref
Nov 26, 2017

Conversation

@GwendolenLynch
Copy link
Contributor

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

#24033 added the ability to ignore uninitialized references, but the regex above the conditional would lead to anInvalidArgumentException being thrown.

@GwendolenLynch
Copy link
ContributorAuthor

@nicolas-grekas I am scratching my head on all the test fails here, they pass locally under the same PHP versions. Hints welcome 😄

@nicolas-grekas
Copy link
Member

What's the use case? Can't you use an iterator instead? The downside is that this would be a Symfony specific syntax, whereas I'm aiming at making this function a PSR, so that I'd prefer handling only things that might be accepted by the FIG...

@GwendolenLynch
Copy link
ContributorAuthor

Zero stress, happy to close off.

In that case, doesn't it make this dead code then:

}elseif ($optionalBehavior ='!' ===$type[0]) {
$type =substr($type,1);
$optionalBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE;
}

… as the regex will only allow? or a letter.

@nicolas-grekas
Copy link
Member

In that case, doesn't it make this dead code then:

correct! let's remove that :)

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneNov 26, 2017
@GwendolenLynch
Copy link
ContributorAuthor

No worries, I'll rebase and change direction 👍

@nicolas-grekasnicolas-grekas changed the title[DI] Add ! to regex check in service subscriber compiler[DI] Remove unreachable codeNov 26, 2017

foreach ($class::getSubscribedServices()as$key =>$type) {
if (!is_string($type) || !preg_match('/^\??[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+$/',$type)) {
if (!is_string($type) || !preg_match('/^[\?!]?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+$/',$type)) {

Choose a reason for hiding this comment

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

should be reverted

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

🤦‍♂️

@fabpot
Copy link
Member

Thank you @GawainLynch.

GwendolenLynch reacted with thumbs up emoji

@fabpotfabpot merged commitced0857 intosymfony:3.4Nov 26, 2017
fabpot added a commit that referenced this pull requestNov 26, 2017
This PR was merged into the 3.4 branch.Discussion----------[DI] Remove unreachable code| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |#24033 added the ability to ignore uninitialized references, but the regex above the conditional would lead to an `InvalidArgumentException` being thrown.Commits-------ced0857 Remove unreachable code
@GwendolenLynchGwendolenLynch deleted the di-uninit-ref branchNovember 26, 2017 15:55
This was referencedNov 30, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

5 participants

@GwendolenLynch@nicolas-grekas@fabpot@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp