Skip to content

Commit

Permalink
Typehint on AbstractContainer, but instantiate Container
Browse files Browse the repository at this point in the history
- Imports will work against class_alias
- Typehinting works, *except* when using mocks, as mocks do not take
  into account class aliasing.
  • Loading branch information
weierophinney committed Mar 5, 2013
1 parent 05bc3b1 commit 41dbee9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions library/Zend/Validator/Csrf.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

use Traversable;
use Zend\Math\Rand;
use Zend\Session\AbstractContainer as SessionContainer;
use Zend\Session\AbstractContainer;
use Zend\Session\Container as SessionContainer;
use Zend\Stdlib\ArrayUtils;

class Csrf extends AbstractValidator
Expand Down Expand Up @@ -58,7 +59,7 @@ class Csrf extends AbstractValidator
protected $salt = 'salt';

/**
* @var SessionContainer
* @var AbstractContainer
*/
protected $session;

Expand Down Expand Up @@ -152,10 +153,10 @@ public function getName()
/**
* Set session container
*
* @param SessionContainer $session
* @param AbstractContainer $session
* @return Csrf
*/
public function setSession(SessionContainer $session)
public function setSession(AbstractContainer $session)
{
$this->session = $session;
if ($this->hash) {
Expand All @@ -169,13 +170,13 @@ public function setSession(SessionContainer $session)
*
* Instantiate session container if none currently exists
*
* @return SessionContainer
* @return AbstractContainer
*/
public function getSession()
{
if (null === $this->session) {
// Using fully qualified name, to ensure polyfill class alias is used
$this->session = new \Zend\Session\Container($this->getSessionName());
$this->session = new SessionContainer($this->getSessionName());
}
return $this->session;
}
Expand Down

0 comments on commit 41dbee9

Please sign in to comment.