phpstan / phpdoc-parser

Next-gen phpDoc parser with support for intersection types and generics
MIT License
1.31k stars 62 forks source link

Add syntax for subtraction type #240

Open rvanvelzen opened 4 months ago

rvanvelzen commented 4 months ago

This is a preliminary syntax implementation for subtraction type syntax.

Merging now isn't necessary because the work in phpstan-src is far from done. Any feedback is still appreciated though.

ondrejmirtes commented 4 months ago

1) We have to get rid of all Type inheritance before this is possible to do: https://phpstan.org/blog/why-is-instanceof-type-wrong-and-getting-deprecated 2) I'm not sure we need a new syntax for this and how it should look like. We could do this simply with subtract-from<X, Y> generics.