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 stub for paginator #472

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
push:
branches:
- "1.3.x"
- "1.4.x"

jobs:
lint:
Expand All @@ -26,7 +26,7 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
Expand Down Expand Up @@ -55,10 +55,10 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Checkout build-cs"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: "phpstan/build-cs"
path: "build-cs"
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Generate changelog
id: changelog
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"require": {
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.10.12"
"phpstan/phpstan": "^1.11"
},
"conflict": {
"doctrine/collections": "<1.0",
Expand Down
1 change: 1 addition & 0 deletions extension.neon
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ parameters:
- stubs/ORM/Query/Expr/Composite.stub
- stubs/ORM/Query/Expr/Func.stub
- stubs/ORM/Query/Expr/Join.stub
- stubs/ORM/Tools/Pagination/Paginator.stub
- stubs/Persistence/Mapping/ClassMetadata.stub
- stubs/ServiceDocumentRepository.stub

Expand Down
33 changes: 33 additions & 0 deletions stubs/ORM/Tools/Pagination/Paginator.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Doctrine\ORM\Tools\Pagination;

use ArrayIterator;
use Countable;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use IteratorAggregate;

/**
* @template T
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unlike the original this was changed to invariant because otherwise the return from getIterator() in l27 would throw a error

* @implements IteratorAggregate<array-key, T>
*/
class Paginator implements Countable, IteratorAggregate
{

/**
* @param Query<mixed, T>|QueryBuilder $query
* @param bool $fetchJoinCollection
*/
public function __construct($query, $fetchJoinCollection = true)
{
}

/**
* @return ArrayIterator<array-key, T>
*/
public function getIterator()
{
}

}