Skip to content

Commit 2d2b84f

Browse files
committed
Remove unused method
1 parent 3019972 commit 2d2b84f

File tree

2 files changed

+1
-39
lines changed

2 files changed

+1
-39
lines changed

src/JsonRpc/MessageFactory.php

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -108,32 +108,10 @@ public function create(string $input): iterable
108108
}
109109
}
110110

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-
133111
/**
134112
* @return class-string<HasMethodInterface>
135113
*/
136-
private function getType(string $method): string
114+
private function getType(string $method/**/): string
137115
{
138116
foreach (self::REGISTERED_MESSAGES as $type) {
139117
if ($type::getMethod() === $method) {

tests/JsonRpc/MessageFactoryTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,6 @@ public function testBatchMissingMethod()
8282
$this->assertInstanceOf(InitializedNotification::class, $result);
8383
}
8484

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-
10185
/**
10286
* @param iterable<mixed> $items
10387
*/

0 commit comments

Comments
 (0)