-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thoughts on the possible implementation #1
Comments
After discussing with Louis and Mike today, we agreed to use PSALM-ish format for global type definition files, slightly adjusted to give names to types:
|
Wanted to bring these to your attention:
|
A small summary on all the three analyzers and their extensions:
|
@mholubowski are you ok with using the phpstan's phpstan.neon file in the root of a project for global type defininitions? Since phpstan offers global type defs out of the box, I suggest us to stick with it instead of psalm. That way, all the static typing error validation would be available even without my extension. And then in You can try this configured example out from here. You would only need phpstan installed: I'll gladly do something to improve the UI, like showing on which exactly key do types mismatch. |
Note, nothing stops us from using both psalm and phpstan formats. But since phpstan format is already complete and available for a long time, you may want to consider starting typing using it for now, while |
The task at hand is to make it possible for a developer to write php code with static typing of associative arrays similar to typescript interfaces.
@psalm-type
I considered using hack, but that does not seem to be an option anymore in 2k20
First thing to do is to make basic completion from PSALM-ish phpdoc comment and type inference.
I just thought of one thing: what if we declare global types using
.d.ts
files and typescript syntax? Just a random idea, I did not think deep about problems like specifying php classes in this structure...And here comes another idea: using files with hack syntax for global type defs! These would supposedly have syntax support from the hack plugins out of the box!
The text was updated successfully, but these errors were encountered: