Skip to content

Conversation

@derrabus
Copy link
Member

@derrabus derrabus commented Jan 9, 2022

Several public properties are documented as READ-ONLY: <some explanation>. However, in the meantime, PHP has implemented real readonly properties and Psalm supports the docblock annotation @readonly to emulate its sematics.

https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-readonly-and-readonly

I propose to switch to that annotation to allow Psalm to detect unintended access to those properties.

Note: I have skipped the ClassMetadataInfo class because most of the properties flagged as READ-ONLY there are actually not used accoding to PHP 8.1's semantics.

@derrabus derrabus added this to the 2.11.0 milestone Jan 9, 2022
@beberlei beberlei merged commit f9f453f into doctrine:2.11.x Jan 9, 2022
@derrabus derrabus deleted the improvement/readonly branch January 9, 2022 14:35
derrabus added a commit to derrabus/orm that referenced this pull request Jan 9, 2022
* 2.11.x:
  PHPStan 1.3.3, Psalm 4.18.1
  Remove Psalm job for analyzing DBAL 2
  Use the readonly annotation (doctrine#9340)
  Add support for custom types with requireSQLConversion and ResultSetMappingBuilder::generateSelectClause()
  PSR-6 second level cache
  Fix type errors in AbstractQuery and QueryBuilder (doctrine#9275)
  Mark columnName as always set
  Add support for PHP 8.1 enums.
  Remove ignore rules for issues fixed upstream (doctrine#9336)
  [doctrineGH-9277] deprecate php driver (doctrine#9309)
derrabus added a commit to derrabus/orm that referenced this pull request Jan 9, 2022
* 2.11.x:
  PHPStan 1.3.3, Psalm 4.18.1
  Remove Psalm job for analyzing DBAL 2
  Use the readonly annotation (doctrine#9340)
  Add support for custom types with requireSQLConversion and ResultSetMappingBuilder::generateSelectClause()
  PSR-6 second level cache
  Fix type errors in AbstractQuery and QueryBuilder (doctrine#9275)
  Mark columnName as always set
  Add support for PHP 8.1 enums.
  Remove ignore rules for issues fixed upstream (doctrine#9336)
  [doctrineGH-9277] deprecate php driver (doctrine#9309)
derrabus added a commit to derrabus/orm that referenced this pull request Jan 9, 2022
* 2.11.x:
  PHPStan 1.3.3, Psalm 4.18.1
  Remove Psalm job for analyzing DBAL 2
  Use the readonly annotation (doctrine#9340)
  Add support for custom types with requireSQLConversion and ResultSetMappingBuilder::generateSelectClause()
  PSR-6 second level cache
  Fix type errors in AbstractQuery and QueryBuilder (doctrine#9275)
  Mark columnName as always set
  Add support for PHP 8.1 enums.
  Remove ignore rules for issues fixed upstream (doctrine#9336)
  [doctrineGH-9277] deprecate php driver (doctrine#9309)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants