stable

Clone or download

Read-only

Prevent usage of mutable REST representations

This contribution enforces with a Psalm plugin that REST representations are marked as 'psalm-immutable'. A few representations might be missed as some annotations are specific to Restler and not understood. It should however not be a big issue as the immutability have a tendency to "contaminate" classes used in a same composition so the classes that have been missed initially can be spotted anyway. If it becomes an actual issue, two solutions can be considered: giving Restler the ability to understand annotations used everywhere else in the PHP world or give Psalm the ability to understand Restler specific annotation via another plugin. Closes request #15111: REST representations should not be mutable Change-Id: If4dd59e1e33cd2c9c27e8323b0f801ff33512b48

Modified Files

Name
A tests/lib/Psalm/Plugin/NoWritableRESTRepresentation/DoNotAllowWritableRESTRepresentation.php +140 −0 Go to diff View file
A tests/lib/Psalm/Plugin/NoWritableRESTRepresentation/NoMutableRESTRepresentation.php +37 −0 Go to diff View file
M tests/psalm/psalm.xml +1 −0 Go to diff View file