Skip to content

Conversation

asbiin
Copy link
Contributor

@asbiin asbiin commented Dec 28, 2020

This fix generate the functions with the last data.
Recent changes in https://github.com/php/doc-en have been made, especially on the variadic arguments.

You will find multiple changes here:

  • trim phpdoc: this remove trailing right space on the phpdoc
  • add a position parameter to PhpStanFunction::getParameter so we can find the right parameter using the position, instead of the name, because sometimes parameter name differs between phpstan and php/doc-en.
  • change the way to detect variadic parameters, since it has change in php/doc-en
  • fix com_load_typelib and sem_get function definition, because their definition is wrong in phpstan
  • add a test in MethodTest

@codecov-io
Copy link

codecov-io commented Dec 28, 2020

Codecov Report

Merging #260 (71e1673) into master (a8ab087) will decrease coverage by 0.00%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #260      +/-   ##
============================================
- Coverage     46.89%   46.88%   -0.01%     
- Complexity      291      292       +1     
============================================
  Files            16       16              
  Lines           740      738       -2     
============================================
- Hits            347      346       -1     
+ Misses          393      392       -1     
Impacted Files Coverage Δ Complexity Δ
generator/src/FileCreator.php 0.00% <ø> (ø) 15.00 <0.00> (ø)
.../src/PhpStanFunctions/CustomPhpStanFunctionMap.php 100.00% <ø> (ø) 0.00 <0.00> (ø)
generator/src/WritePhpFunction.php 0.00% <ø> (ø) 35.00 <0.00> (ø)
generator/src/Method.php 64.91% <50.00%> (ø) 36.00 <0.00> (ø)
generator/src/Parameter.php 65.90% <60.00%> (+0.69%) 25.00 <4.00> (+1.00)
generator/src/PhpStanFunctions/PhpStanFunction.php 100.00% <100.00%> (ø) 6.00 <2.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8ab087...71e1673. Read the comment docs.

@Kharhamel
Copy link
Collaborator

Thanks a lot! The only issue with this pr is that a lot of functions have been remove from safe, so if I merge this, I will have to make a new major version.
I plan on doing a v2.0 anyway, but I plan on making it only support php8 and above.
Are you ok if theses changes won't be available for php7?

@Kharhamel
Copy link
Collaborator

@asbiin Just pinging you to make sure you are ok with what I said.

@asbiin
Copy link
Contributor Author

asbiin commented Jan 18, 2021

Thanks to reach out @Kharhamel !
I'm fine with you yes, I don't mind if these changes of not included in php7.

Anyway, what do you think about the fixes on the generator itself, are they relevant?

@Kharhamel
Copy link
Collaborator

Kharhamel commented Jan 18, 2021

Not sure I get the purpose of the parameter $position you introduced but if no tests were broken I am fine with it.
To be fair I am more focused on unstucking the project than on improving the generator code.

@Kharhamel Kharhamel merged commit ee08332 into thecodingmachine:master Jan 18, 2021
@asbiin
Copy link
Contributor Author

asbiin commented Jan 18, 2021

I'll explain: the Parameter object is used to match the parameter between php/doc-en and phpstan declaration. The name of the parameter is used to match the parameters, but some times it does not work. The "position" is the position of the parameter in the declaration, to have a better match.

@asbiin
Copy link
Contributor Author

asbiin commented Apr 14, 2021

@soullivaneuh It's not mine to decide, but I agree with it ;) @Kharhamel maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants