1
0
mirror of synced 2025-01-20 07:21:40 +03:00

Strong typehinting to avoid incorrect constructor params

This commit is contained in:
Marco Pivetta 2013-02-04 20:45:58 +01:00
parent f0674ea034
commit 3ebed101fd
3 changed files with 13 additions and 7 deletions

View File

@ -19,6 +19,8 @@
namespace Doctrine\ORM\Event;
use Doctrine\ORM\EntityManager;
/**
* Provides event arguments for the onClear event.
*
@ -46,7 +48,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs
* @param \Doctrine\ORM\EntityManager $em
* @param string|null $entityClass Optional entity class.
*/
public function __construct($em, $entityClass = null)
public function __construct(EntityManager $em, $entityClass = null)
{
$this->em = $em;
$this->entityClass = $entityClass;

View File

@ -19,6 +19,7 @@
namespace Doctrine\ORM\Event;
use Doctrine\Common\EventArgs;
use Doctrine\ORM\EntityManager;
/**
@ -30,7 +31,7 @@ use Doctrine\ORM\EntityManager;
* @author Roman Borschel <roman@code-factory.de>
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class OnFlushEventArgs extends \Doctrine\Common\EventArgs
class OnFlushEventArgs extends EventArgs
{
/**
* @var \Doctrine\ORM\EntityManager

View File

@ -19,6 +19,9 @@
namespace Doctrine\ORM\Event;
use Doctrine\Common\EventArgs;
use Doctrine\ORM\EntityManager;
/**
* Provides event arguments for the preFlush event.
*
@ -28,21 +31,21 @@ namespace Doctrine\ORM\Event;
* @author Roman Borschel <roman@code-factory.de>
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class PreFlushEventArgs extends \Doctrine\Common\EventArgs
class PreFlushEventArgs extends EventArgs
{
/**
* @var \Doctrine\ORM\EntityManager
*/
private $_em;
private $em;
/**
* Constructor.
*
* @param \Doctrine\ORM\EntityManager $em
*/
public function __construct($em)
public function __construct(EntityManager $em)
{
$this->_em = $em;
$this->em = $em;
}
/**
@ -50,6 +53,6 @@ class PreFlushEventArgs extends \Doctrine\Common\EventArgs
*/
public function getEntityManager()
{
return $this->_em;
return $this->em;
}
}