Skip to content

Commit 320e495

Browse files
feature #30323 [ErrorHandler] trigger deprecation in DebugClassLoader when child class misses a return type (fancyweb, nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [ErrorHandler] trigger deprecation in DebugClassLoader when child class misses a return type | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #30123 | License | MIT | Doc PR | TODO I wanted to push something to show the advancement and get feedback. I pushed two versions : one with dedicated functions for code clarity (DebugClassLoader.php) and one withtout (DebugClassLoader___.php). It would be nice if some people with Blackfire could compare the performances. So let's be clear, we are never gonna be able to cover all cases! We can however cover the vast majority. Current non covered cases and problems : - We assume that if there is more than 2 returned types, we cannot do anything. Even if it could technically be possible. - We assume that any returned type that doesn't fit our "returnable" types list is a class. We don't check at all if this class actualy exists. - We don't handle spaces in types. The types stop at the first space. - That means we don't handle (yet) the callable type with spaces (cf #29969) - Vendor code extending other vendor core triggers the deprecations 😕 Commits ------- aa338c8 Import return annotations from vendors 10fc13e [ErrorHandler] Handle return types in DebugClassLoader
2 parents c8e15e1 + aa338c8 commit 320e495

File tree

84 files changed

+1129
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1129
-22
lines changed

src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function __construct(ContainerInterface $container)
3939

4040
/**
4141
* {@inheritdoc}
42+
*
43+
* @return void
4244
*/
4345
public function dispatchEvent($eventName, EventArgs $eventArgs = null)
4446
{
@@ -59,6 +61,8 @@ public function dispatchEvent($eventName, EventArgs $eventArgs = null)
5961

6062
/**
6163
* {@inheritdoc}
64+
*
65+
* @return object[][]
6266
*/
6367
public function getListeners($event = null)
6468
{
@@ -81,6 +85,8 @@ public function getListeners($event = null)
8185

8286
/**
8387
* {@inheritdoc}
88+
*
89+
* @return bool
8490
*/
8591
public function hasListeners($event)
8692
{
@@ -89,6 +95,8 @@ public function hasListeners($event)
8995

9096
/**
9197
* {@inheritdoc}
98+
*
99+
* @return void
92100
*/
93101
public function addEventListener($events, $listener)
94102
{
@@ -109,6 +117,8 @@ public function addEventListener($events, $listener)
109117

110118
/**
111119
* {@inheritdoc}
120+
*
121+
* @return void
112122
*/
113123
public function removeEventListener($events, $listener)
114124
{

src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch
3434

3535
/**
3636
* {@inheritdoc}
37+
*
38+
* @return void
3739
*/
3840
public function startQuery($sql, array $params = null, array $types = null)
3941
{
@@ -48,6 +50,8 @@ public function startQuery($sql, array $params = null, array $types = null)
4850

4951
/**
5052
* {@inheritdoc}
53+
*
54+
* @return void
5155
*/
5256
public function stopQuery()
5357
{

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ abstract class ManagerRegistry extends AbstractManagerRegistry
2929

3030
/**
3131
* {@inheritdoc}
32+
*
33+
* @return object
3234
*/
3335
protected function getService($name)
3436
{
@@ -37,6 +39,8 @@ protected function getService($name)
3739

3840
/**
3941
* {@inheritdoc}
42+
*
43+
* @return void
4044
*/
4145
protected function resetService($name)
4246
{

src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ final class TestRepositoryFactory implements RepositoryFactory
2828

2929
/**
3030
* {@inheritdoc}
31+
*
32+
* @return ObjectRepository
3133
*/
3234
public function getRepository(EntityManagerInterface $entityManager, $entityName)
3335
{

src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public function convertToPHPValue($value, AbstractPlatform $platform)
3434

3535
/**
3636
* {@inheritdoc}
37+
*
38+
* @return string
3739
*/
3840
public function getName()
3941
{

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class DoctrineFooType extends Type
2727

2828
/**
2929
* {@inheritdoc}
30+
*
31+
* @return string
3032
*/
3133
public function getName()
3234
{
@@ -35,6 +37,8 @@ public function getName()
3537

3638
/**
3739
* {@inheritdoc}
40+
*
41+
* @return string
3842
*/
3943
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
4044
{
@@ -76,6 +80,8 @@ public function convertToPHPValue($value, AbstractPlatform $platform)
7680

7781
/**
7882
* {@inheritdoc}
83+
*
84+
* @return bool
7985
*/
8086
public function requiresSQLCommentHint(AbstractPlatform $platform)
8187
{

src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ protected function sendHeader($header, $content)
7272

7373
/**
7474
* Override default behavior since we check it in onKernelResponse.
75+
*
76+
* @return bool
7577
*/
7678
protected function headersAccepted()
7779
{

src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Monolog\Handler;
1313

14+
use Monolog\Formatter\FormatterInterface;
1415
use Monolog\Formatter\LineFormatter;
1516
use Monolog\Handler\AbstractProcessingHandler;
1617
use Monolog\Logger;
@@ -73,6 +74,8 @@ public function __construct(OutputInterface $output = null, bool $bubble = true,
7374

7475
/**
7576
* {@inheritdoc}
77+
*
78+
* @return bool
7679
*/
7780
public function isHandling(array $record)
7881
{
@@ -81,6 +84,8 @@ public function isHandling(array $record)
8184

8285
/**
8386
* {@inheritdoc}
87+
*
88+
* @return bool
8489
*/
8590
public function handle(array $record)
8691
{
@@ -142,6 +147,8 @@ public static function getSubscribedEvents()
142147

143148
/**
144149
* {@inheritdoc}
150+
*
151+
* @return void
145152
*/
146153
protected function write(array $record)
147154
{
@@ -151,6 +158,8 @@ protected function write(array $record)
151158

152159
/**
153160
* {@inheritdoc}
161+
*
162+
* @return FormatterInterface
154163
*/
155164
protected function getDefaultFormatter()
156165
{

src/Symfony/Bridge/Monolog/Handler/FingersCrossed/HttpCodeActivationStrategy.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public function __construct(RequestStack $requestStack, array $exclusions, $acti
4545
$this->exclusions = $exclusions;
4646
}
4747

48+
/**
49+
* @return bool
50+
*/
4851
public function isHandlerActivated(array $record)
4952
{
5053
$isActivated = parent::isHandlerActivated($record);

src/Symfony/Bridge/Monolog/Handler/FingersCrossed/NotFoundActivationStrategy.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public function __construct(RequestStack $requestStack, array $excludedUrls, $ac
3434
$this->blacklist = '{('.implode('|', $excludedUrls).')}i';
3535
}
3636

37+
/**
38+
* @return bool
39+
*/
3740
public function isHandlerActivated(array $record)
3841
{
3942
$isActivated = parent::isHandlerActivated($record);

0 commit comments

Comments
 (0)