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

Add paging functionality to ResultSet #136

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

ncosta-ic
Copy link
Member

@ncosta-ic ncosta-ic commented Apr 12, 2024

Adds basic paging functionality to the ResultSet.
A page size can be set with setPageSize(n) and the current page (during iteration) can be retrieved with getCurrentPage().

@cla-bot cla-bot bot added the cla/signed label Apr 12, 2024
@ncosta-ic ncosta-ic marked this pull request as draft April 12, 2024 09:47
@ncosta-ic ncosta-ic marked this pull request as ready for review April 12, 2024 09:54
@ncosta-ic ncosta-ic marked this pull request as draft April 12, 2024 11:13
Copy link
Member

@nilmerg nilmerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please drop all changes to existing parameter and return types, which would break bc
  • If you add a missing docstring, document everything not just a few things (short description, params, return type, throws, etc)
  • The short description of docstrings must be phrased as instruction, not as description (i.e. "Set" instead of "Sets" and "Return" instead of "Returns")
  • Format multiline docstrings this way:
    /**
     * Short description
     *
     * [Long description]
     *
     * @param declarations
     *
     * @return declaration
     *
     * @throws declaration
     */
    

src/ResultSet.php Outdated Show resolved Hide resolved
src/ResultSet.php Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
@ncosta-ic ncosta-ic requested a review from nilmerg April 12, 2024 12:23
src/ResultSet.php Outdated Show resolved Hide resolved
Copy link
Member

@nilmerg nilmerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please update the baseline, so that at least the ignored patterns are removed
  • Please add tests for the page number calculation

src/ResultSet.php Outdated Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
@nilmerg nilmerg added the enhancement New feature or request label Apr 12, 2024
…et paging, fixed PHPStan configuration, rebuilt baseline, refactored return type annotation
@ncosta-ic ncosta-ic marked this pull request as ready for review April 15, 2024 11:40
ncosta-ic

This comment was marked as outdated.

@lippserd
Copy link
Member

@ncosta-ic @nilmerg What's the motivation for this PR, i.e. when and how would I use it?

Regarding the PHPDocs: Please don't use @see protected property for public methods.

phpstan.neon Outdated Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
src/ResultSet.php Outdated Show resolved Hide resolved
tests/ResultSetTest.php Outdated Show resolved Hide resolved
@nilmerg
Copy link
Member

nilmerg commented Apr 15, 2024

@lippserd

What's the motivation for this PR, i.e. when and how would I use it?

It's part of an attempt to move Icinga DB Web's and Notification Web's LoadMore trait to ipl-web. How it's used is currently only visible in the tests. Concrete usages soon here: Icinga/icinga-notifications-web#166

Regarding the PHPDocs: Please don't use @see protected property for public methods.

Why?

@ncosta-ic
Copy link
Member Author

Regarding the PHPDocs: Please don't use @see protected property for public methods.

Why?

If I had to guess: Because public methods (and thus their documentation) could be used outside of the extended class, which would then reference protected properties that could not be accesses in that scope

…red ResultSet class, reverted PHPStan configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants