Skip to content

Commit 81aaff9

Browse files
committed
[BE] Specify explicit mixed array type via is_array
1 parent 36dde49 commit 81aaff9

File tree

5 files changed

+2
-11
lines changed

5 files changed

+2
-11
lines changed

changelog-2.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ Bleeding edge (TODO move to other sections)
6060
=====================
6161

6262
* Report useless `array_filter()` calls ([#1077](https://github.com/phpstan/phpstan-src/pull/1077)), #6840, thanks @leongersen!
63-
* Specify explicit mixed array type via `is_array` ([#1191](https://github.com/phpstan/phpstan-src/pull/1191)), thanks @herndlm!
6463
* Rules for checking direct calls to `__construct()` (level 2) ([#1208](https://github.com/phpstan/phpstan-src/pull/1208)), #7022, thanks @muno92!
6564
* ConstantLooseComparisonRule - level 4 (https://github.com/phpstan/phpstan-src/commit/6ebf2361a3c831dd105a815521889428c295dc9f)
6665
* Support `@readonly` property and `@immutable` class PHPDoc ([#1295](https://github.com/phpstan/phpstan-src/pull/1295), [#1335](https://github.com/phpstan/phpstan-src/pull/1335)), #4082, thanks @herndlm!
@@ -128,6 +127,7 @@ Improvements 🔧
128127
* Fix position variance of static method parameters ([#2313](https://github.com/phpstan/phpstan-src/pull/2313)), thanks @jiripudil!
129128
* Empty `skipCheckGenericClasses` (https://github.com/phpstan/phpstan-src/commit/28c2c79b16cac6ba6b01f1b4d211541dd49d8a77)
130129
* Report unnecessary nullsafe property fetch inside `??` / `isset` / `empty` with different message ([#1253](https://github.com/phpstan/phpstan-src/pull/1253)), thanks @rajyan!
130+
* Specify explicit mixed array type via `is_array` ([#1191](https://github.com/phpstan/phpstan-src/pull/1191)), thanks @herndlm!
131131

132132
Bugfixes 🐛
133133
=====================

conf/bleedingEdge.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ parameters:
44
skipCheckGenericClasses!: []
55
stricterFunctionMap: true
66

7-
explicitMixedViaIsArray: true
87
arrayFilter: true
98
arrayValues: true
109
looseComparison: true

conf/config.neon

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ parameters:
2424
bleedingEdge: false
2525
disableRuntimeReflectionProvider: true
2626
skipCheckGenericClasses: []
27-
explicitMixedViaIsArray: false
2827
arrayFilter: false
2928
arrayValues: false
3029
illegalConstructorMethodCall: false
@@ -1722,8 +1721,6 @@ services:
17221721
class: PHPStan\Type\Php\IsArrayFunctionTypeSpecifyingExtension
17231722
tags:
17241723
- phpstan.typeSpecifier.functionTypeSpecifyingExtension
1725-
arguments:
1726-
explicitMixed: %featureToggles.explicitMixedViaIsArray%
17271724

17281725
-
17291726
class: PHPStan\Type\Php\IsCallableFunctionTypeSpecifyingExtension

conf/parametersSchema.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ parametersSchema:
3030
bleedingEdge: bool(),
3131
disableRuntimeReflectionProvider: bool(),
3232
skipCheckGenericClasses: listOf(string()),
33-
explicitMixedViaIsArray: bool(),
3433
arrayFilter: bool(),
3534
arrayValues: bool(),
3635
illegalConstructorMethodCall: bool(),

src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ final class IsArrayFunctionTypeSpecifyingExtension implements FunctionTypeSpecif
2020

2121
private TypeSpecifier $typeSpecifier;
2222

23-
public function __construct(private bool $explicitMixed)
24-
{
25-
}
26-
2723
public function isFunctionSupported(FunctionReflection $functionReflection, FuncCall $node, TypeSpecifierContext $context): bool
2824
{
2925
return strtolower($functionReflection->getName()) === 'is_array'
@@ -39,7 +35,7 @@ public function specifyTypes(FunctionReflection $functionReflection, FuncCall $n
3935
throw new ShouldNotHappenException();
4036
}
4137

42-
return $this->typeSpecifier->create($node->getArgs()[0]->value, new ArrayType(new MixedType($this->explicitMixed), new MixedType($this->explicitMixed)), $context, $scope);
38+
return $this->typeSpecifier->create($node->getArgs()[0]->value, new ArrayType(new MixedType(true), new MixedType(true)), $context, $scope);
4339
}
4440

4541
public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void

0 commit comments

Comments
 (0)