Skip to content

Instantly share code, notes, and snippets.

@DominikStyp
Created February 6, 2024 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DominikStyp/9a9cc319132efb477473d35d11331538 to your computer and use it in GitHub Desktop.
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
<?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 */
<?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