From bf608aaf3c2b08b2ffd39f14f86365b26c15727c Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 25 Jul 2019 06:34:00 +0300 Subject: [PATCH 01/11] Fix pluralizing "season" --- src/Symfony/Component/Inflector/Inflector.php | 3 +++ src/Symfony/Component/Inflector/Tests/InflectorTest.php | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/Symfony/Component/Inflector/Inflector.php b/src/Symfony/Component/Inflector/Inflector.php index 15198293cf..58399b6322 100644 --- a/src/Symfony/Component/Inflector/Inflector.php +++ b/src/Symfony/Component/Inflector/Inflector.php @@ -228,6 +228,9 @@ final class Inflector // bacteria (bacterium), criteria (criterion), phenomena (phenomenon) ['noi', 3, true, true, 'ions'], + // seasons (season), treasons (treason), poisons (poison), lessons (lesson) + ['nos', 3, true, true, 'sons'], + // bacteria (bacterium), criteria (criterion), phenomena (phenomenon) ['no', 2, true, true, 'a'], diff --git a/src/Symfony/Component/Inflector/Tests/InflectorTest.php b/src/Symfony/Component/Inflector/Tests/InflectorTest.php index 1178edf35b..38df846ba6 100644 --- a/src/Symfony/Component/Inflector/Tests/InflectorTest.php +++ b/src/Symfony/Component/Inflector/Tests/InflectorTest.php @@ -93,6 +93,7 @@ class InflectorTest extends TestCase ['kisses', 'kiss'], ['knives', 'knife'], ['lamps', 'lamp'], + ['lessons', 'lesson'], ['leaves', ['leaf', 'leave', 'leaff']], ['lice', 'louse'], ['lives', 'life'], @@ -115,6 +116,7 @@ class InflectorTest extends TestCase ['photos', 'photo'], ['pianos', 'piano'], ['plateaux', 'plateau'], + ['poisons', 'poison'], ['poppies', 'poppy'], ['prices', ['prex', 'prix', 'price']], ['quizzes', 'quiz'], @@ -124,6 +126,7 @@ class InflectorTest extends TestCase ['sandwiches', ['sandwich', 'sandwiche']], ['scarves', ['scarf', 'scarve', 'scarff']], ['schemas', 'schema'], //schemata + ['seasons', 'season'], ['selfies', 'selfie'], ['series', 'series'], ['services', 'service'], @@ -139,6 +142,7 @@ class InflectorTest extends TestCase ['teeth', 'tooth'], ['theses', ['thes', 'these', 'thesis']], ['thieves', ['thief', 'thieve', 'thieff']], + ['treasons', 'treason'], ['trees', ['tre', 'tree']], ['waltzes', ['waltz', 'waltze']], ['wives', 'wife'], @@ -226,6 +230,7 @@ class InflectorTest extends TestCase ['knife', 'knives'], ['lamp', 'lamps'], ['leaf', ['leafs', 'leaves']], + ['lesson', 'lessons'], ['life', 'lives'], ['louse', 'lice'], ['man', 'men'], @@ -245,6 +250,7 @@ class InflectorTest extends TestCase ['photo', 'photos'], ['piano', 'pianos'], ['plateau', ['plateaus', 'plateaux']], + ['poison', 'poisons'], ['poppy', 'poppies'], ['price', 'prices'], ['quiz', 'quizzes'], @@ -254,6 +260,7 @@ class InflectorTest extends TestCase ['sandwich', 'sandwiches'], ['scarf', ['scarfs', 'scarves']], ['schema', 'schemas'], //schemata + ['season', 'seasons'], ['selfie', 'selfies'], ['series', 'series'], ['service', 'services'], @@ -268,6 +275,7 @@ class InflectorTest extends TestCase ['tag', 'tags'], ['thief', ['thiefs', 'thieves']], ['tooth', 'teeth'], + ['treason', 'treasons'], ['tree', 'trees'], ['waltz', 'waltzes'], ['wife', 'wives'], From ee68b1dfa7c52ca00923ef8afef43cab5e765caf Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Tue, 23 Jul 2019 15:40:37 +0200 Subject: [PATCH 02/11] [Messenger][Profiler] Collect the stamps at the end of dispatch --- .../Bundle/WebProfilerBundle/CHANGELOG.md | 11 ++++--- .../views/Collector/messenger.html.twig | 16 ++++++++-- .../DataCollector/MessengerDataCollector.php | 1 + .../MessengerDataCollectorTest.php | 6 ++-- .../Tests/TraceableMessageBusTest.php | 31 ++++++++++++++++++- .../Messenger/TraceableMessageBus.php | 4 +-- src/Symfony/Component/VarDumper/CHANGELOG.md | 1 + 7 files changed, 58 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md b/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md index 253c125e12..d785a0fcd7 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md @@ -4,11 +4,12 @@ CHANGELOG 4.4.0 ----- - * Added button to clear the ajax request tab - * Deprecated the `ExceptionController::templateExists()` method - * Deprecated the `TemplateManager::templateExists()` method - * Deprecated the `ExceptionController` in favor of `ExceptionPanelController` - * Marked all classes of the WebProfilerBundle as internal + * added button to clear the ajax request tab + * deprecated the `ExceptionController::templateExists()` method + * deprecated the `TemplateManager::templateExists()` method + * deprecated the `ExceptionController` in favor of `ExceptionPanelController` + * marked all classes of the WebProfilerBundle as internal + * added a section with the stamps of a message after it is dispatched in the Messenger panel 4.3.0 ----- diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/messenger.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/messenger.html.twig index 6f2af8dd45..b48aaa82e5 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/messenger.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/messenger.html.twig @@ -45,7 +45,7 @@ {{ parent() }} '.$this->dumpHeader; } + /** + * {@inheritdoc} + */ + public function dumpString(Cursor $cursor, $str, $bin, $cut) + { + if ('' === $str && isset($cursor->attr['img-data'], $cursor->attr['content-type'])) { + $this->dumpKey($cursor); + $this->line .= $this->style('default', $cursor->attr['img-size'] ?? '', []).' '; + $this->endValue($cursor); + $this->line .= $this->indentPad; + $this->line .= sprintf('', $cursor->attr['content-type'], base64_encode($cursor->attr['img-data'])); + $this->endValue($cursor); + } else { + parent::dumpString($cursor, $str, $bin, $cut); + } + } + /** * {@inheritdoc} */ From 47ffbad82dab5217cdf39005385923138e81d76d Mon Sep 17 00:00:00 2001 From: Cyril PASCAL Date: Thu, 25 Jul 2019 10:32:30 +0200 Subject: [PATCH 08/11] Avoid using huge amount of memory when formatting long exception --- src/Symfony/Component/Console/Application.php | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 10ae964d8c..d90a2b00fb 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -1149,15 +1149,21 @@ class Application implements ResetInterface $utf8String = mb_convert_encoding($string, 'utf8', $encoding); $lines = []; $line = ''; - foreach (preg_split('//u', $utf8String) as $char) { - // test if $char could be appended to current line - if (mb_strwidth($line.$char, 'utf8') <= $width) { - $line .= $char; - continue; + + $offset = 0; + while (preg_match('/.{1,10000}/u', $utf8String, $m, 0, $offset)) { + $offset += \strlen($m[0]); + + foreach (preg_split('//u', $m[0]) as $char) { + // test if $char could be appended to current line + if (mb_strwidth($line.$char, 'utf8') <= $width) { + $line .= $char; + continue; + } + // if not, push current line to array and make new line + $lines[] = str_pad($line, $width); + $line = $char; } - // if not, push current line to array and make new line - $lines[] = str_pad($line, $width); - $line = $char; } $lines[] = \count($lines) ? str_pad($line, $width) : $line; From f7e8a96ffccc39d5b6820dd0ccc62b478858b6ad Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 27 Jul 2019 07:24:50 +0200 Subject: [PATCH 09/11] add missing changelog entry --- src/Symfony/Bundle/SecurityBundle/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md index 812c22eab6..230a252bc0 100644 --- a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md @@ -21,6 +21,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. From 8157db45229ae3e9326b854018a6e8ff6dec45fd Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 27 Jul 2019 08:08:43 +0200 Subject: [PATCH 10/11] add parameter type declarations to private methods --- src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php | 5 +---- .../Doctrine/DataCollector/DoctrineDataCollector.php | 4 ++-- .../RegisterEventListenersAndSubscribersPass.php | 7 ++----- src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php index 4496d3ac9a..8ecf2135d9 100644 --- a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php +++ b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php @@ -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)) { diff --git a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php index ee4c644f0e..a25a670e80 100644 --- a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php +++ b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php @@ -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']) { diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php index deaa64e7c9..6016c8ce09 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php @@ -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 = []; diff --git a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php index e7df3702eb..db9db4f286 100644 --- a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php +++ b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php @@ -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); } From da54325136242fb2de22606a1dfe58beceb13b23 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 27 Jul 2019 08:35:12 +0200 Subject: [PATCH 11/11] [FrameworkBundle] added type-hints on private methods --- .../FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php | 2 +- src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php index 340198e5e2..523d5a34b4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php @@ -85,7 +85,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer return true; } - private function readAllComponents(Reader $reader, $class) + private function readAllComponents(Reader $reader, string $class) { $reflectionClass = new \ReflectionClass($class); $reader->getClassAnnotations($reflectionClass); diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index b6ae6b7ecf..f1cb0fe14d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -141,7 +141,7 @@ class FrameworkBundle extends Bundle } } - private function addCompilerPassIfExists(ContainerBuilder $container, $class, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, $priority = 0) + private function addCompilerPassIfExists(ContainerBuilder $container, string $class, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0) { $container->addResource(new ClassExistenceResource($class));