vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.56k stars 660 forks source link

Check serializable contract #3179

Open staabm opened 4 years ago

staabm commented 4 years ago

Could psalm check objects which implement Serializable whether they met the contract?

Like all objects used while serialization are also serializable etc (a lot of builtin classes are not serializable, like Exception, SplFileInfo etc) (I dont know all rules which are important)

Triggered by amphp/parallel#113

Clones https://github.com/phpstan/phpstan/issues/3181

Example https://psalm.dev/r/f1bccdf5fd Which errors at runtime https://3v4l.org/k9pk8

psalm-github-bot[bot] commented 4 years ago

I found these snippets:

https://psalm.dev/r/f1bccdf5fd ```php
muglug commented 4 years ago

I think this is a bit of an edge-case – feel free to create a PR, but I'm not going to fix.