8000 add known type · rectorphp/rector-symfony@463988c · GitHub
[go: up one dir, main page]

Skip to content

Commit 463988c

Browse files
committed
add known type
1 parent 14879e0 commit 463988c

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"symplify/easy-ci": "^11.2",
2424
"symplify/easy-coding-standard": "^12.0",
2525
"symplify/phpstan-extensions": "^11.1",
26-
"symplify/phpstan-rules": "^11.2",
26+
"symplify/phpstan-rules": "^12.0",
2727
"symplify/rule-doc-generator": "^12.0",
2828
"symplify/vendor-patches": "^11.2",
2929
"tomasvotruba/class-leak": "^0.1",

phpstan.neon

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,4 @@ parameters:
4242
# false positive
4343
- '#Access to an undefined property Rector\\Core\\Contract\\PhpParser\\Node\\StmtsAwareInterface\:\:\$stmts#'
4444
- '#but class PhpParser\\Node\\Stmt\\Expression is not generic#'
45-
- '#Class "Rector\\Symfony\\CodeQuality\\Rector\\ClassMethod\\ActionSuffixRemoverRector" is missing @see annotation with test case class reference#'
4645
- '#Cognitive complexity for "Rector\\Symfony\\CodeQuality\\Rector\\Closure\\StringExtensionToConfigBuilderRector\:\:create(.*?)\(\)" is 13, keep it under 10#'
47-
48-
- '#Parameter \#1 \$stmtsAware of method Rector\\Core\\NodeAnalyzer\\TerminatedNodeAnalyzer\:\:isAlwaysTerminated\(\) expects Rector\\Core\\Contract\\PhpParser\\Node\\StmtsAwareInterface, PhpParser\\Node\\Stmt\\ClassMethod given#'

rules-tests/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector/Fixture/manual-service_messagehandler.php.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Rector\Symfony\Tests\Symfony62\Rector\Class_\MessageHandlerInterfaceToAttributeRector\Fixture;
44

5-
use App\Message\SmsNotification;
5+
use Rector\Symfony\Tests\Symfony62\Rector\Class_\MessageHandlerInterfaceToAttributeRector\Source\SmsNotification;
66

7-
class ManualSmsNotificationHandler
7+
final class ManualSmsNotificationHandler
88
{
99
public function __invoke(SmsNotification $message)
1010
{
@@ -18,10 +18,10 @@ class ManualSmsNotificationHandler
1818

1919
namespace Rector\Symfony\Tests\Symfony62\Rector\Class_\MessageHandlerInterfaceToAttributeRector\Fixture;
2020

21-
use App\Message\SmsNotification;
21+
use Rector\Symfony\Tests\Symfony62\Rector\Class_\MessageHandlerInterfaceToAttributeRector\Source\SmsNotification;
2222

2323
#[\Symfony\Component\Messenger\Attribute\AsMessageHandler(priority: 10, fromTransport: 'async')]
24-
class ManualSmsNotificationHandler
24+
final class ManualSmsNotificationHandler
2525
{
2626
public function __invoke(SmsNotification $message)
2727
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Rector\Symfony\Tests\Symfony62\Rector\Class_\MessageHandlerInterfaceToAttributeRector\Source;
4+
5+
class SmsNotification
6+
{
7+
}

rules/Configs/Rector/Closure/ServiceSetStringNameToClassNameRector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ public function getNodeTypes(): array
6969
*/
7070
public function refactor(Node $node): ?Node
7171
{
72-
$hasChanged = false;
73-
7472
if (! $this->symfonyPhpClosureDetector->detect($node)) {
7573
return null;
7674
}

src/DataProvider/ServiceMapProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public function __construct(
2222

2323
public function provide(): ServiceMap
2424
{
25+
// avoid caching in tests
26+
if (defined('PHPUNIT_COMPOSER_INSTALL')) {
27+
$this->serviceMap = null;
28+
}
29+
2530
if ($this->serviceMap instanceof ServiceMap) {
2631
return $this->serviceMap;
2732
}

tests/Set/Symfony44/Fixture/event_fixture.php.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Rector\Symfony\Tests\Set\Symfony44\Fixture;
4+
35
class SomeEventListener
46
{
57
public function someMethod(\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $exceptionEvent)
@@ -13,6 +15,8 @@ class SomeEventListener
1315
-----
1416
<?php
1517

18+
namespace Rector\Symfony\Tests\Set\Symfony44\Fixture;
19+
1620
class SomeEventListener
1721
{
1822
public function someMethod(\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $exceptionEvent)

0 commit comments

Comments
 (0)
0