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

refactor: rename the term 'large' to 'basic' #35

Merged
merged 2 commits into from
Jun 20, 2024
Merged
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
2 changes: 1 addition & 1 deletion .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.42.0" installed="3.42.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="php-cs-fixer" version="^3.59.3" installed="3.59.3" location="./tools/php-cs-fixer" copy="false"/>
</phive>
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* refactor: rename `createFrom()` to `with()`
* refactor: rename the term 'safe' to 'large'
* refactor(`RecollectionDecorator`): rename `withCriteria` to `applyCriteria`
* refactor: rename the term 'large' to 'basic'

## 0.3.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @template TKey of array-key
* @template T
*/
trait LargeReadableCollectionTrait
trait BasicReadableCollectionTrait
{
/**
* @template TMaybeContained
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @template TKey of array-key
* @template T
*/
trait LargeWritableCollectionTrait
trait BasicWritableCollectionTrait
{
/**
* @param T $element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @template-covariant T
* @extends PageableInterface<TKey,T>
*/
interface LargeReadableRecollection extends PageableInterface
interface BasicReadableRecollection extends PageableInterface
{
/**
* @template TMaybeContained
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
/**
* @template TKey of array-key
* @template-covariant T of object
* @extends LargeReadableRecollection<TKey,T>
* @extends BasicReadableRecollection<TKey,T>
*/
interface LargeReadableRepository extends LargeReadableRecollection
interface BasicReadableRepository extends BasicReadableRecollection
{
/**
* @param TKey $key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
/**
* @template TKey of array-key
* @template T
* @extends LargeReadableRecollection<TKey,T>
* @extends BasicReadableRecollection<TKey,T>
*/
interface LargeRecollection extends LargeReadableRecollection
interface BasicRecollection extends BasicReadableRecollection
{
/**
* @param T $element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
/**
* @template TKey of array-key
* @template T of object
* @extends LargeReadableRepository<TKey,T>
* @extends LargeRecollection<TKey,T>
* @extends BasicReadableRepository<TKey,T>
* @extends BasicRecollection<TKey,T>
*/
interface LargeRepository extends LargeReadableRepository, LargeRecollection
interface BasicRepository extends BasicReadableRepository, BasicRecollection
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
use Doctrine\Common\Collections\Order;
use Doctrine\Common\Collections\ReadableCollection;
use Doctrine\Common\Collections\Selectable;
use Rekalogika\Contracts\Collections\BasicReadableRecollection;
use Rekalogika\Contracts\Collections\Exception\UnexpectedValueException;
use Rekalogika\Contracts\Collections\LargeReadableRecollection;
use Rekalogika\Domain\Collections\Common\CountStrategy;
use Rekalogika\Domain\Collections\Common\Trait\BasicReadableCollectionTrait;
use Rekalogika\Domain\Collections\Common\Trait\CountableTrait;
use Rekalogika\Domain\Collections\Common\Trait\ItemsWithSafeguardTrait;
use Rekalogika\Domain\Collections\Common\Trait\LargeReadableCollectionTrait;
use Rekalogika\Domain\Collections\Common\Trait\PageableTrait;
use Rekalogika\Domain\Collections\Common\Trait\ReadableRecollectionTrait;
use Rekalogika\Domain\Collections\Trait\ExtraLazyDetectorTrait;
Expand All @@ -32,9 +32,9 @@
/**
* @template TKey of array-key
* @template T
* @implements LargeReadableRecollection<TKey,T>
* @implements BasicReadableRecollection<TKey,T>
*/
class LargeCriteriaRecollection implements LargeReadableRecollection, \Countable
class BasicCriteriaRecollection implements BasicReadableRecollection, \Countable
{
/** @use RecollectionTrait<TKey,T> */
use RecollectionTrait;
Expand All @@ -45,8 +45,8 @@ class LargeCriteriaRecollection implements LargeReadableRecollection, \Countable
/** @use ItemsWithSafeguardTrait<TKey,T> */
use ItemsWithSafeguardTrait;

/** @use LargeReadableCollectionTrait<TKey,T> */
use LargeReadableCollectionTrait;
/** @use BasicReadableCollectionTrait<TKey,T> */
use BasicReadableCollectionTrait;

use CountableTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Order;
use Doctrine\Common\Collections\Selectable;
use Rekalogika\Contracts\Collections\BasicRecollection;
use Rekalogika\Contracts\Collections\Exception\UnexpectedValueException;
use Rekalogika\Contracts\Collections\LargeRecollection;
use Rekalogika\Domain\Collections\Common\Configuration;
use Rekalogika\Domain\Collections\Common\CountStrategy;
use Rekalogika\Domain\Collections\Common\Trait\BasicReadableCollectionTrait;
use Rekalogika\Domain\Collections\Common\Trait\BasicWritableCollectionTrait;
use Rekalogika\Domain\Collections\Common\Trait\CountableTrait;
use Rekalogika\Domain\Collections\Common\Trait\ItemsWithSafeguardTrait;
use Rekalogika\Domain\Collections\Common\Trait\LargeReadableCollectionTrait;
use Rekalogika\Domain\Collections\Common\Trait\LargeWritableCollectionTrait;
use Rekalogika\Domain\Collections\Common\Trait\PageableTrait;
use Rekalogika\Domain\Collections\Common\Trait\ReadableRecollectionTrait;
use Rekalogika\Domain\Collections\Trait\ExtraLazyDetectorTrait;
Expand All @@ -33,9 +33,9 @@
/**
* @template TKey of array-key
* @template T
* @implements LargeRecollection<TKey,T>
* @implements BasicRecollection<TKey,T>
*/
class LargeRecollectionDecorator implements LargeRecollection, \Countable
class BasicRecollectionDecorator implements BasicRecollection, \Countable
{
/** @use RecollectionTrait<TKey,T> */
use RecollectionTrait;
Expand All @@ -46,11 +46,11 @@ class LargeRecollectionDecorator implements LargeRecollection, \Countable
/** @use ItemsWithSafeguardTrait<TKey,T> */
use ItemsWithSafeguardTrait;

/** @use LargeWritableCollectionTrait<TKey,T> */
use LargeWritableCollectionTrait;
/** @use BasicWritableCollectionTrait<TKey,T> */
use BasicWritableCollectionTrait;

/** @use LargeReadableCollectionTrait<TKey,T> */
use LargeReadableCollectionTrait;
/** @use BasicReadableCollectionTrait<TKey,T> */
use BasicReadableCollectionTrait;

use CountableTrait;

Expand Down Expand Up @@ -152,19 +152,19 @@ protected function with(

/**
* @param null|int<0,max> $count
* @return LargeCriteriaRecollection<TKey,T>
* @return BasicCriteriaRecollection<TKey,T>
*/
protected function applyCriteria(
Criteria $criteria,
CountStrategy $countStrategy = CountStrategy::Restrict,
?int &$count = null,
): LargeCriteriaRecollection {
): BasicCriteriaRecollection {
// if $criteria has no orderings, add the current ordering
if (\count($criteria->orderings()) === 0) {
$criteria = $criteria->orderBy($this->orderBy);
}

return new LargeCriteriaRecollection(
return new BasicCriteriaRecollection(
collection: $this->collection,
criteria: $criteria,
itemsPerPage: $this->itemsPerPage,
Expand Down
2 changes: 1 addition & 1 deletion packages/collections-orm/src/Trait/QueryBuilderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private function getPageable(): PageableInterface
CountStrategy::Delegate => true,
CountStrategy::Provided => $this->count,
}
?? 0;
?? 0;

// @phpstan-ignore-next-line
$this->pageable = new KeysetPageable(
Expand Down
4 changes: 2 additions & 2 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<errorLevel type="suppress">
<file name="packages/collections-domain/src/RecollectionDecorator.php" />
<file name="packages/collections-domain/src/CriteriaRecollection.php" />
<file name="packages/collections-domain/src/LargeRecollectionDecorator.php" />
<file name="packages/collections-domain/src/LargeCriteriaRecollection.php" />
<file name="packages/collections-domain/src/BasicRecollectionDecorator.php" />
<file name="packages/collections-domain/src/BasicCriteriaRecollection.php" />
<file name="packages/collections-orm/src/QueryCollection.php" />
<file name="packages/collections-orm/src/QueryPageable.php" />
</errorLevel>
Expand Down