alxmsl / psr-7
PSR-7 接口具有严格类型声明
v0.1.1
2016-01-09 22:24 UTC
Requires
- php: >=7.0
This package is not auto-updated.
Last update: 2024-09-18 19:27:32 UTC
README
此存储库包含与 PSR-7 相关的所有接口。这是 php-fig/http-message 的分支,除了使用了严格类型。所有接口方法都有严格的类型声明。
例如,如果 Psr\Http\RequestInterface
被定义为
interface RequestInterface extends MessageInterface { /** * @return string */ public function getRequestTarget(); /** * @param mixed $requestTarget * @return self */ public function withRequestTarget($requestTarget); /** * @return string Returns the request method. */ public function getMethod(); /** * @param string $method Case-sensitive method. * @return self * @throws InvalidArgumentException for invalid HTTP methods. */ public function withMethod($method); /** * @return UriInterface Returns a UriInterface instance representing the URI of the request. */ public function getUri(); /** * @param UriInterface $uri New request URI to use. * @param bool $preserveHost Preserve the original state of the Host header. * @return self */ public function withUri(UriInterface $uri, $preserveHost = false); }
...那么 alxmsl\Psr7\RequestInterface
将被定义为
interface RequestInterface extends MessageInterface { /** * @return string */ public function getRequestTarget(): string; /** * @param mixed $requestTarget * @return self */ public function withRequestTarget(mixed $requestTarget): RequestInterface; /** * @return string Returns the request method. */ public function getMethod(): string; /** * @param string $method Case-sensitive method. * @return self * @throws InvalidArgumentException for invalid HTTP methods. */ public function withMethod(string $method): RequestInterface; /** * @return UriInterface Returns a UriInterface instance representing the URI of the request. */ public function getUri(): UriInterface; /** * @param UriInterface $uri New request URI to use. * @param bool $preserveHost Preserve the original state of the Host header. * @return self */ public function withUri(UriInterface $uri, bool $preserveHost = false): RequestInterface; }
许可证
版权所有 2016 Alexey Maslov alexey.y.maslov@gmail.com
在 Apache License, Version 2.0 (以下简称“许可证”)下许可;除非根据许可证的要求或书面同意,否则不得使用此文件。您可以在以下位置获取许可证副本:
https://apache.ac.cn/licenses/LICENSE-2.0
除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”分发,不提供任何明示或暗示的保证或条件。有关许可证的具体语言管理权限和限制,请参阅许可证。