demos-europe / edt

Enables your PHP application to expose its entities as REST resources using the feature rich JSON:API specification as API. How and to whom your entities are exposed is highly customizable while minimizing boilerplate code.
MIT License
2 stars 1 forks source link

Allow type inference from validation #60

Closed dresslerdemos closed 3 months ago

dresslerdemos commented 1 year ago

Currently Symfony Validation is used to validate request data, however, phpstan is not able to infer the type from that, which increases the chance for type based bugs in the code.

Something like https://github.com/jbboehr/phpstan-laravel-validation is needed, but with a license that allows usage inside a MIT (Expat) licensed project, which is not the case with AGPL v3+.

dresslerdemos commented 1 year ago

phpixie/validate: type awareness doesn't seem to be build in; no phpstan compatibility was found

dresslerdemos commented 1 year ago

beberlei/assert: has a phpstan extension, but is (for performance reasons) kept very simple. Thus it is more an alternative to webmozart/assert (which is already used with a phpstan extension) than to Symfony Validation.

dresslerdemos commented 1 year ago

zendframework/zend-validator: is no longer maintained and recommends laminas/laminas-validator

dresslerdemos commented 1 year ago

laminas/laminas-validator: an phpstan extension https://github.com/Slamdunk/phpstan-laminas-framework for the Laminas framework in general, but it does not support the wanted validation typing

dresslerdemos commented 1 year ago

Respect/Validation: no phpstan extension was found

joorei commented 3 months ago

It is quite possible that no library exists that covers all requirements. Also, there is no major concern in keeping Symfony Validation:

Due to those considerations, the investigation is closed for now.