Repository navigation
Write through an ArrayAccess item of an array with its offsetSet() - #14422
Merged
Merged
Conversation
…eading the array An assignment into an item of an array (`$bags['k'][] = $v`) took the item as a new one: an item that is an ArrayAccess object wasn't written through its offsetSet(), so the value wasn't checked, and the array holding it was reported unused. The item keeps what the array may hold, and writing through an object reads the array.
Contributor
✅ Performance: unchanged · Types: increased · Taint: +1 −5
How to read this table
✅ symfony: issues +6 −0Memory 3 596 → 3 596 MB (<0.1 %) · Wall 264.3 → 262.9 s (−0.5 %) Weighted 98 386 → 98 398 (+12, +0.01 %): L1 +3 · L3 +3
Added (6)
✅ drupal: issues +113 −36Memory 4 839 → 4 840 MB (<0.1 %) · Wall 179.8 → 180.1 s (+0.2 %) Weighted 169 202 → 169 347 (+145, +0.09 %): L1 +55 · L3 +22 · L6 +4 Taint 583 → 579 (+1 −5)
Changed in place (20) @@ 7 places @@
core/lib/Drupal/Core/Datetime/Element/Datelist.php:202
core/lib/Drupal/Core/Datetime/Element/Datelist.php:208
core/lib/Drupal/Core/Datetime/Element/Datelist.php:215
core/lib/Drupal/Core/Datetime/Element/Datelist.php:222
core/lib/Drupal/Core/Datetime/Element/Datelist.php:228
core/lib/Drupal/Core/Datetime/Element/Datelist.php:234
core/lib/Drupal/Core/Datetime/Element/Datelist.php:240
- MixedArgument: Argument 1 of DateHelper::days cannot be array{'#attributes': array{title: ''|TranslatableMarkup}|mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options':…
- PossiblyInvalidArgument: Argument 1 of DateHelper::days expects bool, but possibly different type array{'#attributes': array{title: ''|TranslatableMarkup}|mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error…
+ MixedArgument: Argument 1 of DateHelper::days cannot be array{'#attributes': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': mixed, '#title': ''|TranslatableMarkup, '#type': 'select'|'textfield', '#value': int|mixed|string, title: ''|TranslatableM…
+ PossiblyInvalidArgument: Argument 1 of DateHelper::days expects bool, but possibly different type array{'#attributes': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': mixed, '#title': ''|TranslatableMarkup, '#type': 'select'|'textfield', '#value': int|mixed…
@@ core/lib/Drupal/Core/Datetime/Element/Datelist.php:214 @@
- MixedArgument: Argument 1 of Datelist::datetimeRangeYears cannot be array{'#attributes': array{title: ''|TranslatableMarkup}|mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options':…
- PossiblyInvalidArgument: Argument 1 of Datelist::datetimeRangeYears expects string, but possibly different type array{'#attributes': array{title: ''|TranslatableMarkup}|mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#err…
+ MixedArgument: Argument 1 of Datelist::datetimeRangeYears cannot be array{'#attributes': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': mixed, '#title': ''|TranslatableMarkup, '#type': 'select'|'textfield', '#value': int|mixed|string, title: ''|TranslatableM…
+ PossiblyInvalidArgument: Argument 1 of Datelist::datetimeRangeYears expects string, but possibly different type array{'#attributes': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': mixed, '#title': ''|TranslatableMarkup, '#type': 'select'|'textfield', '#value': int|mix…
@@ core/lib/Drupal/Core/Datetime/Element/Datelist.php:221 @@
- MixedArgument: Argument 2 of in_array cannot be array{'#attributes': array{title: ''|TranslatableMarkup}|mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options':…
- PossiblyInvalidArgument: Argument 2 of in_array expects array<array-key, mixed>, but possibly different type array{'#attributes': array{title: ''|TranslatableMarkup}|mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': array{'#attributes': mixed, '#empty_option': ''|Translat…
+ MixedArgument: Argument 2 of in_array cannot be array{'#attributes': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': mixed, '#title': ''|TranslatableMarkup, '#type': 'select'|'textfield', '#value': int|mixed|string, title: ''|TranslatableM…
+ PossiblyInvalidArgument: Argument 2 of in_array expects array<array-key, mixed>, but possibly different type array{'#attributes': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': mixed, '#title': ''|TranslatableMarkup, '#type': 'select'|'textfield', …
@@ 2 places @@
core/lib/Drupal/Core/Datetime/Element/Datelist.php:228
core/lib/Drupal/Core/Datetime/Element/Datelist.php:234
- MixedArgument: Argument 3 of DateHelper::minutes cannot be array{'#attributes': array{title: ''|TranslatableMarkup}|mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options':…
- PossiblyInvalidArgument: Argument 3 of DateHelper::minutes expects int, but possibly different type array{'#attributes': array{title: ''|TranslatableMarkup}|mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_…
+ MixedArgument: Argument 3 of DateHelper::minutes cannot be array{'#attributes': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': mixed, '#title': ''|TranslatableMarkup, '#type': 'select'|'textfield', '#value': int|mixed|string, title: ''|TranslatableM…
+ PossiblyInvalidArgument: Argument 3 of DateHelper::minutes expects int, but possibly different type array{'#attributes': array{'#attributes': mixed, '#empty_option': ''|TranslatableMarkup, '#error_no_message': false, '#options': array<array-key, mixed>, '#required': mixed, '#title': ''|TranslatableMarkup, '#type': 'select'|'textfield', '#value': int|mixed|…
@@ core/lib/Drupal/Core/Extension/module.api.php:540 ReferenceConstraintViolation @@
- …function: 'my_profile_install_configure_form'}, ...<array-key, string>} type found. Use…
+ …function: 'my_profile_install_configure_form'}|string, ...<array-key, string>} type found. Use…
@@ core/modules/block/src/BlockListBuilder.php:327 InvalidArrayOffset @@
- …using offset value of 'region', expecting -5|-4|-3|-2|-1|0|1|2|3|4
+ …using offset value of 'region', expecting '#attributes'|'drupalSettings'|'id'|'info'|'message'|'operations'|'region-theme'|'title'|'type'|'weight'|int
@@ core/modules/toolbar/toolbar.module:63 @@
- InvalidPropertyAssignmentValue: $element->options with declared type 'array<array-key, string>' cannot be assigned type 'array{attributes: array{id: non-falsy-string}, ...<array-key, string>}'
+ InvalidArrayOffset: Cannot access value on variable $element->options['attributes']['id'] using offset value of 'id', expecting int
+ InvalidPropertyAssignmentValue: $element->options with declared type 'array<array-key, string>' cannot be assigned type 'array{attributes: array{id: non-falsy-string}|string, ...<array-key, string>}'
@@ core/modules/toolbar/toolbar.module:64 @@
- InvalidPropertyAssignmentValue: $element->options with declared type 'array<array-key, string>' cannot be assigned type 'array{attributes: array{class: non-empty-list<'toolbar-icon'>, id: non-falsy-string}, ...<array-key, string>}'
+ InvalidArrayOffset: Cannot access value on variable $element->options['attributes']['class'] using offset value of 'class', expecting int
+ InvalidPropertyAssignmentValue: $element->options with declared type 'array<array-key, string>' cannot be assigned type 'array{attributes: array{class: list<'toolbar-icon'>|mixed, id: non-falsy-string}|string, ...<array-key, string>}'
+ MixedArrayAssignment: Cannot access array value on mixed variable $element->options['attributes']['class']
@@ core/modules/toolbar/toolbar.module:65 @@
- InvalidPropertyAssignmentValue: $element->options with declared type 'array<array-key, string>' cannot be assigned type 'array{attributes: array{class: non-empty-list<non-empty-lowercase-string>, id: non-falsy-string}, ...<array-key, string>}'
+ InvalidPropertyAssignmentValue: $element->options with declared type 'array<array-key, string>' cannot be assigned type 'array{attributes: array{class: mixed|non-empty-list<non-empty-lowercase-string>, id: non-falsy-string}|string, ...<array-key, string>}'
+ MixedArrayAssignment: Cannot access array value on mixed variable $element->options['attributes']['class']
+ PossiblyInvalidArrayOffset: Cannot access value on variable $element->options['attributes']['class'] using offset value of 'class', expecting int
@@ core/modules/toolbar/toolbar.module:67 @@
- InvalidPropertyAssignmentValue: $element->options with declared type 'array<array-key, string>' cannot be assigned type 'array{attributes: array{class: non-empty-list<non-empty-lowercase-string>, id: non-falsy-string, title: string}, ...<array-key, string>}'
+ InvalidPropertyAssignmentValue: $element->options with declared type 'array<array-key, string>' cannot be assigned type 'array{attributes: array{class: mixed|non-empty-list<non-empty-lowercase-string>, id: non-falsy-string, title: string}|string, ...<array-key, string>}'
+ PossiblyInvalidArrayOffset: Cannot access value on variable $element->options['attributes']['title'] using offset value of 'title', expecting int… and 3 more Added (76)
Removed (5)
✅ wordpress: issues +145 −1Memory 2 038 → 2 040 MB (+0.1 %) · Wall 135.7 → 138.7 s (+2.2 %) Weighted 676 628 → 676 798 (+170, +0.03 %): L1 +131 · L3 +13
Changed in place (1) @@ src/wp-includes/ID3/module.audio-video.riff.php:1898 @@
- PossiblyFalseArgument: Argument 1 of trim cannot be false, possibly string value expected
+ MixedArgument: Argument 1 of trim cannot be mixed, expecting string
+ MixedArrayAccess: Cannot access array value on mixed variable $RIFFchunk[$chunkname][$thisindex]['parsed']Added (143)
head 4e7446a · base 810b501 (merge-base) · workflow run |
… write may give, as for $a
# Conflicts: # tests/ArrayAccessTest.php # tests/ArrayAssignmentTest.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Psalm reports an array as unused, and doesn't check the value, when an
ArrayAccessitem of the array is written through an offset.Before
After