Skip to content

Commit c05edcc

Browse files
committed
[Security] fix DBAL connection typehint
1 parent e96b018 commit c05edcc

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class EntityChoiceList extends ObjectChoiceList
9191
* @param string $class The class name
9292
* @param string $labelPath The property path used for the label
9393
* @param EntityLoaderInterface $entityLoader An optional query builder
94-
* @param array $entities An array of choices
94+
* @param array|\Traversable|null $entities An array of choices or null to lazy load
9595
* @param array $preferredEntities An array of preferred choices
9696
* @param string $groupPath A property path pointing to the property used
9797
* to group the choices. Only allowed if

src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Security\Core\Exception\TokenNotFoundException;
1818
use Doctrine\DBAL\Connection;
1919
use Doctrine\DBAL\Types\Type as DoctrineType;
20-
use PDO, DateTime;
2120

2221
/**
2322
* This class provides storage for the tokens that is set in "remember me"
@@ -64,15 +63,15 @@ public function loadTokenBySeries($series)
6463
$sql = 'SELECT class, username, value, lastUsed'
6564
. ' FROM rememberme_token WHERE series=:series';
6665
$paramValues = array('series' => $series);
67-
$paramTypes = array('series' => PDO::PARAM_STR);
66+
$paramTypes = array('series' => \PDO::PARAM_STR);
6867
$stmt = $this->conn->executeQuery($sql, $paramValues, $paramTypes);
69-
$row = $stmt->fetch(PDO::FETCH_ASSOC);
68+
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
7069
if ($row) {
7170
return new PersistentToken($row['class'],
7271
$row['username'],
7372
$series,
7473
$row['value'],
75-
new DateTime($row['lastUsed'])
74+
new \DateTime($row['lastUsed'])
7675
);
7776
}
7877

@@ -86,23 +85,23 @@ public function deleteTokenBySeries($series)
8685
{
8786
$sql = 'DELETE FROM rememberme_token WHERE series=:series';
8887
$paramValues = array('series' => $series);
89-
$paramTypes = array('series' => PDO::PARAM_STR);
88+
$paramTypes = array('series' => \PDO::PARAM_STR);
9089
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
9190
}
9291

9392
/**
9493
* {@inheritdoc}
9594
*/
96-
public function updateToken($series, $tokenValue, DateTime $lastUsed)
95+
public function updateToken($series, $tokenValue, \DateTime $lastUsed)
9796
{
9897
$sql = 'UPDATE rememberme_token SET value=:value, lastUsed=:lastUsed'
9998
. ' WHERE series=:series';
10099
$paramValues = array('value' => $tokenValue,
101100
'lastUsed' => $lastUsed,
102101
'series' => $series);
103-
$paramTypes = array('value' => PDO::PARAM_STR,
102+
$paramTypes = array('value' => \PDO::PARAM_STR,
104103
'lastUsed' => DoctrineType::DATETIME,
105-
'series' => PDO::PARAM_STR);
104+
'series' => \PDO::PARAM_STR);
106105
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
107106
if ($updated < 1) {
108107
throw new TokenNotFoundException('No token found.');
@@ -122,10 +121,10 @@ public function createNewToken(PersistentTokenInterface $token)
122121
'series' => $token->getSeries(),
123122
'value' => $token->getTokenValue(),
124123
'lastUsed' => $token->getLastUsed());
125-
$paramTypes = array('class' => PDO::PARAM_STR,
126-
'username' => PDO::PARAM_STR,
127-
'series' => PDO::PARAM_STR,
128-
'value' => PDO::PARAM_STR,
124+
$paramTypes = array('class' => \PDO::PARAM_STR,
125+
'username' => \PDO::PARAM_STR,
126+
'series' => \PDO::PARAM_STR,
127+
'value' => \PDO::PARAM_STR,
129128
'lastUsed' => DoctrineType::DATETIME);
130129
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
131130
}

src/Symfony/Component/Security/Acl/Dbal/AclProvider.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Acl\Dbal;
1313

14-
use Doctrine\DBAL\Driver\Connection;
14+
use Doctrine\DBAL\Connection;
1515
use Doctrine\DBAL\Driver\Statement;
1616
use Symfony\Component\Security\Acl\Model\AclInterface;
1717
use Symfony\Component\Security\Acl\Domain\Acl;
@@ -38,11 +38,22 @@ class AclProvider implements AclProviderInterface
3838
{
3939
const MAX_BATCH_SIZE = 30;
4040

41+
/**
42+
* @var AclCacheInterface|null
43+
*/
4144
protected $cache;
45+
46+
/**
47+
* @var Connection
48+
*/
4249
protected $connection;
43-
protected $loadedAces;
44-
protected $loadedAcls;
50+
protected $loadedAces = array();
51+
protected $loadedAcls = array();
4552
protected $options;
53+
54+
/**
55+
* @var PermissionGrantingStrategyInterface
56+
*/
4657
private $permissionGrantingStrategy;
4758

4859
/**
@@ -57,8 +68,6 @@ public function __construct(Connection $connection, PermissionGrantingStrategyIn
5768
{
5869
$this->cache = $cache;
5970
$this->connection = $connection;
60-
$this->loadedAces = array();
61-
$this->loadedAcls = array();
6271
$this->options = $options;
6372
$this->permissionGrantingStrategy = $permissionGrantingStrategy;
6473
}

src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\Security\Acl\Dbal;
1313

1414
use Doctrine\Common\PropertyChangedListener;
15-
use Doctrine\DBAL\Driver\Connection;
15+
use Doctrine\DBAL\Connection;
1616
use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
1717
use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
1818
use Symfony\Component\Security\Acl\Exception\AclAlreadyExistsException;

0 commit comments

Comments
 (0)