Skip to content

Commit

Permalink
corrections, overall fixes for psr-2, revert what method name to dete…
Browse files Browse the repository at this point in the history
…ct to `taskPid`, in `Kernel::await`
  • Loading branch information
TheTechsTech committed Oct 31, 2019
1 parent ea1364c commit 9f1a313
Show file tree
Hide file tree
Showing 14 changed files with 516 additions and 509 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ examples export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/appveyor.yml export-ignore
/CHANGELOG.md export-ignore
README.md export-ignore
Parallel.md export-ignore
MCC15-04.pdf export-ignore
n4024.pdf export-ignore
/_config.yml export-ignore
/phpunit.xml.dist export-ignore
/favicon.ico export-ignore
Expand Down
8 changes: 5 additions & 3 deletions Coroutine/AbstractCoroutine.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace Async\Coroutine;

abstract class AbstractCoroutine
{
protected $value;

public function __construct($value) {
public function __construct($value)
{
$this->value = $value;
}

public function getValue() {
public function getValue()
{
$value = $this->value;
$this->value = null;
return $value;
Expand Down
24 changes: 12 additions & 12 deletions Coroutine/Channel.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace Async\Coroutine;

Expand All @@ -19,38 +19,38 @@ class Channel
protected $coroutine = null;

private function __construct(TaskInterface $task, CoroutineInterface $coroutine)
{
{
$this->task = $task;
$this->coroutine = $coroutine;
}

/**
* Creates an Channel similar to Google's Go language
*
* @return object
*/
/**
* Creates an Channel similar to Google's Go language
*
* @return object
*/
public static function make(TaskInterface $task, CoroutineInterface $coroutine)
{
{
return new self($task, $coroutine);
}

public function receiver(int $id)
{
{
$this->targetTaskId = $id;
}

public function receiverId(): int
{
{
return $this->targetTaskId;
}

public function senderTask(): TaskInterface
{
{
return $this->task;
}

public function receive()
{
{
$received = yield;
yield Coroutine::value($received);
}
Expand Down
Loading

0 comments on commit 9f1a313

Please sign in to comment.