Replies: 7 comments 14 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Another thought here: I think we should aim to solve the current TODOs in the project if possible. Or just remove them from the code if we deem them as not a priority anymore, and list them somewhere else in a discussion/issue |
Beta Was this translation helpful? Give feedback.
-
@drupol Two more thoughts for this, as I've been refactoring more to get rid of Doctrine ArrayCollection and use loophp Collection:
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection as DoctrineCollection;
use loophp\collection\Collection as CollectionInstance;
use loophp\collection\Contract\Collection;
class Service {
public function returnsDoctrine(): DoctrineCollection
{
return new ArrayCollection([1, 2, 3]);
}
public function returnsLoophp(): Collection // I want to keep the Contract here i.e. the Interface
{
return CollectionInstance::fromIterable([1, 2, 3]);
}
public function returnsLoophp2(): Collection
{
return collectIterable([1, 2, 3]);
// having this would allow me to get rid of the instance import;
// also, it's easier and shorter to write :)
// we could have equivalents `collectString`, `collectResource` etc.
}
}
// signature
// Collection::equals(Collection $other): bool
// usage
$col1 = Collection::fromIterable([1, 2, 3]);
$col2 = Collection::fromIterable([3, 4, 5]);
if ($col1->equals($col2)) {
} I'm thinking it would be implemented as The other major benefit is it would allow usage in testing with PHUnit's assertObjectEquals assertion. I have many methods that return collections and currently it's a bit cumbersome to test the return values because using |
Beta Was this translation helpful? Give feedback.
-
@drupol another one potentially for this release currently many interfaces have a short explanation in the dock block: but many do not: Should we: If we are going with B, again we have a few options:
interface Diffable
{
/**
* @link https://loophp-collection.readthedocs.io/en/stable/pages/api.html#diff
*
* @param T ...$values
*
* @return Collection<TKey, T>
*/
public function diff(...$values): Collection;
}
interface Diffable
{
/**
* It compares the collection against another collection or a plain array based on its values.
* This method will return the values in the original collection that are not present in the given collection.
* @link https://loophp-collection.readthedocs.io/en/stable/pages/api.html#diff
*
* @param T ...$values
*
* @return Collection<TKey, T>
*/
public function diff(...$values): Collection;
} |
Beta Was this translation helpful? Give feedback.
-
The other day I had an idea. Instead of using Benefits:
Cons:
WDYT? |
Beta Was this translation helpful? Give feedback.
-
@drupol I just noticed this one:
I think it would be good to do for sure! |
Beta Was this translation helpful? Give feedback.
-
I think it's time to focus on writing the Changelog :D |
Beta Was this translation helpful? Give feedback.
-
Release date proposal: 6th of August, exactly 2 years after the first commit (7247de4)!
Ideas for v5:
IterableIterator
? (would be nice!)Ongoing:
Implemented/Done:
::mapN()
?::first()
,::head()
? They are doing the same thing. Should we deprecate::first()
?Reduce
operation #139Reverse
operation - optimize and remove todos. #138)Not going to do it:
Iterator
withiterable
in Operations. ?Beta Was this translation helpful? Give feedback.
All reactions