Extract type system into a separate package? #4646
oprypkhantc
started this conversation in
General
Replies: 1 comment
-
Hi, this would complicate PHPStan's development by a lot so I don't have any plans to do this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey. Would the project be interested in extracting it's whole type system (alongside reflection) into a separate, semver'ed (even if the major version stays 0) composer package, like
phpstan/type-system
or two packagesphpstan/types
&phpstan/reflection
, given I can my spend time doing that?The reasoning for this is simple: practically anything that is acceptable magic, namely serialization, event handling, dependency injection, needs to have proper reflection and a proper type system behind it.
In PHP community it's currently done of the two ways:
jms/serializer
)PHPStan has a decent internal type system that isn't tightly bound with other parts of PHPStan and hence is also a relatively simple solution for the problem above.
My own use case for this is a serializer. It fully depends on being able to infer types and compare them. I'm currently using
phpstan/phpstan-src
alongsidehumbug/php-scoper
to achieve this, but being able to simply depend on a library (whichphpstan/phpstan-src
is not) would make my life much easier.Just moving the type system shouldn't be too hard. The only real nuance I encountered while implementing a serializer (and using
phpstan/phpstan-src
externally) is statically usedBroker
singleton in some of the types.If there's any chance something like this could pass a pull request, I would be happy to help.
Beta Was this translation helpful? Give feedback.
All reactions