Skip to content

add phpdoc return types for arrayaccess methods (fixes #563) - #707

Merged
phil-davis merged 2 commits into
sabre-io:4.5from
smhg:4.5
Dec 9, 2024
Merged

phil-davis merged 2 commits into
sabre-io:4.5from
smhg:4.5

Conversation

@smhg

@smhg smhg commented Dec 5, 2024 •

Copy link
Copy Markdown

See #563.

This adds only phpdoc return types as real return types would not work for the earlier php versions this library supports.

@smhg smhg changed the title add phpdoc return types for arrayaccess methods (closes #563) add phpdoc return types for arrayaccess methods (fixes #563) Dec 5, 2024
@codecov

codecov Bot commented Dec 9, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.58%. Comparing base (e78eb93) to head (7fced34).
Report is 4 commits behind head on 4.5.

Additional details and impacted files
@@            Coverage Diff            @@
##                4.5     #707   +/-   ##
=========================================
  Coverage     98.58%   98.58%           
  Complexity     1931     1931           
=========================================
  Files            71       71           
  Lines          5507     5507           
=========================================
  Hits           5429     5429           
  Misses           78       78           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@phil-davis

phil-davis commented Dec 9, 2024 •

Copy link
Copy Markdown
Contributor

@smhg php-cs-fixer wants an extra comment line between @param and @return PHPdoc lines.
https://github.com/sabre-io/vobject/actions/runs/12177889032/job/34105830142?pr=707
Can you adjust that please?

And this will not change run-time behavior. I suppose that the messages reported in issue #563 are being generated by the analysis tools, and not run-time in production?

@smhg

smhg commented Dec 9, 2024

Copy link
Copy Markdown
Author

@phil-davis I've added the extra lines to the phpdoc blocks. I'm sorry, trusted CI would run php-cs-fixer as it requires an older PHP env.

The warnings in #563 are shown by PHPUnit only (v9 in my case). I tried to make the minimal required change to close the issue. I was unsure adding a real return value would not add any complexities on older supported PHP versions for instance. I reasoned it should only be a patch release.

@phil-davis
phil-davis merged commit ea9dbce into sabre-io:4.5 Dec 9, 2024
@phil-davis

Copy link
Copy Markdown
Contributor

I will have a look at what else is waiting for 4.5 branch and hopefully make the next patch release later today.

@smhg

smhg commented Dec 9, 2024

Copy link
Copy Markdown
Author

Thanks @phil-davis!

Now I also remember I tried to bump phpstan's level to detect these deprecation warnings, but I realized that is probably what's going on in the main branch? That's not worth the effort in v4 I assumed?

@smhg
smhg deleted the 4.5 branch December 9, 2024 07:30
@phil-davis

Copy link
Copy Markdown
Contributor

Now I also remember I tried to bump phpstan's level to detect these deprecation warnings, but I realized that is probably what's going on in the main branch? That's not worth the effort in v4 I assumed?

Yes, I was making progress on increasing the phpstan level in the master branch. I did it easily in the smaller sabre-io repos, but it is a lot more effort here in vobject, so I lost enthusiasm! But some day I would like that to get finished, and release it as a new major version (because it is likely that explicitly declaring parameter and return types will result in some technical backward-compatibility breaks)

So contributions for phpstan enhancements are welcome and go to the master branch.

@smhg

smhg commented Dec 12, 2024

Copy link
Copy Markdown
Author

FWIW I now noticed a package called symfony/phpunit-bridge detects and adds these deprecation notices in (my) projects. I think this merge doesn't harm anyone, but it also doesn't require a release I guess.

I'm sorry about the distraction. I'll add a message how to disable these in the original issue.

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.

2 participants