Skip to content

Commit 4399504

Browse files
committed
[BE] Report useless array_values() calls
1 parent e47eee3 commit 4399504

File tree

5 files changed

+3
-8
lines changed

5 files changed

+3
-8
lines changed

changelog-2.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Major new features 🚀
2828
* Report useless return values of function calls like `var_export` without `$return=true` (level 0) ([#3225](https://github.com/phpstan/phpstan-src/pull/3225)), #11320, thanks @staabm!
2929
* Rule for `call_user_func()` (level 5) ([#2479](https://github.com/phpstan/phpstan-src/pull/2479)), thanks @staabm!
3030
* Report useless `array_filter()` calls (level 5) ([#1077](https://github.com/phpstan/phpstan-src/pull/1077)), #6840, thanks @leongersen!
31+
* Report useless `array_values()` calls (level 5) ([#2917](https://github.com/phpstan/phpstan-src/pull/2917)), thanks @kamil-zacek!
3132
* Check if required file exists (level 0) ([#3294](https://github.com/phpstan/phpstan-src/pull/3294)), #3397, thanks @Bellangelo!
3233
* ConstantLooseComparisonRule - level 4 (https://github.com/phpstan/phpstan-src/commit/6ebf2361a3c831dd105a815521889428c295dc9f)
3334
* Check array functions which require stringish values (level 5) ([#3132](https://github.com/phpstan/phpstan-src/pull/3132)), #11141, #5848, #3694, #11111, thanks @schlndh!
@@ -76,7 +77,6 @@ Bleeding edge (TODO move to other sections)
7677
* Report unused result of ternary (https://github.com/phpstan/phpstan-src/commit/9664f7a9d2223c07e750f0dfc949c3accfa6b65e)
7778
* Report unused results of `&&` and `||` (https://github.com/phpstan/phpstan-src/commit/cf2c8bbd9ebd2ebe300dbd310e136ad603d7def3)
7879
* Add option `reportAnyTypeWideningInVarTag` ([#2840](https://github.com/phpstan/phpstan-src/pull/2840)), thanks @janedbal!
79-
* `array_values` rule (report when a `list` type is always passed in) ([#2917](https://github.com/phpstan/phpstan-src/pull/2917)), thanks @kamil-zacek!
8080
* Fix checking generic `mixed` type based on config ([#2885](https://github.com/phpstan/phpstan-src/pull/2885)), thanks @schlndh!
8181
* Checking truthiness of `@phpstan-pure` above functions and methods
8282
* Check `new`/function call/method call/static method call on a separate line without any side effects even without `@phpstan-pure` PHPDoc tag on the declaration side

conf/bleedingEdge.neon

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ parameters:
44
skipCheckGenericClasses!: []
55
stricterFunctionMap: true
66

7-
arrayValues: true
87
readOnlyByPhpDoc: true
98
pure: true

conf/config.level5.neon

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ parameters:
55
checkFunctionArgumentTypes: true
66
checkArgumentsPassedByReference: true
77

8-
conditionalTags:
9-
PHPStan\Rules\Functions\ArrayValuesRule:
10-
phpstan.rules.rule: %featureToggles.arrayValues%
11-
128
rules:
139
- PHPStan\Rules\DateTimeInstantiationRule
1410
- PHPStan\Rules\Functions\CallUserFuncRule
@@ -37,3 +33,5 @@ services:
3733
arguments:
3834
treatPhpDocTypesAsCertain: %treatPhpDocTypesAsCertain%
3935
treatPhpDocTypesAsCertainTip: %tips.treatPhpDocTypesAsCertain%
36+
tags:
37+
- phpstan.rules.rule

conf/config.neon

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ parameters:
2323
featureToggles:
2424
bleedingEdge: false
2525
skipCheckGenericClasses: []
26-
arrayValues: false
2726
illegalConstructorMethodCall: false
2827
readOnlyByPhpDoc: false
2928
stricterFunctionMap: false

conf/parametersSchema.neon

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ parametersSchema:
2929
featureToggles: structure([
3030
bleedingEdge: bool(),
3131
skipCheckGenericClasses: listOf(string()),
32-
arrayValues: bool(),
3332
illegalConstructorMethodCall: bool(),
3433
readOnlyByPhpDoc: bool()
3534
stricterFunctionMap: bool()

0 commit comments

Comments
 (0)