Merge branch '2.7' into 2.8
* 2.7: [Yaml] release memory after parsing [HttpFoundation] Fix and test status codes according to IANA's data Add `use_strict_mode` in validOptions for session [Console] Inherit phpdoc from OutputFormatterInterface
This commit is contained in:
commit
0bc5eea71e
@ -81,9 +81,7 @@ class OutputFormatter implements OutputFormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the decorated flag.
|
||||
*
|
||||
* @param bool $decorated Whether to decorate the messages or not
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDecorated($decorated)
|
||||
{
|
||||
@ -91,9 +89,7 @@ class OutputFormatter implements OutputFormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the decorated flag.
|
||||
*
|
||||
* @return bool true if the output will decorate messages, false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isDecorated()
|
||||
{
|
||||
@ -101,10 +97,7 @@ class OutputFormatter implements OutputFormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new style.
|
||||
*
|
||||
* @param string $name The style name
|
||||
* @param OutputFormatterStyleInterface $style The style instance
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setStyle($name, OutputFormatterStyleInterface $style)
|
||||
{
|
||||
@ -112,11 +105,7 @@ class OutputFormatter implements OutputFormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if output formatter has style with specified name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasStyle($name)
|
||||
{
|
||||
@ -124,13 +113,7 @@ class OutputFormatter implements OutputFormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets style options from style with specified name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return OutputFormatterStyleInterface
|
||||
*
|
||||
* @throws InvalidArgumentException When style isn't defined
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStyle($name)
|
||||
{
|
||||
@ -142,11 +125,7 @@ class OutputFormatter implements OutputFormatterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a message according to the given styles.
|
||||
*
|
||||
* @param string $message The message to style
|
||||
*
|
||||
* @return string The styled message
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function format($message)
|
||||
{
|
||||
|
@ -55,6 +55,8 @@ interface OutputFormatterInterface
|
||||
* @param string $name
|
||||
*
|
||||
* @return OutputFormatterStyleInterface
|
||||
*
|
||||
* @throws \InvalidArgumentException When style isn't defined
|
||||
*/
|
||||
public function getStyle($name);
|
||||
|
||||
|
@ -179,7 +179,7 @@ class Response
|
||||
503 => 'Service Unavailable',
|
||||
504 => 'Gateway Timeout',
|
||||
505 => 'HTTP Version Not Supported',
|
||||
506 => 'Variant Also Negotiates (Experimental)', // RFC2295
|
||||
506 => 'Variant Also Negotiates', // RFC2295
|
||||
507 => 'Insufficient Storage', // RFC4918
|
||||
508 => 'Loop Detected', // RFC5842
|
||||
510 => 'Not Extended', // RFC2774
|
||||
|
@ -81,6 +81,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* name, "PHPSESSID"
|
||||
* referer_check, ""
|
||||
* serialize_handler, "php"
|
||||
* use_strict_mode, "0"
|
||||
* use_cookies, "1"
|
||||
* use_only_cookies, "1"
|
||||
* use_trans_sid, "0"
|
||||
@ -331,7 +332,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
'entropy_file', 'entropy_length', 'gc_divisor',
|
||||
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
|
||||
'hash_function', 'name', 'referer_check',
|
||||
'serialize_handler', 'use_cookies',
|
||||
'serialize_handler', 'use_strict_mode', 'use_cookies',
|
||||
'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled',
|
||||
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
|
||||
'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags',
|
||||
|
@ -884,6 +884,67 @@ class ResponseTest extends ResponseTestCase
|
||||
{
|
||||
return new Response();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://github.com/zendframework/zend-diactoros for the canonical source repository
|
||||
*
|
||||
* @author Fábio Pacheco
|
||||
* @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
public function ianaCodesReasonPhrasesProvider()
|
||||
{
|
||||
if (!in_array('https', stream_get_wrappers(), true)) {
|
||||
$this->markTestSkipped('The "https" wrapper is not available');
|
||||
}
|
||||
|
||||
$ianaHttpStatusCodes = new \DOMDocument();
|
||||
|
||||
libxml_set_streams_context(stream_context_create(array(
|
||||
'http' => array(
|
||||
'method' => 'GET',
|
||||
'timeout' => 30,
|
||||
),
|
||||
)));
|
||||
|
||||
$ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml');
|
||||
if (!$ianaHttpStatusCodes->relaxNGValidate('https://www.iana.org/assignments/http-status-codes/http-status-codes.rng')) {
|
||||
self::fail('Invalid IANA\'s HTTP status code list.');
|
||||
}
|
||||
|
||||
$ianaCodesReasonPhrases = array();
|
||||
|
||||
$xpath = new \DomXPath($ianaHttpStatusCodes);
|
||||
$xpath->registerNamespace('ns', 'http://www.iana.org/assignments');
|
||||
|
||||
$records = $xpath->query('//ns:record');
|
||||
foreach ($records as $record) {
|
||||
$value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue;
|
||||
$description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue;
|
||||
|
||||
if (in_array($description, array('Unassigned', '(Unused)'), true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches)) {
|
||||
for ($value = $matches[1]; $value <= $matches[2]; ++$value) {
|
||||
$ianaCodesReasonPhrases[] = array($value, $description);
|
||||
}
|
||||
} else {
|
||||
$ianaCodesReasonPhrases[] = array($value, $description);
|
||||
}
|
||||
}
|
||||
|
||||
return $ianaCodesReasonPhrases;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider ianaCodesReasonPhrasesProvider
|
||||
*/
|
||||
public function testReasonPhraseDefaultsAgainstIana($code, $reasonPhrase)
|
||||
{
|
||||
$this->assertEquals($reasonPhrase, Response::$statusTexts[$code]);
|
||||
}
|
||||
}
|
||||
|
||||
class StringableObject
|
||||
|
@ -86,6 +86,12 @@ class Parser
|
||||
mb_internal_encoding($mbEncoding);
|
||||
}
|
||||
|
||||
$this->lines = array();
|
||||
$this->currentLine = '';
|
||||
$this->refs = array();
|
||||
$this->skippedLineNumbers = array();
|
||||
$this->locallySkippedLineNumbers = array();
|
||||
|
||||
if (null !== $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
Reference in New Issue
Block a user