-
Notifications
You must be signed in to change notification settings - Fork 48
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
Created a PhpStorm stub for ext-ds. #51
base: master
Are you sure you want to change the base?
Conversation
This is needed in preparation for the PhpStorm stub (php-ds/ext-ds#128).
1. "All methods and properties of classes and interfaces must specify their visibility: public, protected or private.", from the PSR-12 draft. 2. It is required by convention for inclusion as a PhpStorm stub (see php-ds/ext-ds#128).
## Steps to Create + Maintain: 0. For every class, interface, and trait: a. Remove every private access method and property. b. Remove every @internal class, inteface, and trait. c. Remove all of the contents between { } in the methods. d. Ensure that no third party, non-standard PHP external classes are called from the stubs. If they are, then it will still work, but PhpStorm will likely reject it for publishing. 1. For every trait: a. Add a comment at the first line that says // BEGIN <TraitName> Trait. b. Add a comment at the last line that says // END <TraitName Trait. 2. For every class: a. Move constants to the top of the class declaration. b. Move public and protected properties below the constants. c. Replace each "use <trait>;" declaration with the pasted contents of the stripped-down Trait. d. Rectify any and all PHP compilation issues. [No return statements are allowed by the PHP 7.x linter, even when strict return types are enforced).] 3. Concatenate every class, interface and abstract class into the phpstorm-stub.php file. 4. Carefully import (via use statements) every external class (e.g., ArrayAccess). ## Next Steps For instructions on how to test + publish this stub to PhpStorm, see * https://blog.jetbrains.com/phpstorm/2018/03/how-to-provide-stubs-for-phpstorm/ For php-ds/ext-ds#128 # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Sat Mar 30 09:04:59 2019 -0500 # # On branch phpstorm_stub # Your branch is up to date with 'origin/phpstorm_stub'. # # Changes to be committed: # new file: phpstorm-stub.php # # Changes not staged for commit: # modified: src/Deque.php # modified: src/Map.php # modified: src/Pair.php # modified: src/PriorityQueue.php # modified: src/Queue.php # modified: src/Set.php # modified: src/Stack.php # modified: src/Traits/Capacity.php # modified: src/Traits/GenericCollection.php # modified: src/Traits/GenericSequence.php # modified: src/Traits/SquaredCapacity.php # modified: src/Vector.php # # Untracked files: # .idea/ #
Can I please get an update on the status of this PR? |
This looks solid @hopeseekr. Do you know if:
|
It's possible to generate stubs (minus documentation) with reflection indeed. This stub was generated by this script. It requires that the arginfo must be perfect though. |
@dktapps Arg info was anything but perfect when I had a go at it. You'd definitely have to apply my first two commits. @rtheunissen They can be multiple files, but
|
@hopeseekr I'm referring to the internal arginfo defined in the extension itself. The only problems I encountered was the invariance of the return types defined on the |
@dktapps @hopeseekr that's correct, eg. you can't have the equivalent of @hopeseekr do you know how PHPStorm handles versioning of stubs? Eg. if we release 2.0 with a decent amount of changes, that would be okay right? |
unfortunately it doesn't handle versioning very well (or at all). you can see this with the problems created by the pthreads V2 vs V3 rewrite. |
|
This makes me wonder whether we should wait for the 2.0 API before we submit official stubs. The polyfill solves that problem well enough in the meantime. @krakjoe did you oversee/experience the pthreads stubs? |
Why is this stalled for almost a year now? What's needed to get this going (again?) |
This can be closed. PHPStorm has stubs for this extension now. |
This PR requires PR #50 [Fixed the documentation].
Steps to recreate / maintain:
For every class, interface, and trait:
a. Remove every private access method and property.
b. Remove every @internal class, inteface, and trait.
c. Remove all of the contents between { } in the methods.
d. Ensure that no third party, non-standard PHP external classes are called from the stubs. If they are, then it will still work, but PhpStorm will likely reject it for publishing.
For every trait:
a. Add a comment at the first line that says // BEGIN Trait.
b. Add a comment at the last line that says // END <TraitName Trait.
For every class:
a. Move constants to the top of the class declaration.
b. Move public and protected properties below the constants.
c. Replace each "use ;" declaration with the pasted contents of the stripped-down Trait.
d. Rectify any and all PHP compilation issues. [No return statements are allowed by the PHP 7.x linter, even when strict return types are enforced).]
Concatenate every class, interface and abstract class into the phpstorm-stub.php file.
Carefully import (via use statements) every external class (e.g., ArrayAccess).
Next Steps
For instructions on how to test + publish this stub to PhpStorm, see
For php-ds/ext-ds#128
This change is