Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bca5b04

Browse files
Rewrite in backward compatibility compliant way
1 parent 748eaac commit bca5b04

File tree

4 files changed

+71
-16
lines changed

4 files changed

+71
-16
lines changed

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
],
88
"require": {
99
"php": "^7.1 || ^8.0",
10-
"phpstan/phpstan": "^0.12.89"
10+
"phpstan/phpstan": "^0.12.85"
1111
},
1212
"conflict": {
1313
"doctrine/collections": "<1.0",
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Reflection\Doctrine;
4+
5+
use PHPStan\Reflection\ParameterReflection;
6+
use PHPStan\Reflection\PassedByReference;
7+
use PHPStan\Type\Type;
8+
9+
class DummyParameter implements ParameterReflection
10+
{
11+
12+
/** @var string */
13+
private $name;
14+
15+
/** @var Type */
16+
private $type;
17+
18+
/** @var bool */
19+
private $optional;
20+
21+
/** @var PassedByReference */
22+
private $passedByReference;
23+
24+
/** @var bool */
25+
private $variadic;
26+
27+
private ?\PHPStan\Type\Type $defaultValue;
28+
29+
public function __construct(string $name, Type $type, bool $optional, ?PassedByReference $passedByReference, bool $variadic, ?Type $defaultValue)
30+
{
31+
$this->name = $name;
32+
$this->type = $type;
33+
$this->optional = $optional;
34+
$this->passedByReference = $passedByReference ?? PassedByReference::createNo();
35+
$this->variadic = $variadic;
36+
$this->defaultValue = $defaultValue;
37+
}
38+
39+
public function getName(): string
40+
{
41+
return $this->name;
42+
}
43+
44+
public function isOptional(): bool
45+
{
46+
return $this->optional;
47+
}
48+
49+
public function getType(): Type
50+
{
51+
return $this->type;
52+
}
53+
54+
public function passedByReference(): PassedByReference
55+
{
56+
return $this->passedByReference;
57+
}
58+
59+
public function isVariadic(): bool
60+
{
61+
return $this->variadic;
62+
}
63+
64+
public function getDefaultValue(): ?Type
65+
{
66+
return $this->defaultValue;
67+
}
68+
69+
}

‎src/Reflection/Doctrine/MagicRepositoryMethodReflection.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use PHPStan\Reflection\ClassReflection;
66
use PHPStan\Reflection\FunctionVariant;
77
use PHPStan\Reflection\MethodReflection;
8-
use PHPStan\Reflection\Php\DummyParameter;
98
use PHPStan\TrinaryLogic;
109
use PHPStan\Type\Generic\TemplateTypeMap;
1110
use PHPStan\Type\MixedType;

‎tests/Rules/Doctrine/ORM/MagicRepositoryMethodCallRuleTest.php‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22

33
namespace PHPStan\Rules\Doctrine\ORM;
44

5-
use PHPStan\Php\PhpVersion;
6-
use PHPStan\Rules\FunctionCallParametersCheck;
75
use PHPStan\Rules\Methods\CallMethodsRule;
8-
use PHPStan\Rules\NullsafeCheck;
9-
use PHPStan\Rules\PhpDoc\UnresolvableTypeHelper;
106
use PHPStan\Rules\Rule;
11-
use PHPStan\Rules\RuleLevelHelper;
127
use PHPStan\Testing\RuleTestCase;
138

149
/**
@@ -19,15 +14,7 @@ class MagicRepositoryMethodCallRuleTest extends RuleTestCase
1914

2015
protected function getRule(): Rule
2116
{
22-
$broker = $this->createBroker();
23-
$ruleLevelHelper = new RuleLevelHelper($broker, true, false, true);
24-
return new CallMethodsRule(
25-
$broker,
26-
new FunctionCallParametersCheck($ruleLevelHelper, new NullsafeCheck(), new PhpVersion(PHP_VERSION_ID), new UnresolvableTypeHelper(true), true, true, true, true, true),
27-
$ruleLevelHelper,
28-
true,
29-
true
30-
);
17+
return self::getContainer()->getByType(CallMethodsRule::class);
3118
}
3219

3320
/**

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /