Skip to content

Commit 42fe143

Browse files
authored
make static methods in Error final (#204)
1 parent 8b57fdf commit 42fe143

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Schema/JsonRpc/Error.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct(
5252
/**
5353
* @param ErrorData $data
5454
*/
55-
public static function fromArray(array $data): self
55+
final public static function fromArray(array $data): self
5656
{
5757
if (!isset($data['jsonrpc']) || MessageInterface::JSONRPC_VERSION !== $data['jsonrpc']) {
5858
throw new InvalidArgumentException('Invalid or missing "jsonrpc" in Error data.');
@@ -76,37 +76,37 @@ public static function fromArray(array $data): self
7676
return new self($data['id'], $data['error']['code'], $data['error']['message'], $data['error']['data'] ?? null);
7777
}
7878

79-
public static function forParseError(string $message, string|int $id = ''): self
79+
final public static function forParseError(string $message, string|int $id = ''): self
8080
{
8181
return new self($id, self::PARSE_ERROR, $message);
8282
}
8383

84-
public static function forInvalidRequest(string $message, string|int $id = ''): self
84+
final public static function forInvalidRequest(string $message, string|int $id = ''): self
8585
{
8686
return new self($id, self::INVALID_REQUEST, $message);
8787
}
8888

89-
public static function forMethodNotFound(string $message, string|int $id = ''): self
89+
final public static function forMethodNotFound(string $message, string|int $id = ''): self
9090
{
9191
return new self($id, self::METHOD_NOT_FOUND, $message);
9292
}
9393

94-
public static function forInvalidParams(string $message, string|int $id = '', mixed $data = null): self
94+
final public static function forInvalidParams(string $message, string|int $id = '', mixed $data = null): self
9595
{
9696
return new self($id, self::INVALID_PARAMS, $message, $data);
9797
}
9898

99-
public static function forInternalError(string $message, string|int $id = ''): self
99+
final public static function forInternalError(string $message, string|int $id = ''): self
100100
{
101101
return new self($id, self::INTERNAL_ERROR, $message);
102102
}
103103

104-
public static function forServerError(string $message, string|int $id = ''): self
104+
final public static function forServerError(string $message, string|int $id = ''): self
105105
{
106106
return new self($id, self::SERVER_ERROR, $message);
107107
}
108108

109-
public static function forResourceNotFound(string $message, string|int $id = ''): self
109+
final public static function forResourceNotFound(string $message, string|int $id = ''): self
110110
{
111111
return new self($id, self::RESOURCE_NOT_FOUND, $message);
112112
}

0 commit comments

Comments
 (0)