New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove MixedAssignment #8776
base: master
Are you sure you want to change the base?
Remove MixedAssignment #8776
Conversation
I found these snippets: https://psalm.dev/r/fa55323580<?php
function takesAnInt(mixed $i): void {
echo $i;
}
|
@@ -320,13 +320,13 @@ | |||
<xs:element name="MixedArrayAssignment" type="IssueHandlerType" minOccurs="0" /> | |||
<xs:element name="MixedArrayOffset" type="IssueHandlerType" minOccurs="0" /> | |||
<xs:element name="MixedArrayTypeCoercion" type="IssueHandlerType" minOccurs="0" /> | |||
<xs:element name="MixedAssignment" type="IssueHandlerType" minOccurs="0" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should remain here, but be marked as deprecated. See https://github.com/orklah/psalm/blob/24ae96b373cb44186c58360543dcf0987436df0c/config.xsd#L20-L25 for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, it doesn't seem like anyone references it in psalm.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github search shows 97 entries, including some popular repos like doctrine/collections
: https://github.com/search?q=path%3Apsalm.xml+language%3AXML+MixedAssignment&type=code
Overall I'm not sure whether you wanted to remove the issue or deprecate it. This PR seems to do a little of both, but none completely. |
I want to remove the issue, but not break psalm.xml or |
I'm a little worried about tests that may start passing even with the broken code because they previously relied on MixedAssignment to detect problematic code. I've already found one by accident (fixed in #8781), but there's no telling how many more there are. |
I don't mind keeping the issue class, XSD entry and docs for 5.x release cycle, as long as we stop emitting this issue. Could actually use it as a testing ground for #8775 |
Allow `MixedAssignment` issue (by suppressing it). This issue will probably removed in future versions of psalm anyways and it mostly makes no real sense or is not avoidable. For further information, see: vimeo/psalm#8776 Allow `RedundantCastGivenDocblockType` as at least the redis extension does not always provide proper typs. The `RedisException` as well as the `RedisClusterException` does not always provide an integer `code` and thus we have to cast it to ensure that this will always be an integer. Once the extension implemented native type-hints, a `RedundantCast` will be emitted and we are good to remove the cast when requiring the extension version which implemented native type-hints. Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
MixedAssignment
is largely unnecessary now that we report where mixed data comes from.This PR removes the issue
MixedAssignment
and its corresponding classPsalm\Issue\MixedAssignment
.If this PR passes,
@psalm-suppress MixedAssignment
annotations will now generate anUnusedPsalmSuppress
issue if thefindUnusedPsalmSuppress
option is true or--find-unused-psalm-suppress
is passed as a command-line flag.This would be a breaking change for a major version. If it's too late for Psalm 5, then I'll modify this PR to instead just deprecate the class and associated methods (while keeping the
UnusedPsalmSuppress
issue since it will only affect a small number of people who track unused suppressions).