Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

View file

@ -0,0 +1,36 @@
# Changelog
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 1.0.1 - 2016-08-06
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Updated all `@return self` annotation references in interfaces to use
`@return static`, which more closelly follows the semantics of the
specification.
- Updated the `MessageInterface::getHeaders()` return annotation to use the
value `string[][]`, indicating the format is a nested array of strings.
- Updated the `@link` annotation for `RequestInterface::withRequestTarget()`
to point to the correct section of RFC 7230.
- Updated the `ServerRequestInterface::withUploadedFiles()` parameter annotation
to add the parameter name (`$uploadedFiles`).
- Updated a `@throws` annotation for the `UploadedFileInterface::moveTo()`
method to correctly reference the method parameter (it was referencing an
incorrect parameter name previously).
## 1.0.0 - 2016-05-18
Initial stable release; reflects accepted PSR-7 specification.

View file

@ -2,6 +2,7 @@
"name": "psr/http-message",
"description": "Common interface for HTTP messages",
"keywords": ["psr", "psr-7", "http", "http-message", "request", "response"],
"homepage": "https://github.com/php-fig/http-message",
"license": "MIT",
"authors": [
{

View file

@ -36,7 +36,7 @@ interface MessageInterface
* new protocol version.
*
* @param string $version HTTP protocol version
* @return self
* @return static
*/
public function withProtocolVersion($version);
@ -61,7 +61,7 @@ interface MessageInterface
* While header names are not case-sensitive, getHeaders() will preserve the
* exact case in which headers were originally specified.
*
* @return array Returns an associative array of the message's headers. Each
* @return string[][] Returns an associative array of the message's headers. Each
* key MUST be a header name, and each value MUST be an array of strings
* for that header.
*/
@ -126,7 +126,7 @@ interface MessageInterface
*
* @param string $name Case-insensitive header field name.
* @param string|string[] $value Header value(s).
* @return self
* @return static
* @throws \InvalidArgumentException for invalid header names or values.
*/
public function withHeader($name, $value);
@ -144,7 +144,7 @@ interface MessageInterface
*
* @param string $name Case-insensitive header field name to add.
* @param string|string[] $value Header value(s).
* @return self
* @return static
* @throws \InvalidArgumentException for invalid header names or values.
*/
public function withAddedHeader($name, $value);
@ -159,7 +159,7 @@ interface MessageInterface
* the named header.
*
* @param string $name Case-insensitive header field name to remove.
* @return self
* @return static
*/
public function withoutHeader($name);
@ -180,7 +180,7 @@ interface MessageInterface
* new body stream.
*
* @param StreamInterface $body Body.
* @return self
* @return static
* @throws \InvalidArgumentException When the body is not valid.
*/
public function withBody(StreamInterface $body);

View file

@ -53,10 +53,10 @@ interface RequestInterface extends MessageInterface
* immutability of the message, and MUST return an instance that has the
* changed request target.
*
* @link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various
* @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
* request-target forms allowed in request messages)
* @param mixed $requestTarget
* @return self
* @return static
*/
public function withRequestTarget($requestTarget);
@ -79,7 +79,7 @@ interface RequestInterface extends MessageInterface
* changed request method.
*
* @param string $method Case-sensitive method.
* @return self
* @return static
* @throws \InvalidArgumentException for invalid HTTP methods.
*/
public function withMethod($method);
@ -107,7 +107,7 @@ interface RequestInterface extends MessageInterface
* setting `$preserveHost` to `true`. When `$preserveHost` is set to
* `true`, this method interacts with the Host header in the following ways:
*
* - If the the Host header is missing or empty, and the new URI contains
* - If the Host header is missing or empty, and the new URI contains
* a host component, this method MUST update the Host header in the returned
* request.
* - If the Host header is missing or empty, and the new URI does not contain a
@ -123,7 +123,7 @@ interface RequestInterface extends MessageInterface
* @link http://tools.ietf.org/html/rfc3986#section-4.3
* @param UriInterface $uri New request URI to use.
* @param bool $preserveHost Preserve the original state of the Host header.
* @return self
* @return static
*/
public function withUri(UriInterface $uri, $preserveHost = false);
}

View file

@ -46,7 +46,7 @@ interface ResponseInterface extends MessageInterface
* @param string $reasonPhrase The reason phrase to use with the
* provided status code; if none is provided, implementations MAY
* use the defaults as suggested in the HTTP specification.
* @return self
* @return static
* @throws \InvalidArgumentException For invalid status code arguments.
*/
public function withStatus($code, $reasonPhrase = '');

View file

@ -80,7 +80,7 @@ interface ServerRequestInterface extends RequestInterface
* updated cookie values.
*
* @param array $cookies Array of key/value pairs representing cookies.
* @return self
* @return static
*/
public function withCookieParams(array $cookies);
@ -118,7 +118,7 @@ interface ServerRequestInterface extends RequestInterface
*
* @param array $query Array of query string arguments, typically from
* $_GET.
* @return self
* @return static
*/
public function withQueryParams(array $query);
@ -143,8 +143,8 @@ interface ServerRequestInterface extends RequestInterface
* immutability of the message, and MUST return an instance that has the
* updated body parameters.
*
* @param array An array tree of UploadedFileInterface instances.
* @return self
* @param array $uploadedFiles An array tree of UploadedFileInterface instances.
* @return static
* @throws \InvalidArgumentException if an invalid structure is provided.
*/
public function withUploadedFiles(array $uploadedFiles);
@ -190,7 +190,7 @@ interface ServerRequestInterface extends RequestInterface
*
* @param null|array|object $data The deserialized body data. This will
* typically be in an array or object.
* @return self
* @return static
* @throws \InvalidArgumentException if an unsupported argument type is
* provided.
*/
@ -239,7 +239,7 @@ interface ServerRequestInterface extends RequestInterface
* @see getAttributes()
* @param string $name The attribute name.
* @param mixed $value The value of the attribute.
* @return self
* @return static
*/
public function withAttribute($name, $value);
@ -255,7 +255,7 @@ interface ServerRequestInterface extends RequestInterface
*
* @see getAttributes()
* @param string $name The attribute name.
* @return self
* @return static
*/
public function withoutAttribute($name);
}

View file

@ -58,7 +58,7 @@ interface UploadedFileInterface
* @see http://php.net/is_uploaded_file
* @see http://php.net/move_uploaded_file
* @param string $targetPath Path to which to move the uploaded file.
* @throws \InvalidArgumentException if the $path specified is invalid.
* @throws \InvalidArgumentException if the $targetPath specified is invalid.
* @throws \RuntimeException on any error during the move operation, or on
* the second or subsequent call to the method.
*/

View file

@ -185,7 +185,7 @@ interface UriInterface
* An empty scheme is equivalent to removing the scheme.
*
* @param string $scheme The scheme to use with the new instance.
* @return self A new instance with the specified scheme.
* @return static A new instance with the specified scheme.
* @throws \InvalidArgumentException for invalid or unsupported schemes.
*/
public function withScheme($scheme);
@ -202,7 +202,7 @@ interface UriInterface
*
* @param string $user The user name to use for authority.
* @param null|string $password The password associated with $user.
* @return self A new instance with the specified user information.
* @return static A new instance with the specified user information.
*/
public function withUserInfo($user, $password = null);
@ -215,7 +215,7 @@ interface UriInterface
* An empty host value is equivalent to removing the host.
*
* @param string $host The hostname to use with the new instance.
* @return self A new instance with the specified host.
* @return static A new instance with the specified host.
* @throws \InvalidArgumentException for invalid hostnames.
*/
public function withHost($host);
@ -234,7 +234,7 @@ interface UriInterface
*
* @param null|int $port The port to use with the new instance; a null value
* removes the port information.
* @return self A new instance with the specified port.
* @return static A new instance with the specified port.
* @throws \InvalidArgumentException for invalid ports.
*/
public function withPort($port);
@ -258,7 +258,7 @@ interface UriInterface
* Implementations ensure the correct encoding as outlined in getPath().
*
* @param string $path The path to use with the new instance.
* @return self A new instance with the specified path.
* @return static A new instance with the specified path.
* @throws \InvalidArgumentException for invalid paths.
*/
public function withPath($path);
@ -275,7 +275,7 @@ interface UriInterface
* An empty query string value is equivalent to removing the query string.
*
* @param string $query The query string to use with the new instance.
* @return self A new instance with the specified query string.
* @return static A new instance with the specified query string.
* @throws \InvalidArgumentException for invalid query strings.
*/
public function withQuery($query);
@ -292,7 +292,7 @@ interface UriInterface
* An empty fragment value is equivalent to removing the fragment.
*
* @param string $fragment The fragment to use with the new instance.
* @return self A new instance with the specified fragment.
* @return static A new instance with the specified fragment.
*/
public function withFragment($fragment);

View file

@ -15,8 +15,9 @@ abstract class AbstractLogger implements LoggerInterface
* System is unusable.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function emergency($message, array $context = array())
{
@ -30,8 +31,9 @@ abstract class AbstractLogger implements LoggerInterface
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function alert($message, array $context = array())
{
@ -44,8 +46,9 @@ abstract class AbstractLogger implements LoggerInterface
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function critical($message, array $context = array())
{
@ -57,8 +60,9 @@ abstract class AbstractLogger implements LoggerInterface
* be logged and monitored.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function error($message, array $context = array())
{
@ -72,8 +76,9 @@ abstract class AbstractLogger implements LoggerInterface
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function warning($message, array $context = array())
{
@ -84,8 +89,9 @@ abstract class AbstractLogger implements LoggerInterface
* Normal but significant events.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function notice($message, array $context = array())
{
@ -98,8 +104,9 @@ abstract class AbstractLogger implements LoggerInterface
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function info($message, array $context = array())
{
@ -110,8 +117,9 @@ abstract class AbstractLogger implements LoggerInterface
* Detailed debug information.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function debug($message, array $context = array())
{

View file

@ -3,16 +3,16 @@
namespace Psr\Log;
/**
* Describes log levels
* Describes log levels.
*/
class LogLevel
{
const EMERGENCY = 'emergency';
const ALERT = 'alert';
const CRITICAL = 'critical';
const ERROR = 'error';
const WARNING = 'warning';
const NOTICE = 'notice';
const INFO = 'info';
const DEBUG = 'debug';
const ALERT = 'alert';
const CRITICAL = 'critical';
const ERROR = 'error';
const WARNING = 'warning';
const NOTICE = 'notice';
const INFO = 'info';
const DEBUG = 'debug';
}

View file

@ -3,15 +3,16 @@
namespace Psr\Log;
/**
* Describes a logger-aware instance
* Describes a logger-aware instance.
*/
interface LoggerAwareInterface
{
/**
* Sets a logger instance on the object
* Sets a logger instance on the object.
*
* @param LoggerInterface $logger
* @return null
*
* @return void
*/
public function setLogger(LoggerInterface $logger);
}

View file

@ -7,12 +7,16 @@ namespace Psr\Log;
*/
trait LoggerAwareTrait
{
/** @var LoggerInterface */
/**
* The logger instance.
*
* @var LoggerInterface
*/
protected $logger;
/**
* Sets a logger.
*
*
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger)

View file

@ -3,14 +3,14 @@
namespace Psr\Log;
/**
* Describes a logger instance
* Describes a logger instance.
*
* The message MUST be a string or object implementing __toString().
*
* The message MAY contain placeholders in the form: {foo} where foo
* will be replaced by the context data in key "foo".
*
* The context array can contain arbitrary data, the only assumption that
* The context array can contain arbitrary data. The only assumption that
* can be made by implementors is that if an Exception instance is given
* to produce a stack trace, it MUST be in a key named "exception".
*
@ -23,8 +23,9 @@ interface LoggerInterface
* System is unusable.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function emergency($message, array $context = array());
@ -35,8 +36,9 @@ interface LoggerInterface
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function alert($message, array $context = array());
@ -46,8 +48,9 @@ interface LoggerInterface
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function critical($message, array $context = array());
@ -56,8 +59,9 @@ interface LoggerInterface
* be logged and monitored.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function error($message, array $context = array());
@ -68,8 +72,9 @@ interface LoggerInterface
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function warning($message, array $context = array());
@ -77,8 +82,9 @@ interface LoggerInterface
* Normal but significant events.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function notice($message, array $context = array());
@ -88,8 +94,9 @@ interface LoggerInterface
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function info($message, array $context = array());
@ -97,18 +104,20 @@ interface LoggerInterface
* Detailed debug information.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function debug($message, array $context = array());
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param mixed $level
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function log($level, $message, array $context = array());
}

View file

@ -6,8 +6,8 @@ namespace Psr\Log;
* This is a simple Logger trait that classes unable to extend AbstractLogger
* (because they extend another class, etc) can include.
*
* It simply delegates all log-level-specific methods to the `log` method to
* reduce boilerplate code that a simple Logger that does the same thing with
* It simply delegates all log-level-specific methods to the `log` method to
* reduce boilerplate code that a simple Logger that does the same thing with
* messages regardless of the error level has to implement.
*/
trait LoggerTrait
@ -16,8 +16,9 @@ trait LoggerTrait
* System is unusable.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function emergency($message, array $context = array())
{
@ -31,8 +32,9 @@ trait LoggerTrait
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function alert($message, array $context = array())
{
@ -45,8 +47,9 @@ trait LoggerTrait
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function critical($message, array $context = array())
{
@ -58,8 +61,9 @@ trait LoggerTrait
* be logged and monitored.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function error($message, array $context = array())
{
@ -73,8 +77,9 @@ trait LoggerTrait
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function warning($message, array $context = array())
{
@ -85,8 +90,9 @@ trait LoggerTrait
* Normal but significant events.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function notice($message, array $context = array())
{
@ -99,8 +105,9 @@ trait LoggerTrait
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function info($message, array $context = array())
{
@ -111,8 +118,9 @@ trait LoggerTrait
* Detailed debug information.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function debug($message, array $context = array())
{
@ -122,10 +130,11 @@ trait LoggerTrait
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param mixed $level
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
abstract public function log($level, $message, array $context = array());
}

View file

@ -3,7 +3,7 @@
namespace Psr\Log;
/**
* This Logger can be used to avoid conditional log calls
* This Logger can be used to avoid conditional log calls.
*
* Logging should always be optional, and if no logger is provided to your
* library creating a NullLogger instance to have something to throw logs at
@ -15,10 +15,11 @@ class NullLogger extends AbstractLogger
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param mixed $level
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function log($level, $message, array $context = array())
{

View file

@ -2,28 +2,32 @@
namespace Psr\Log\Test;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
/**
* Provides a base test class for ensuring compliance with the LoggerInterface
* Provides a base test class for ensuring compliance with the LoggerInterface.
*
* Implementors can extend the class and implement abstract methods to run this as part of their test suite
* Implementors can extend the class and implement abstract methods to run this
* as part of their test suite.
*/
abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
{
/**
* @return LoggerInterface
*/
abstract function getLogger();
abstract public function getLogger();
/**
* This must return the log messages in order with a simple formatting: "<LOG LEVEL> <MESSAGE>"
* This must return the log messages in order.
*
* Example ->error('Foo') would yield "error Foo"
* The simple formatting of the messages is: "<LOG LEVEL> <MESSAGE>".
*
* Example ->error('Foo') would yield "error Foo".
*
* @return string[]
*/
abstract function getLogs();
abstract public function getLogs();
public function testImplements()
{
@ -61,7 +65,7 @@ abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException Psr\Log\InvalidArgumentException
* @expectedException \Psr\Log\InvalidArgumentException
*/
public function testThrowsOnInvalidLevel()
{
@ -80,12 +84,19 @@ abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
public function testObjectCastToString()
{
$dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
if (method_exists($this, 'createPartialMock')) {
$dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
} else {
$dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
}
$dummy->expects($this->once())
->method('__toString')
->will($this->returnValue('DUMMY'));
$this->getLogger()->warning($dummy);
$expected = array('warning DUMMY');
$this->assertEquals($expected, $this->getLogs());
}
public function testContextCanContainAnything()
@ -102,15 +113,28 @@ abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
);
$this->getLogger()->warning('Crazy context data', $context);
$expected = array('warning Crazy context data');
$this->assertEquals($expected, $this->getLogs());
}
public function testContextExceptionKeyCanBeExceptionOrOtherValues()
{
$this->getLogger()->warning('Random message', array('exception' => 'oops'));
$this->getLogger()->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
$logger = $this->getLogger();
$logger->warning('Random message', array('exception' => 'oops'));
$logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
$expected = array(
'warning Random message',
'critical Uncaught Exception!'
);
$this->assertEquals($expected, $this->getLogs());
}
}
class DummyTest
{
}
public function __toString()
{
}
}

View file

@ -2,6 +2,7 @@
"name": "psr/log",
"description": "Common interface for logging libraries",
"keywords": ["psr", "psr-3", "log"],
"homepage": "https://github.com/php-fig/log",
"license": "MIT",
"authors": [
{
@ -9,9 +10,17 @@
"homepage": "http://www.php-fig.org/"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": {
"Psr\\Log\\": ""
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}