Skip to content

Commit

Permalink
updated comments and used spaceship operator
Browse files Browse the repository at this point in the history
  • Loading branch information
driehle committed Dec 10, 2021
1 parent 5f06280 commit 5fbea27
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/DoctrineObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ protected function toOne($target, $value)

/**
* Handle ToMany associations. In proper Doctrine design, Collections should not be swapped, so
* collections are always handled by reference. Internally, every collection is handled using specials
* strategies that inherit from CollectionStrategyInterface class, and that add or remove elements but without
* collections are always handled by reference. Internally, every collection is handled using
* strategies that implement CollectionStrategyInterface, and that add or remove elements but without
* changing the collection of the object
*
* @param object $object
Expand Down
3 changes: 1 addition & 2 deletions src/Strategy/AbstractCollectionStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use function method_exists;
use function spl_object_hash;
use function sprintf;
use function strcmp;

/**
* @internal
Expand Down Expand Up @@ -136,6 +135,6 @@ protected function getCollectionFromObjectByReference(): Collection
*/
protected function compareObjects(object $a, object $b): int
{
return strcmp(spl_object_hash($a), spl_object_hash($b));
return spl_object_hash($a) <=> spl_object_hash($b);
}
}

0 comments on commit 5fbea27

Please sign in to comment.