Merge branch '4.2' into 4.3

* 4.2:
  add parameter type declarations to private methods
  add missing changelog entry
  clarify error handler restoring process
  [VarDumper] cs fix
This commit is contained in:
Fabien Potencier 2019-07-27 08:42:46 +02:00
commit 3e8eaebe23
7 changed files with 15 additions and 21 deletions

View File

@ -129,10 +129,7 @@ class ContainerAwareEventManager extends EventManager
}
}
/**
* @param string $eventName
*/
private function initializeListeners($eventName)
private function initializeListeners(string $eventName)
{
foreach ($this->listeners[$eventName] as $hash => $listener) {
if (\is_string($listener)) {

View File

@ -120,7 +120,7 @@ class DoctrineDataCollector extends DataCollector
return 'db';
}
private function sanitizeQueries($connectionName, $queries)
private function sanitizeQueries(string $connectionName, array $queries)
{
foreach ($queries as $i => $query) {
$queries[$i] = $this->sanitizeQuery($connectionName, $query);
@ -129,7 +129,7 @@ class DoctrineDataCollector extends DataCollector
return $queries;
}
private function sanitizeQuery($connectionName, $query)
private function sanitizeQuery(string $connectionName, $query)
{
$query['explainable'] = true;
if (null === $query['params']) {

View File

@ -109,7 +109,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
}
}
private function getEventManagerDef(ContainerBuilder $container, $name)
private function getEventManagerDef(ContainerBuilder $container, string $name)
{
if (!isset($this->eventManagers[$name])) {
$this->eventManagers[$name] = $container->getDefinition(sprintf($this->managerTemplate, $name));
@ -128,12 +128,9 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
* @see https://bugs.php.net/bug.php?id=53710
* @see https://bugs.php.net/bug.php?id=60926
*
* @param string $tagName
* @param ContainerBuilder $container
*
* @return array
*/
private function findAndSortTags($tagName, ContainerBuilder $container)
private function findAndSortTags(string $tagName, ContainerBuilder $container)
{
$sortedTags = [];

View File

@ -50,7 +50,7 @@ final class TestRepositoryFactory implements RepositoryFactory
/**
* @return ObjectRepository
*/
private function createRepository(EntityManagerInterface $entityManager, $entityName)
private function createRepository(EntityManagerInterface $entityManager, string $entityName)
{
/* @var $metadata ClassMetadata */
$metadata = $entityManager->getClassMetadata($entityName);
@ -59,7 +59,7 @@ final class TestRepositoryFactory implements RepositoryFactory
return new $repositoryClassName($entityManager, $metadata);
}
private function getRepositoryHash(EntityManagerInterface $entityManager, $entityName)
private function getRepositoryHash(EntityManagerInterface $entityManager, string $entityName)
{
return $entityManager->getClassMetadata($entityName)->getName().spl_object_hash($entityManager);
}

View File

@ -31,6 +31,7 @@ CHANGELOG
4.1.0
-----
* The `switch_user.stateless` firewall option is deprecated, use the `stateless` option instead.
* The `logout_on_user_change` firewall option is deprecated.
* deprecated `SecurityUserValueResolver`, use
`Symfony\Component\Security\Http\Controller\UserValueResolver` instead.

View File

@ -50,10 +50,9 @@ class CacheWarmerAggregate implements CacheWarmerInterface
*/
public function warmUp($cacheDir)
{
if ($this->debug) {
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
$collectedLogs = [];
$previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
$previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
}
@ -96,7 +95,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface
$warmer->warmUp($cacheDir);
}
} finally {
if ($this->debug && true !== $previousHandler) {
if ($collectDeprecations) {
restore_error_handler();
if (file_exists($this->deprecationLogsFilepath)) {

View File

@ -473,7 +473,7 @@ return function (root, x) {
return this.current();
}
this.idx = this.idx < (this.nodes.length - 1) ? this.idx + 1 : 0;
return this.current();
},
previous: function () {
@ -481,7 +481,7 @@ return function (root, x) {
return this.current();
}
this.idx = this.idx > 0 ? this.idx - 1 : (this.nodes.length - 1);
return this.current();
},
isEmpty: function () {
@ -565,11 +565,11 @@ return function (root, x) {
"sf-dump-protected",
"sf-dump-private",
].map(xpathHasClass).join(' or ');
var xpathResult = doc.evaluate('.//span[' + classMatches + '][contains(translate(child::text(), ' + xpathString(searchQuery.toUpperCase()) + ', ' + xpathString(searchQuery.toLowerCase()) + '), ' + xpathString(searchQuery.toLowerCase()) + ')]', root, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
while (node = xpathResult.iterateNext()) state.nodes.push(node);
showCurrent(state);
}, 400);
});