11<?php
22
3- declare(strict_types=1);
4-
53namespace parallel;
64
7- /** @template T */
5+ /**
6+ * @template T
7+ */
88final class Channel
99{
1010 /**
@@ -18,80 +18,65 @@ final class Channel
1818 * Shall make an anonymous unbuffered channel
1919 * Shall make an anonymous buffered channel with the given capacity
2020 *
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
2222 */
23- public function __construct(int|null $capacity = null)
24- {
25- }
23+ public function __construct(?int $capacity = null) {}
2624
2725 /* Access */
2826
2927 /**
3028 * Shall make an unbuffered channel with the given name
3129 * Shall make a buffered channel with the given name and capacity
3230 *
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
3533 *
3634 * @return Channel<T>
3735 *
3836 * @throws Channel\Error\Existence if channel already exists.
3937 */
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 {}
4339
4440 /**
4541 * Shall open the channel with the given name
4642 *
43+ * @param string $name
4744 * @return Channel<T>
4845 *
4946 * @throws Channel\Error\Existence if channel does not exist.
5047 */
51- public static function open(string $name): Channel
52- {
53- }
48+ public static function open(string $name): Channel {}
5449
5550 /* Sharing */
5651
5752 /**
5853 * Shall send the given value on this channel
59- *
6054 * @param T $value
6155 *
6256 * @throws Channel\Error\Closed if channel is closed.
6357 * @throws Channel\Error\IllegalValue if value is illegal.
6458 */
65- public function send($value): void
66- {
67- }
59+ public function send($value): void {}
6860
6961 /**
7062 * Shall recv a value from this channel
71- *
7263 * @return T
7364 *
7465 * @throws Channel\Error\Closed if channel is closed.
7566 */
76- public function recv()
77- {
78- }
67+ public function recv() {}
7968
8069 /* Closing */
8170
8271 /**
8372 * Shall close this channel
84- *
8573 * @throws Channel\Error\Closed if channel is closed.
8674 */
87- public function close(): void
88- {
89- }
75+ public function close(): void {}
9076
9177 /**
9278 * Returns name of channel
79+ * @return string
9380 */
94- public function __toString(): string
95- {
96- }
81+ public function __toString(): string {}
9782}
0 commit comments