Skip to content
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

Improve documentation and types in PLL_Model #1044

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Screenfeed
Copy link
Contributor

Fixes https://github.com/polylang/polylang-pro/issues/1314.

This improves documentation in PLL_Model and fixes issues reported by PHPStan about types.

Most of the work has been done around PLL_Model->get_languages_list(), by creating a new PHPStan extension.

About @phpstan-* tags:
I added several @phpstan-param and @phpstan-return tags to specify types more precisely. This could have been done directly in the classic @param and @return tags but I prefered to keep these ones simpler and easier to read.
Example, post IDs are positive integers, the integer's range is specified:

@return int[] A list of post IDs.

@phpstan-return array<int<1,max>>

Several other fixes have been made in other files, following the changes in PLL_Model.

PLL_Model's tests are now using assertSame() instead of assertEquals().

Note: rollback composer.json once the PHPStan extension is merged into master.

This improves the class documentation about argument and return types. This also fixes a couple of issues reported by PHPStan after the documentation changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant