Merge branch '3.3' into 3.4

* 3.3:
  Random fixes
  Docblock fixes
  [HttpKernel] Enhance deprecation message
  [SecurityBundle] Fix the datacollector to properly support decision.object being null
This commit is contained in:
Nicolas Grekas 2017-11-07 13:10:25 +01:00
commit c4ae73939e
20 changed files with 64 additions and 46 deletions

View File

@ -69,7 +69,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
* only do anything if the parameter is present. (But regardless of the
* value of that parameter.
*
* @var string
* @var string|false
*/
protected $enabledParameter;

View File

@ -196,7 +196,7 @@ class CodeExtension extends AbstractExtension
* @param string $file An absolute file path
* @param int $line The line number
*
* @return string A link of false
* @return string|false A link or false
*/
public function getFileLink($file, $line)
{

View File

@ -80,7 +80,7 @@ class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
$supportedLoaders[] = $loader;
} elseif ($loader instanceof LoaderChain) {
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getDelegatedLoaders()));
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getLoaders()));
}
}

View File

@ -91,7 +91,7 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
$supportedLoaders[] = $loader;
} elseif ($loader instanceof LoaderChain) {
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getDelegatedLoaders()));
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getLoaders()));
}
}

View File

@ -62,7 +62,7 @@ class Client extends BaseClient
/**
* Gets the profile associated with the current Response.
*
* @return HttpProfile A Profile instance
* @return HttpProfile|false A Profile instance
*/
public function getProfile()
{

View File

@ -322,7 +322,7 @@
{{ profiler_dump(decision.attributes) }}
{% endif %}
</td>
<td>{{ profiler_dump(decision.object) }}</td>
<td>{{ profiler_dump(decision.seek('object')) }}</td>
</tr>
{% endfor %}
</tbody>

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\Cache\Adapter;
use Doctrine\DBAL\Connection;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\Traits\PdoTrait;

View File

@ -48,7 +48,7 @@ trait RedisTrait
throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0]));
}
if ($redisClient instanceof \RedisCluster) {
$this->enableversioning();
$this->enableVersioning();
} elseif (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \Predis\Client) {
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, is_object($redisClient) ? get_class($redisClient) : gettype($redisClient)));
}

View File

@ -121,7 +121,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
$mode = 0666;
$umask = umask();
$filesystem = new Filesystem();
$filesystem->dumpFile($this->file, $content, null);
$filesystem->dumpFile($this->file, $content);
try {
$filesystem->chmod($this->file, $mode, $umask);
} catch (IOException $e) {
@ -129,7 +129,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
}
if (null !== $metadata) {
$filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null);
$filesystem->dumpFile($this->getMetaFile(), serialize($metadata));
try {
$filesystem->chmod($this->getMetaFile(), $mode, $umask);
} catch (IOException $e) {

View File

@ -135,7 +135,7 @@ class XmlUtils
}
/**
* Converts a \DomElement object to a PHP array.
* Converts a \DOMElement object to a PHP array.
*
* The following rules applies during the conversion:
*
@ -149,7 +149,7 @@ class XmlUtils
*
* * The nested-tags are converted to keys (<foo><foo>bar</foo></foo>)
*
* @param \DomElement $element A \DomElement instance
* @param \DOMElement $element A \DOMElement instance
* @param bool $checkPrefix Check prefix in an element or an attribute name
*
* @return array A PHP array

View File

@ -21,10 +21,10 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce
private $alternatives;
/**
* @param string $message Exception message to throw
* @param array $alternatives List of similar defined names
* @param int $code Exception code
* @param Exception $previous previous exception used for the exception chaining
* @param string $message Exception message to throw
* @param array $alternatives List of similar defined names
* @param int $code Exception code
* @param \Exception $previous Previous exception used for the exception chaining
*/
public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
{

View File

@ -471,9 +471,9 @@ EOTXT;
*
* @return bool
*/
private function isSimpleInstance($id, Definition $definition)
private function isSimpleInstance($id, Definition $definition, array $inlinedDefinitions)
{
foreach (array_merge(array($definition), $this->getInlinedDefinitions($definition)) as $sDefinition) {
foreach (array_merge(array($definition), $inlinedDefinitions) as $sDefinition) {
if ($definition !== $sDefinition && !$this->hasReference($id, $sDefinition->getMethodCalls())) {
continue;
}

View File

@ -705,7 +705,7 @@ EOF
}
/**
* Converts a \DomElement object to a PHP array.
* Converts a \DOMElement object to a PHP array.
*
* The following rules applies during the conversion:
*
@ -719,7 +719,7 @@ EOF
*
* * The nested-tags are converted to keys (<foo><foo>bar</foo></foo>)
*
* @param \DomElement $element A \DomElement instance
* @param \DOMElement $element A \DOMElement instance
*
* @return array A PHP array
*/

View File

@ -285,7 +285,7 @@ class DateType extends AbstractType
private function formatTimestamps(\IntlDateFormatter $formatter, $regex, array $timestamps)
{
$pattern = $formatter->getPattern();
$timezone = $formatter->getTimezoneId();
$timezone = $formatter->getTimeZoneId();
$formattedTimestamps = array();
$formatter->setTimeZone('UTC');

View File

@ -164,6 +164,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
private function sanitizeLogs($logs)
{
$sanitizedLogs = array();
$silencedLogs = array();
foreach ($logs as $log) {
if (!$this->isSilencedOrDeprecationErrorLog($log)) {

View File

@ -393,7 +393,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
* @param string $name The cache name prefix
* @param string $extension File extension of the resulting file
*
* @deprecated since version 3.3, to be removed in 4.0.
* @deprecated since version 3.3, to be removed in 4.0. The class cache is not needed anymore when using PHP 7.0.
*/
public function loadClassCache($name = 'classes', $extension = '.php')
{

View File

@ -60,4 +60,12 @@ class LoaderChain implements LoaderInterface
return $success;
}
/**
* @return LoaderInterface[]
*/
public function getLoaders()
{
return $this->loaders;
}
}

View File

@ -69,7 +69,7 @@ abstract class AbstractComparisonValidator extends ConstraintValidator
if ($value instanceof \DateTimeImmutable) {
// If $value is immutable, convert the compared value to a
// DateTimeImmutable too
$comparedValue = new \DatetimeImmutable($comparedValue);
$comparedValue = new \DateTimeImmutable($comparedValue);
} elseif ($value instanceof \DateTimeInterface) {
// Otherwise use DateTime
$comparedValue = new \DateTime($comparedValue);

View File

@ -56,4 +56,12 @@ class LoaderChain implements LoaderInterface
return $success;
}
/**
* @return LoaderInterface[]
*/
public function getLoaders()
{
return $this->loaders;
}
}

View File

@ -20,27 +20,27 @@ use Symfony\Component\VarDumper\Cloner\Stub;
class XmlReaderCaster
{
private static $nodeTypes = array(
\XmlReader::NONE => 'NONE',
\XmlReader::ELEMENT => 'ELEMENT',
\XmlReader::ATTRIBUTE => 'ATTRIBUTE',
\XmlReader::TEXT => 'TEXT',
\XmlReader::CDATA => 'CDATA',
\XmlReader::ENTITY_REF => 'ENTITY_REF',
\XmlReader::ENTITY => 'ENTITY',
\XmlReader::PI => 'PI (Processing Instruction)',
\XmlReader::COMMENT => 'COMMENT',
\XmlReader::DOC => 'DOC',
\XmlReader::DOC_TYPE => 'DOC_TYPE',
\XmlReader::DOC_FRAGMENT => 'DOC_FRAGMENT',
\XmlReader::NOTATION => 'NOTATION',
\XmlReader::WHITESPACE => 'WHITESPACE',
\XmlReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE',
\XmlReader::END_ELEMENT => 'END_ELEMENT',
\XmlReader::END_ENTITY => 'END_ENTITY',
\XmlReader::XML_DECLARATION => 'XML_DECLARATION',
\XMLReader::NONE => 'NONE',
\XMLReader::ELEMENT => 'ELEMENT',
\XMLReader::ATTRIBUTE => 'ATTRIBUTE',
\XMLReader::TEXT => 'TEXT',
\XMLReader::CDATA => 'CDATA',
\XMLReader::ENTITY_REF => 'ENTITY_REF',
\XMLReader::ENTITY => 'ENTITY',
\XMLReader::PI => 'PI (Processing Instruction)',
\XMLReader::COMMENT => 'COMMENT',
\XMLReader::DOC => 'DOC',
\XMLReader::DOC_TYPE => 'DOC_TYPE',
\XMLReader::DOC_FRAGMENT => 'DOC_FRAGMENT',
\XMLReader::NOTATION => 'NOTATION',
\XMLReader::WHITESPACE => 'WHITESPACE',
\XMLReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE',
\XMLReader::END_ELEMENT => 'END_ELEMENT',
\XMLReader::END_ENTITY => 'END_ENTITY',
\XMLReader::XML_DECLARATION => 'XML_DECLARATION',
);
public static function castXmlReader(\XmlReader $reader, array $a, Stub $stub, $isNested)
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested)
{
$props = Caster::PREFIX_VIRTUAL.'parserProperties';
$info = array(
@ -49,17 +49,17 @@ class XmlReaderCaster
'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType),
'depth' => $reader->depth,
'isDefault' => $reader->isDefault,
'isEmptyElement' => \XmlReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
'isEmptyElement' => \XMLReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
'xmlLang' => $reader->xmlLang,
'attributeCount' => $reader->attributeCount,
'value' => $reader->value,
'namespaceURI' => $reader->namespaceURI,
'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
$props => array(
'LOADDTD' => $reader->getParserProperty(\XmlReader::LOADDTD),
'DEFAULTATTRS' => $reader->getParserProperty(\XmlReader::DEFAULTATTRS),
'VALIDATE' => $reader->getParserProperty(\XmlReader::VALIDATE),
'SUBST_ENTITIES' => $reader->getParserProperty(\XmlReader::SUBST_ENTITIES),
'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD),
'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS),
'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE),
'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
),
);