1
1
<?php
2
2
3
- declare(strict_types=1);
4
-
5
3
namespace parallel;
6
4
7
- /** @template T */
5
+ /**
6
+ * @template T
7
+ */
8
8
final class Channel
9
9
{
10
10
/**
@@ -18,80 +18,65 @@ final class Channel
18
18
* Shall make an anonymous unbuffered channel
19
19
* Shall make an anonymous buffered channel with the given capacity
20
20
*
21
- * @param int| null $capacity May be Channel::Infinite or a positive integer
21
+ * @param null|int $capacity May be Channel::Infinite or a positive integer
22
22
*/
23
- public function __construct(int|null $capacity = null)
24
- {
25
- }
23
+ public function __construct(?int $capacity = null) {}
26
24
27
25
/* Access */
28
26
29
27
/**
30
28
* Shall make an unbuffered channel with the given name
31
29
* Shall make a buffered channel with the given name and capacity
32
30
*
33
- * @param string $name The name of the channel.
34
- * @param int| null $capacity May be Channel::Infinite or a positive integer
31
+ * @param string $name The name of the channel.
32
+ * @param null|int $capacity May be Channel::Infinite or a positive integer
35
33
*
36
34
* @return Channel<T>
37
35
*
38
36
* @throws Channel\Error\Existence if channel already exists.
39
37
*/
40
- public static function make(string $name, int|null $capacity = null): Channel
41
- {
42
- }
38
+ public static function make(string $name, ?int $capacity = null): Channel {}
43
39
44
40
/**
45
41
* Shall open the channel with the given name
46
42
*
43
+ * @param string $name
47
44
* @return Channel<T>
48
45
*
49
46
* @throws Channel\Error\Existence if channel does not exist.
50
47
*/
51
- public static function open(string $name): Channel
52
- {
53
- }
48
+ public static function open(string $name): Channel {}
54
49
55
50
/* Sharing */
56
51
57
52
/**
58
53
* Shall send the given value on this channel
59
- *
60
54
* @param T $value
61
55
*
62
56
* @throws Channel\Error\Closed if channel is closed.
63
57
* @throws Channel\Error\IllegalValue if value is illegal.
64
58
*/
65
- public function send($value): void
66
- {
67
- }
59
+ public function send($value): void {}
68
60
69
61
/**
70
62
* Shall recv a value from this channel
71
- *
72
63
* @return T
73
64
*
74
65
* @throws Channel\Error\Closed if channel is closed.
75
66
*/
76
- public function recv()
77
- {
78
- }
67
+ public function recv() {}
79
68
80
69
/* Closing */
81
70
82
71
/**
83
72
* Shall close this channel
84
- *
85
73
* @throws Channel\Error\Closed if channel is closed.
86
74
*/
87
- public function close(): void
88
- {
89
- }
75
+ public function close(): void {}
90
76
91
77
/**
92
78
* Returns name of channel
79
+ * @return string
93
80
*/
94
- public function __toString(): string
95
- {
96
- }
81
+ public function __toString(): string {}
97
82
}
0 commit comments