-
-
Notifications
You must be signed in to change notification settings - Fork 38
Use array access, and remove unnecessary double error from array lookup
#25
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jsor
merged 2 commits into
reactphp:master
from
WyriHaximus-labs:handle-child-process-error
Jun 18, 2018
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| <?php | ||
|
|
||
| namespace React\Tests\Filesystem\ChildProcess; | ||
|
|
||
| use Evenement\EventEmitter; | ||
| use React\EventLoop\LoopInterface; | ||
| use React\Promise\FulfilledPromise; | ||
| use React\Promise\RejectedPromise; | ||
| use WyriHaximus\React\ChildProcess\Messenger\Messages\Message; | ||
| use WyriHaximus\React\ChildProcess\Messenger\Messages\Rpc; | ||
| use WyriHaximus\React\ChildProcess\Pool\PoolInterface; | ||
| use WyriHaximus\React\ChildProcess\Pool\ProcessCollectionInterface; | ||
|
|
||
| final class PoolRpcErrorMock extends EventEmitter implements PoolInterface | ||
| { | ||
| public function __construct(ProcessCollectionInterface $processCollection, LoopInterface $loop, array $options = []) | ||
| { | ||
| // void | ||
| } | ||
|
|
||
| public function rpc(Rpc $message) | ||
| { | ||
| return new RejectedPromise([ | ||
| 'error' => [ | ||
| 'message' => 'oops', | ||
| ], | ||
| ]); | ||
| } | ||
|
|
||
| public function message(Message $message) | ||
| { | ||
| return new FulfilledPromise(); | ||
| } | ||
|
|
||
| public function terminate(Message $message, $timeout = 5, $signal = null) | ||
| { | ||
| return new FulfilledPromise(); | ||
| } | ||
|
|
||
| public function info() | ||
| { | ||
| return []; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?php | ||
|
|
||
| namespace React\Tests\Filesystem\ChildProcess; | ||
|
|
||
| use React\ChildProcess\Process; | ||
| use React\EventLoop\Factory; | ||
| use React\EventLoop\LoopInterface; | ||
| use React\Promise\FulfilledPromise; | ||
| use WyriHaximus\React\ChildProcess\Pool\PoolFactoryInterface; | ||
| use WyriHaximus\React\ChildProcess\Pool\ProcessCollection\Single; | ||
|
|
||
| final class PoolRpcErrorMockFactory implements PoolFactoryInterface | ||
| { | ||
| public static function create(Process $childProcess, LoopInterface $loop, array $options = []) | ||
| { | ||
| return new FulfilledPromise(new PoolRpcErrorMock( | ||
| new Single(function () {}), | ||
| Factory::create(), | ||
| [] | ||
| )); | ||
| } | ||
|
|
||
| public static function createFromClass($class, LoopInterface $loop, array $options = []) | ||
| { | ||
| return new FulfilledPromise(new PoolRpcErrorMock( | ||
| new Single(function () {}), | ||
| Factory::create(), | ||
| [] | ||
| )); | ||
| } | ||
|
|
||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title suggests there must be a way to verify this is "the correct way"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah using array access and ditching the extra
errorindex solve the errors.(Also updated the title.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this tested or can we add some tests for this? 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test for this 👍