Closed kkmuffme closed 2 years ago
Hello @kkmuffme! Try to generate from that specific file.
It is very easy to debug this project.
If I run it for that file only, there are no errors either (but no stubs generated) it even says "OK":
PHP Stubs Generator
===================
[OK] Stubs written to /some/path/a.php
----------- --------- ------------ -------- ----------- ---------
functions classes interfaces traits constants globals
----------- --------- ------------ -------- ----------- ---------
0 0 0 0 0 0
----------- --------- ------------ -------- ----------- ---------
and the output file contains only:
<?php
Try debugging in this try/catch block https://github.com/php-stubs/generator/blob/53c2cbb0ab3049d73d4490d47c9f2f9028580ef8/src/StubsGenerator.php#L133 Please see #4
I'm also experiencing the same issue. When manually trying to generate the stubs from the command line I get the correct number of stubs recognized, but when I check the file, it's empty.
When I don't specify out
parameter I don't get anything out.
No error is thrown.
I var dumped the visitor in the StubsGenerator.php
, and I can see the correct class and traits mentioned, the $unparsed
variable is empty, which is ok.
Not sure why nothing is getting parsed out.
Dear Denis! You may be hit by #14
My PHP parsing is not strong, so I'll wait for a fix, but when you'll have something feel free to ping me to test it 👍🏼
I went the wrong way: temporarily commented out that line mentioned in #14
Tried that, but didn't do anything (nothing was generated)
I've just commented out all four *exists
conditions (func, trait, class, interface) and generate-stubs
gave me 909 lines of stubs :)
$ vendor/bin/generate-stubs --functions --classes --interfaces --traits src/Helpers/ | wc -l
909
Yup can confirm, commenting those lines out seems to generate a correct stub 👍🏼
Would a new config switch for that behaviour (include "existing" things) be useful? Maybe such issues can then be avoided
I'm sorry, Martin! This is a highly dangerous ⚡ fork for php-stubs organization stubs only. Without php-stubs this would be https://github.com/GiacoCorsiglia/php-stubs-generator
Package installed with composer: abraham/twitteroauth (I need the stubs as I'm doing something like you do with the WP stubs which do not use composer, so I need stubs)
generate-stubs --force --functions --classes --interfaces --traits --out="a.php" --no-interaction twitter
(package is installed in twitter folder)It generates the stubs (10 classes), but stubs for
class TwitterOAuth extends Config
are missing. But e.g.class TwitterOAuthException extends \Exception
and all other classes are there (total 11 classes, but only 10 have stubs created).Is this a bug or is there something I'm doing wrong?