diff --git a/lib/Doctrine/ORM/Cache/DefaultCache.php b/lib/Doctrine/ORM/Cache/DefaultCache.php
index 78a22a80f..2557da4c1 100644
--- a/lib/Doctrine/ORM/Cache/DefaultCache.php
+++ b/lib/Doctrine/ORM/Cache/DefaultCache.php
@@ -314,7 +314,7 @@ class DefaultCache implements Cache
private function buildCollectionCacheKey(ClassMetadata $metadata, $association, $ownerIdentifier)
{
if ( ! is_array($ownerIdentifier)) {
- $ownerIdentifier = $this->toIdentifierArray($metadata, $ownerIdentifier);;
+ $ownerIdentifier = $this->toIdentifierArray($metadata, $ownerIdentifier);
}
return new CollectionCacheKey($metadata->rootEntityName, $association, $ownerIdentifier);
diff --git a/lib/Doctrine/ORM/Cache/Lock.php b/lib/Doctrine/ORM/Cache/Lock.php
index 5346aa323..60f7d6c9d 100644
--- a/lib/Doctrine/ORM/Cache/Lock.php
+++ b/lib/Doctrine/ORM/Cache/Lock.php
@@ -53,6 +53,6 @@ class Lock
*/
public static function createLockRead()
{
- return new self(uniqid(time()));
+ return new self(uniqid(time(), true));
}
}
diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
index 9e036b652..2d9013229 100644
--- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
+++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
@@ -1629,6 +1629,7 @@ class ClassMetadataInfo implements ClassMetadata
? $joinColumn['fieldName']
: $joinColumn['name'];
}
+ unset($joinColumn);
if ($uniqueConstraintColumns) {
if ( ! $this->table) {
@@ -1754,6 +1755,7 @@ class ClassMetadataInfo implements ClassMetadata
$mapping['relationToSourceKeyColumns'][$joinColumn['name']] = $joinColumn['referencedColumnName'];
$mapping['joinTableColumns'][] = $joinColumn['name'];
}
+ unset($joinColumn);
foreach ($mapping['joinTable']['inverseJoinColumns'] as &$inverseJoinColumn) {
if (empty($inverseJoinColumn['name'])) {
@@ -1781,6 +1783,7 @@ class ClassMetadataInfo implements ClassMetadata
$mapping['relationToTargetKeyColumns'][$inverseJoinColumn['name']] = $inverseJoinColumn['referencedColumnName'];
$mapping['joinTableColumns'][] = $inverseJoinColumn['name'];
}
+ unset($inverseJoinColumn);
}
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) && $mapping['orphanRemoval'];
diff --git a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
index ac3b309fd..d6ddaf2d0 100644
--- a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
+++ b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
@@ -227,7 +227,7 @@ class DatabaseDriver implements MappingDriver
$fkCols = $myFk->getForeignColumns();
$cols = $myFk->getColumns();
- for ($i = 0; $i < count($cols); $i++) {
+ for ($i = 0, $colsCount = count($cols); $i < $colsCount; $i++) {
$associationMapping['joinTable']['joinColumns'][] = array(
'name' => $cols[$i],
'referencedColumnName' => $fkCols[$i],
@@ -237,7 +237,7 @@ class DatabaseDriver implements MappingDriver
$fkCols = $otherFk->getForeignColumns();
$cols = $otherFk->getColumns();
- for ($i = 0; $i < count($cols); $i++) {
+ for ($i = 0, $colsCount = count($cols); $i < $colsCount; $i++) {
$associationMapping['joinTable']['inverseJoinColumns'][] = array(
'name' => $cols[$i],
'referencedColumnName' => $fkCols[$i],
@@ -465,7 +465,7 @@ class DatabaseDriver implements MappingDriver
$associationMapping['id'] = true;
}
- for ($i = 0; $i < count($fkColumns); $i++) {
+ for ($i = 0, $fkColumnsCount = count($fkColumns); $i < $fkColumnsCount; $i++) {
$associationMapping['joinColumns'][] = array(
'name' => $fkColumns[$i],
'referencedColumnName' => $fkForeignColumns[$i],
diff --git a/lib/Doctrine/ORM/Query/ParameterTypeInferer.php b/lib/Doctrine/ORM/Query/ParameterTypeInferer.php
index a12a559a7..597c7e2ea 100644
--- a/lib/Doctrine/ORM/Query/ParameterTypeInferer.php
+++ b/lib/Doctrine/ORM/Query/ParameterTypeInferer.php
@@ -45,7 +45,7 @@ class ParameterTypeInferer
*/
public static function inferType($value)
{
- if (is_integer($value)) {
+ if (is_int($value)) {
return Type::INTEGER;
}
@@ -58,7 +58,7 @@ class ParameterTypeInferer
}
if (is_array($value)) {
- return is_integer(current($value))
+ return is_int(current($value))
? Connection::PARAM_INT_ARRAY
: Connection::PARAM_STR_ARRAY;
}
diff --git a/lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php b/lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php
index ee329604f..30db08175 100644
--- a/lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php
+++ b/lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php
@@ -119,7 +119,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
*/
public function offsetSet($offset, $value)
{
- if (is_null($offset)) {
+ if (null === $offset) {
$this->walkers[] = $value;
} else {
$this->walkers[$offset] = $value;
diff --git a/lib/Doctrine/ORM/QueryBuilder.php b/lib/Doctrine/ORM/QueryBuilder.php
index ca754d66d..455e39ab3 100644
--- a/lib/Doctrine/ORM/QueryBuilder.php
+++ b/lib/Doctrine/ORM/QueryBuilder.php
@@ -1458,7 +1458,7 @@ class QueryBuilder
*/
public function resetDQLParts($parts = null)
{
- if (is_null($parts)) {
+ if (null === $parts) {
$parts = array_keys($this->_dqlParts);
}
diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php
index 71d72deb8..0eb1735dc 100644
--- a/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php
+++ b/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php
@@ -180,6 +180,7 @@ EOT
);
}
}
+ unset($dirName);
if ( ! file_exists($destPath)) {
throw new \InvalidArgumentException(
diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php
index eb7697ccb..57b16fc1c 100644
--- a/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php
+++ b/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php
@@ -87,7 +87,7 @@ EOT
$output->writeln('');
}
- $exit += 1;
+ ++$exit;
} else {
$output->writeln('[Mapping] OK - The mapping files are correct.');
}
diff --git a/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php b/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php
index 8c9a24f38..41927ce7a 100644
--- a/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php
+++ b/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php
@@ -78,7 +78,7 @@ class DebugUnitOfWorkListener
$uow = $em->getUnitOfWork();
$identityMap = $uow->getIdentityMap();
- $fh = fopen($this->file, "x+");
+ $fh = fopen($this->file, 'xb+');
if (count($identityMap) == 0) {
fwrite($fh, "Flush Operation [".$this->context."] - Empty identity map.\n");
diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php
index 0fd7f3e84..3c840ecbb 100644
--- a/lib/Doctrine/ORM/Tools/EntityGenerator.php
+++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php
@@ -808,7 +808,7 @@ public function __construct()
$inNamespace = false;
$inClass = false;
- for ($i = 0; $i < count($tokens); $i++) {
+ for ($i = 0, $tokensCount = count($tokens); $i < $tokensCount; $i++) {
$token = $tokens[$i];
if (in_array($token[0], array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT))) {
continue;