Skip to content

Commit d45a640

Browse files
committed
Uncover everything behind the bleedingEdge flag
1 parent d198a78 commit d45a640

File tree

5 files changed

+3
-32
lines changed

5 files changed

+3
-32
lines changed

rules.neon

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,10 @@ parametersSchema:
2323
rules:
2424
- PHPStan\Rules\Doctrine\ORM\DqlRule
2525
- PHPStan\Rules\Doctrine\ORM\RepositoryMethodCallRule
26+
- PHPStan\Rules\Doctrine\ORM\EntityConstructorNotFinalRule
27+
- PHPStan\Rules\Doctrine\ORM\EntityMappingExceptionRule
2628
- PHPStan\Rules\Doctrine\ORM\EntityNotFinalRule
2729

28-
conditionalTags:
29-
PHPStan\Rules\Doctrine\ORM\EntityMappingExceptionRule:
30-
phpstan.rules.rule: %featureToggles.bleedingEdge%
31-
PHPStan\Rules\Doctrine\ORM\EntityConstructorNotFinalRule:
32-
phpstan.rules.rule: %featureToggles.bleedingEdge%
33-
3430
services:
3531
-
3632
class: PHPStan\Rules\Doctrine\ORM\QueryBuilderDqlRule
@@ -43,23 +39,15 @@ services:
4339
arguments:
4440
reportUnknownTypes: %doctrine.reportUnknownTypes%
4541
allowNullablePropertyForRequiredField: %doctrine.allowNullablePropertyForRequiredField%
46-
bleedingEdge: %featureToggles.bleedingEdge%
4742
descriptorRegistry: @doctrineTypeDescriptorRegistry
4843
tags:
4944
- phpstan.rules.rule
50-
-
51-
class: PHPStan\Rules\Doctrine\ORM\EntityMappingExceptionRule
52-
-
53-
class: PHPStan\Rules\Doctrine\ORM\EntityNotFinalRule
5445
-
5546
class: PHPStan\Rules\Doctrine\ORM\EntityRelationRule
5647
arguments:
5748
allowNullablePropertyForRequiredField: %doctrine.allowNullablePropertyForRequiredField%
58-
bleedingEdge: %featureToggles.bleedingEdge%
5949
tags:
6050
- phpstan.rules.rule
61-
-
62-
class: PHPStan\Rules\Doctrine\ORM\EntityConstructorNotFinalRule
6351
-
6452
class: PHPStan\Classes\DoctrineProxyForbiddenClassNamesExtension
6553
tags:

src/Rules/Doctrine/ORM/EntityColumnRule.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,19 @@ class EntityColumnRule implements Rule
4444

4545
private bool $allowNullablePropertyForRequiredField;
4646

47-
private bool $bleedingEdge;
48-
4947
public function __construct(
5048
ObjectMetadataResolver $objectMetadataResolver,
5149
DescriptorRegistry $descriptorRegistry,
5250
ReflectionProvider $reflectionProvider,
5351
bool $reportUnknownTypes,
5452
bool $allowNullablePropertyForRequiredField,
55-
bool $bleedingEdge
5653
)
5754
{
5855
$this->objectMetadataResolver = $objectMetadataResolver;
5956
$this->descriptorRegistry = $descriptorRegistry;
6057
$this->reflectionProvider = $reflectionProvider;
6158
$this->reportUnknownTypes = $reportUnknownTypes;
6259
$this->allowNullablePropertyForRequiredField = $allowNullablePropertyForRequiredField;
63-
$this->bleedingEdge = $bleedingEdge;
6460
}
6561

6662
public function getNodeType(): string
@@ -70,9 +66,6 @@ public function getNodeType(): string
7066

7167
public function processNode(Node $node, Scope $scope): array
7268
{
73-
if (!$this->bleedingEdge && !$this->objectMetadataResolver->hasObjectManagerLoader()) {
74-
return [];
75-
}
7669
$class = $scope->getClassReflection();
7770
if ($class === null) {
7871
return [];

src/Rules/Doctrine/ORM/EntityRelationRule.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,13 @@ class EntityRelationRule implements Rule
3232

3333
private bool $allowNullablePropertyForRequiredField;
3434

35-
private bool $bleedingEdge;
36-
3735
public function __construct(
3836
ObjectMetadataResolver $objectMetadataResolver,
39-
bool $allowNullablePropertyForRequiredField,
40-
bool $bleedingEdge
37+
bool $allowNullablePropertyForRequiredField
4138
)
4239
{
4340
$this->objectMetadataResolver = $objectMetadataResolver;
4441
$this->allowNullablePropertyForRequiredField = $allowNullablePropertyForRequiredField;
45-
$this->bleedingEdge = $bleedingEdge;
4642
}
4743

4844
public function getNodeType(): string
@@ -52,10 +48,6 @@ public function getNodeType(): string
5248

5349
public function processNode(Node $node, Scope $scope): array
5450
{
55-
if (!$this->bleedingEdge && !$this->objectMetadataResolver->hasObjectManagerLoader()) {
56-
return [];
57-
}
58-
5951
$class = $scope->getClassReflection();
6052
if ($class === null) {
6153
return [];

tests/Rules/Doctrine/ORM/EntityColumnRuleTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ protected function getRule(): Rule
8383
$this->createReflectionProvider(),
8484
true,
8585
$this->allowNullablePropertyForRequiredField,
86-
true,
8786
);
8887
}
8988

tests/Rules/Doctrine/ORM/EntityRelationRuleTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ protected function getRule(): Rule
2323
return new EntityRelationRule(
2424
new ObjectMetadataResolver($this->objectManagerLoader, __DIR__ . '/../../../../tmp'),
2525
$this->allowNullablePropertyForRequiredField,
26-
true,
2726
);
2827
}
2928

0 commit comments

Comments
 (0)