Closed (fixed)
Project:
Drupal core
Version:
10.0.x-dev
Component:
link.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Dec 2021 at 14:20 UTC
Updated:
3 Jul 2022 at 17:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mondrakeComment #3
mglamanThis needs some debugging when analyzing. Here is the phpstan-drupal issue for the error: https://github.com/mglaman/phpstan-drupal/issues/228
Comment #4
mglamanI am working on a fix, now. I was able to reproduce the bug: https://github.com/mglaman/phpstan-drupal/pull/279
The problem is due the way PHPStan has decided the
field_testproperty will act. It gets set to ConstantStringType. But still this shouldn't cause a crash in PHPStan. I don't think. Hopefully I can make a fix in phpstan-drupal until PHPStan has a fix, if we can determine why.Comment #5
mglamanI can't figure this out. Opened an issue in PHPStan https://github.com/phpstan/phpstan/issues/6231
Comment #6
taran2lComment #7
taran2lOk, #3178534: Start running PHPStan on Drupal core (level 0) went in, so attaching patch from #3178534-153: Start running PHPStan on Drupal core (level 0)
Clearly, this is a big in PHPStan, but we can adjust a test little bit to make it pass.
Comment #8
longwaveThis is changing the test though - we want to check that setting the property directly, instead of setting a list of properties, does what is intended.
Same here, we want to check that setting a property on the field sets the value on the first item.
To me this is a bug in either PHPStan or phpstan-drupal and should be fixed there instead.
Comment #9
taran2l@longwave, your points are valid, but from the comments from the code I see that test is checking:
to me, it seems like it tests LinkItem specifics rather than Typed data API or Field item API
Comment #10
mglamanYeah, the test code is a bit blurred. But it shows the specifics of the properties for this field. It also proves there is a bug in PHPStan – albeit hard to track down. I'm not for changing the tests but rather trying to make a fix for PHPStan.
Comment #11
mondrakeFix upstream: https://github.com/phpstan/phpstan/issues/6231#issuecomment-1017524310
We need to wait for a new release and upgrade phpstan/phpstan.
Comment #12
mglamanI don't think the solution is going to do what we expect. It just prevents PHPStan from crashing and returns an error type, when we don't actually have an error type.
Comment #14
mallezieThis was fixed in one of the updates of phpstan / phpstan-drupal.
Removing this, runs a full scan, no new issues added to baseline.
Comment #15
mondrakeCool.
Comment #16
alexpottCommitted ad5ff3f and pushed to 10.0.x. Thanks!