diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index ebfef876d65..6fd588ea381 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -323,9 +323,9 @@ class UnitOfWork implements PropertyChangedListener * * DDC-2332 / #3037 * - * @var array + * @psalm-var array */ - private $oidMap = array(); + private $oidMap = []; /** * Initializes a new UnitOfWork instance, bound to the given EntityManager. diff --git a/tests/Doctrine/Tests/ORM/Functional/IdentityMapTest.php b/tests/Doctrine/Tests/ORM/Functional/IdentityMapTest.php index 15a8fb4baca..94af7c92cc0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/IdentityMapTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/IdentityMapTest.php @@ -12,6 +12,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; use function count; +use function gc_collect_cycles; use function get_class; /** @@ -271,15 +272,14 @@ public function testHashCollision(): void $this->_em->flush(); $articles = []; - for ($i = 0; $i < 100; $i++) { - $article = new CmsArticle(); + for ($i = 0; $i < 100; ++$i) { + $articles[$i] = $article = new CmsArticle(); $article->topic = 'Test'; $article->text = 'Test'; $article->setAuthor($this->_em->merge($user)); $this->_em->persist($article); $this->_em->flush(); $this->_em->clear(); - $articles [] = $article; } $user = $this->_em->merge($user); @@ -293,14 +293,14 @@ public function testHashCollision(): void gc_collect_cycles(); $keep = []; - for ($x = 0; $x < 1000; $x++) { - $keep[] = $article = new CmsArticle(); + for ($x = 0; $x < 1000; ++$x) { + $keep[$x] = $article = new CmsArticle(); $article->topic = 'Test'; $article->text = 'Test'; $article->setAuthor($this->_em->merge($user)); $this->_em->persist($article); $this->_em->flush(); - $this->assertNotNull($article->id, 'Article wasn\'t persisted on iteration '.$x); + $this->assertNotNull($article->id, 'Article wasn\'t persisted on iteration ' . $x); } } }