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

Introduce signaled process specific exception class#25775

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

Conversation

@soullivaneuh
Copy link
Contributor

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#25768
LicenseMIT
Doc PRN/A

Introduced theProcessSignaledException class to properly catch signaled process errors.

I took benefit to refactor process exception with a newProcessRuntimeException class.

@soullivaneuh
Copy link
ContributorAuthor

soullivaneuh commentedJan 12, 2018
edited
Loading

The failing job does not seem to be related to my PR:https://travis-ci.org/symfony/symfony/jobs/328083230#L3297

class ProcessRuntimeException extends RuntimeException
{
/**
* @var Process

Choose a reason for hiding this comment

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

Do we need these PHPdoc now that we use type hints and return types?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Probably not, indeed.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Well, I maybe spoke to fast. The PHPdoc is for the property, not the constructor.

It could be remove fromgetProcess indeed, but I don't know for this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove it, the constructor already determines the type of this property. Your IDE will be able to detect this.

lyrixx and yceruto reacted with thumbs up emoji
@soullivaneuhsoullivaneuhforce-pushed thesignaled-process-exception branch 2 times, most recently from5ff9574 to21f8ac0CompareJanuary 12, 2018 14:22
@nicolas-grekasnicolas-grekas added this to the4.1 milestoneJan 16, 2018
/**
* @author Sullivan Senechal <soullivaneuh@gmail.com>
*/
class ProcessRuntimeException extends RuntimeException
Copy link
Member

@nicolas-grekasnicolas-grekasJan 16, 2018
edited
Loading

Choose a reason for hiding this comment

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

does this intermediate class make sense in terms of exception hierarchy?
I'm not sure it does - let's use a trait instead? (it should be@internal)

Copy link
Member

Choose a reason for hiding this comment

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

or even nothing at all, as the only shared code is thegetProcess method, which has no business logic. Importing the trait would be almost as big as writing the getter.

nicolas-grekas 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.

I did this to avoid code duplicate. But right, I'll revert this part.

@soullivaneuhsoullivaneuhforce-pushed thesignaled-process-exception branch 2 times, most recently from2b2cc07 tob899f51CompareJanuary 17, 2018 11:43
@soullivaneuh
Copy link
ContributorAuthor

@nicolas-grekas@stof I did the changes you requested.

{
$this->process = $process;

parent::__construct(sprintf(

Choose a reason for hiding this comment

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

Can you please put this call on one line? That's our CS :)

@soullivaneuhsoullivaneuhforce-pushed thesignaled-process-exception branch fromb899f51 toa8681e9CompareJanuary 22, 2018 13:45
@soullivaneuh
Copy link
ContributorAuthor

@nicolas-grekas done.

parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
}

public function getProcess()

Choose a reason for hiding this comment

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

missing return type, isn't it?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Well, I did a copy/paste fromProcessFailedException for that.

Plus, see this comment:#25775 (review)

I'm not sure I have to add it.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Or maybe are you talking about PHP7 return type?

Choose a reason for hiding this comment

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

yes, I meanpublic function getProcess(): Process, sorry for the confusion

soullivaneuh reacted with thumbs up emoji
@soullivaneuh
Copy link
ContributorAuthor

@nicolas-grekas Code updated.

@soullivaneuhsoullivaneuhforce-pushed thesignaled-process-exception branch froma8681e9 to18e7f43CompareJanuary 22, 2018 16:26
@soullivaneuhsoullivaneuhforce-pushed thesignaled-process-exception branch from18e7f43 to68adb3bCompareJanuary 22, 2018 16:26
@fabpot
Copy link
Member

Thank you@soullivaneuh.

@fabpotfabpot merged commit68adb3b intosymfony:masterJan 23, 2018
fabpot added a commit that referenced this pull requestJan 23, 2018
…oullivaneuh)This PR was merged into the 4.1-dev branch.Discussion----------Introduce signaled process specific exception class| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#25768| License       | MIT| Doc PR        | N/AIntroduced the `ProcessSignaledException` class to properly catch signaled process errors.I took benefit to refactor process exception with a new `ProcessRuntimeException` class.Commits-------68adb3b Introduce signaled process specific exception class
@soullivaneuhsoullivaneuh deleted the signaled-process-exception branchJanuary 23, 2018 09:36
@soullivaneuh
Copy link
ContributorAuthor

You are very welcomed@fabpot! 😉

@fabpotfabpot mentioned this pull requestMay 7, 2018
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

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+1 more reviewer

@linaorilinaorilinaori left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

7 participants

@soullivaneuh@fabpot@javiereguiluz@nicolas-grekas@stof@linaori@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp