File tree Expand file tree Collapse file tree 2 files changed +1
-39
lines changed Expand file tree Collapse file tree 2 files changed +1
-39
lines changed Original file line number Diff line number Diff line change @@ -108,32 +108,10 @@ public function create(string $input): iterable
108
108
}
109
109
}
110
110
111
- /**
112
- * Creates a message by its type and parameters.
113
- *
114
- * @template T of HasMethodInterface
115
- *
116
- * @param class-string<T> $messageType
117
- * @param RequestData $data
118
- *
119
- * @return T
120
- */
121
- public function createByType (string $ messageType , array $ data ): HasMethodInterface
122
- {
123
- if (\in_array ($ messageType , $ this ->registeredMessages , true )) {
124
- $ data ['jsonrpc ' ] = MessageInterface::JSONRPC_VERSION ;
125
- $ data ['method ' ] = $ messageType ::getMethod ();
126
-
127
- return $ messageType ::fromArray ($ data );
128
- }
129
-
130
- throw new InvalidArgumentException (\sprintf ('Message type "%s" is not registered. ' , $ messageType ));
131
- }
132
-
133
111
/**
134
112
* @return class-string<HasMethodInterface>
135
113
*/
136
- private function getType (string $ method ): string
114
+ private function getType (string $ method/**/ ): string
137
115
{
138
116
foreach (self ::REGISTERED_MESSAGES as $ type ) {
139
117
if ($ type ::getMethod () === $ method ) {
Original file line number Diff line number Diff line change @@ -82,22 +82,6 @@ public function testBatchMissingMethod()
82
82
$ this ->assertInstanceOf (InitializedNotification::class, $ result );
83
83
}
84
84
85
- public function testCreateByType (): void
86
- {
87
- $ result = $ this ->factory ->createByType (InitializedNotification::class, []);
88
- $ this ->assertInstanceOf (InitializedNotification::class, $ result );
89
- }
90
-
91
- public function testCreateByTypeWithMissingData (): void
92
- {
93
- $ this ->expectException (InvalidArgumentException::class);
94
- $ this ->expectExceptionMessage (
95
- 'Invalid or missing "requestId" parameter for "notifications/cancelled" notification. '
96
- );
97
-
98
- $ this ->factory ->createByType (CancelledNotification::class, []);
99
- }
100
-
101
85
/**
102
86
* @param iterable<mixed> $items
103
87
*/
You can’t perform that action at this time.
0 commit comments