Skip to content

Commit ae5f990

Browse files
committed
[BE] Use explicit mixed for global array variables
1 parent 9db564b commit ae5f990

File tree

8 files changed

+2
-13
lines changed

8 files changed

+2
-13
lines changed

changelog-2.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Bleeding edge (TODO move to other sections)
3030
* ApiInstanceofRule
3131
* Report `instanceof` of classes not covered by backward compatibility promise (https://github.com/phpstan/phpstan-src/commit/ff4d02d62a7a2e2c4d928d48d31d49246dba7139)
3232
* Report `instanceof` of classes covered by backward compatibility promise but where the assumption might change (https://github.com/phpstan/phpstan-src/commit/996bc69fa977aa64f601bd82b8a0ae39be0cbeef)
33-
* Use explicit mixed for global array variables ([#1411](https://github.com/phpstan/phpstan-src/pull/1411)), thanks @herndlm!
3433
* Add `@readonly` rule that disallows default values ([#1391](https://github.com/phpstan/phpstan-src/pull/1391)), thanks @herndlm!
3534
* Improve error wording of the NonexistentOffset, BooleanAndConstantConditionRule, and BooleanOrConstantConditionRule ([#1882](https://github.com/phpstan/phpstan-src/pull/1882)), thanks @VincentLanglet!
3635
* MissingMagicSerializationMethodsRule ([#1711](https://github.com/phpstan/phpstan-src/pull/1711)), #7482, thanks @staabm!
@@ -139,6 +138,7 @@ Improvements 🔧
139138
* Require identifier in custom rules (https://github.com/phpstan/phpstan-src/commit/969e6fa31d5484d42dab902703cfc6820a983cfd)
140139
* New `RuleLevelHelper::accepts()` behaviour (https://github.com/phpstan/phpstan-src/commit/941fc815db49315b8783dc466cf593e0d8a85d23)
141140
* Infer explicit mixed when instantiating generic class with unknown template types (https://github.com/phpstan/phpstan-src/commit/089d4c6fb6eb709c44123548d33990113d174b86), #6398
141+
* Use explicit mixed for global array variables ([#1411](https://github.com/phpstan/phpstan-src/pull/1411)), thanks @herndlm!
142142

143143
Bugfixes 🐛
144144
=====================

conf/bleedingEdge.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ parameters:
22
featureToggles:
33
bleedingEdge: true
44
skipCheckGenericClasses!: []
5-
explicitMixedForGlobalVariables: true
65
explicitMixedViaIsArray: true
76
arrayFilter: true
87
arrayUnpacking: true

conf/config.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ parameters:
3636
- CachingIterator
3737
- RegexIterator
3838
- ReflectionEnum
39-
explicitMixedForGlobalVariables: false
4039
explicitMixedViaIsArray: false
4140
arrayFilter: false
4241
arrayUnpacking: false

conf/parametersSchema.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ parametersSchema:
3131
bleedingEdge: bool(),
3232
disableRuntimeReflectionProvider: bool(),
3333
skipCheckGenericClasses: listOf(string()),
34-
explicitMixedForGlobalVariables: bool(),
3534
explicitMixedViaIsArray: bool(),
3635
arrayFilter: bool(),
3736
arrayUnpacking: bool(),

src/Analyser/DirectInternalScopeFactory.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public function __construct(
3535
private Parser $parser,
3636
private NodeScopeResolver $nodeScopeResolver,
3737
private PhpVersion $phpVersion,
38-
private bool $explicitMixedForGlobalVariables,
3938
private ConstantResolver $constantResolver,
4039
)
4140
{
@@ -102,7 +101,6 @@ public function create(
102101
$afterExtractCall,
103102
$parentScope,
104103
$nativeTypesPromoted,
105-
$this->explicitMixedForGlobalVariables,
106104
);
107105
}
108106

src/Analyser/LazyInternalScopeFactory.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
final class LazyInternalScopeFactory implements InternalScopeFactory
2121
{
2222

23-
private bool $explicitMixedForGlobalVariables;
24-
2523
/**
2624
* @param class-string $scopeClass
2725
*/
@@ -30,7 +28,6 @@ public function __construct(
3028
private Container $container,
3129
)
3230
{
33-
$this->explicitMixedForGlobalVariables = $this->container->getParameter('featureToggles')['explicitMixedForGlobalVariables'];
3431
}
3532

3633
/**
@@ -94,7 +91,6 @@ public function create(
9491
$afterExtractCall,
9592
$parentScope,
9693
$nativeTypesPromoted,
97-
$this->explicitMixedForGlobalVariables,
9894
);
9995
}
10096

src/Analyser/MutatingScope.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ public function __construct(
220220
private bool $afterExtractCall = false,
221221
private ?Scope $parentScope = null,
222222
private bool $nativeTypesPromoted = false,
223-
private bool $explicitMixedForGlobalVariables = false,
224223
)
225224
{
226225
if ($namespace === '') {
@@ -537,7 +536,7 @@ public function getVariableType(string $variableName): Type
537536
}
538537

539538
if ($this->isGlobalVariable($variableName)) {
540-
return new ArrayType(new BenevolentUnionType([new IntegerType(), new StringType()]), new MixedType($this->explicitMixedForGlobalVariables));
539+
return new ArrayType(new BenevolentUnionType([new IntegerType(), new StringType()]), new MixedType(true));
541540
}
542541

543542
if ($this->hasVariableType($variableName)->no()) {

src/Testing/PHPStanTestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ public static function createScopeFactory(ReflectionProvider $reflectionProvider
188188
self::getParser(),
189189
$container->getByType(NodeScopeResolver::class),
190190
$container->getByType(PhpVersion::class),
191-
$container->getParameter('featureToggles')['explicitMixedForGlobalVariables'],
192191
$constantResolver,
193192
),
194193
);

0 commit comments

Comments
 (0)