File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434foreach ($ listener as $ notification ) {
3535 \printf (
3636 "Received notification from PID %d on channel '%s' with payload: %s \n" ,
37- $ notification ->getPid () ,
38- $ notification ->getChannel () ,
39- $ notification ->getPayload ()
37+ $ notification ->pid ,
38+ $ notification ->channel ,
39+ $ notification ->payload ,
4040 );
4141}
4242
Original file line number Diff line number Diff line change 55
66use Amp \Future ;
77use Amp \Postgres \PostgresConfig ;
8+ use Amp \Postgres \PostgresConnectionPool ;
89use Amp \Postgres \PostgresListener ;
910use Amp \Postgres \PostgresNotification ;
10- use Amp \Postgres \PostgresConnectionPool ;
1111use function Amp \async ;
1212use function Amp \delay ;
1313
5656 foreach ($ listener as $ notification ) {
5757 \printf (
5858 "Received notification from PID %d on channel '%s' with payload: %s \n" ,
59- $ notification ->getPid () ,
60- $ notification ->getChannel () ,
61- $ notification ->getPayload ()
59+ $ notification ->pid ,
60+ $ notification ->channel ,
61+ $ notification ->payload ,
6262 );
6363 }
6464};
Original file line number Diff line number Diff line change @@ -10,30 +10,9 @@ final class PostgresNotification
1010 * @param string $payload Message payload.
1111 */
1212 public function __construct (
13- private readonly string $ channel ,
14- private readonly int $ pid ,
15- private readonly string $ payload ,
13+ public readonly string $ channel ,
14+ public readonly int $ pid ,
15+ public readonly string $ payload ,
1616 ) {
1717 }
18-
19- /**
20- * @return non-empty-string
21- */
22- public function getChannel (): string
23- {
24- return $ this ->channel ;
25- }
26-
27- /**
28- * @return positive-int
29- */
30- public function getPid (): int
31- {
32- return $ this ->pid ;
33- }
34-
35- public function getPayload (): string
36- {
37- return $ this ->payload ;
38- }
3918}
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public function testListen()
5757
5858 /** @var PostgresNotification $notification */
5959 foreach ($ listener as $ notification ) {
60- $ this ->assertSame ($ notification ->getPayload () , (string ) $ count ++);
60+ $ this ->assertSame ($ notification ->payload , (string ) $ count ++);
6161 }
6262
6363 $ this ->assertSame (2 , $ count );
@@ -81,7 +81,7 @@ public function testNotify()
8181
8282 /** @var PostgresNotification $notification */
8383 foreach ($ listener as $ notification ) {
84- $ this ->assertSame ($ notification ->getPayload () , (string ) $ count ++);
84+ $ this ->assertSame ($ notification ->payload , (string ) $ count ++);
8585 }
8686
8787 $ this ->assertSame (2 , $ count );
You can’t perform that action at this time.
0 commit comments