Created
February 6, 2024 13:25
-
-
Save DominikStyp/9a9cc319132efb477473d35d11331538 to your computer and use it in GitHub Desktop.
PHPStorm: disable error indpection @read-only property beeing assigned for the specified line
This file contains 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
<?php | |
$user = new User(); | |
$user->someProp = 123; // here PHPStorm complains that the property is read-only | |
/** @var mixed $user */ | |
$user->someProp = 123; // yet here is OK, because we temporarily change the user type | |
/** @var User $user */ |
This file contains 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
<?php | |
/** | |
* @property-read int $someProp | |
* @property int $otherProp | |
*/ | |
class User {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment