• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nepada / phpstan-message-bus / 11757945156

09 Nov 2024 05:00PM UTC coverage: 84.848% (-0.2%) from 85.075%
11757945156

push

github

xificurk
Forward compatibility: Eliminate instanceof on PHPStan types

10 of 13 new or added lines in 2 files covered. (76.92%)

56 of 66 relevant lines covered (84.85%)

1.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/MessageBus/CommandTypeExtractor.php
1
<?php
2
declare(strict_types = 1);
3

4
namespace Nepada\PHPStan\MessageBus;
5

6
use PhpParser\Node\Expr\MethodCall;
7
use PhpParser\Node\VariadicPlaceholder;
8
use PHPStan\Analyser\Scope;
9

10
class CommandTypeExtractor
11
{
12

13
    /**
14
     * @return list<string>
15
     */
16
    public function extractCommandType(MethodCall $methodCall, Scope $scope): array
17
    {
18
        if (count($methodCall->args) === 0) {
2✔
NEW
19
            return [];
×
20
        }
21

22
        $commandArgument = $methodCall->args[0];
2✔
23
        if ($commandArgument instanceof VariadicPlaceholder) {
2✔
NEW
24
            return [];
×
25
        }
26

27
        return $scope->getType($commandArgument->value)->getObjectClassNames();
2✔
28
    }
29

30
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc