Merge pull request #6121 from kalessil/sca
Static Code Analysis with Php Inspections (EA Extended)
This commit is contained in:
commit
8c38f5775d
@ -314,7 +314,7 @@ class DefaultCache implements Cache
|
|||||||
private function buildCollectionCacheKey(ClassMetadata $metadata, $association, $ownerIdentifier)
|
private function buildCollectionCacheKey(ClassMetadata $metadata, $association, $ownerIdentifier)
|
||||||
{
|
{
|
||||||
if ( ! is_array($ownerIdentifier)) {
|
if ( ! is_array($ownerIdentifier)) {
|
||||||
$ownerIdentifier = $this->toIdentifierArray($metadata, $ownerIdentifier);;
|
$ownerIdentifier = $this->toIdentifierArray($metadata, $ownerIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CollectionCacheKey($metadata->rootEntityName, $association, $ownerIdentifier);
|
return new CollectionCacheKey($metadata->rootEntityName, $association, $ownerIdentifier);
|
||||||
|
@ -53,6 +53,6 @@ class Lock
|
|||||||
*/
|
*/
|
||||||
public static function createLockRead()
|
public static function createLockRead()
|
||||||
{
|
{
|
||||||
return new self(uniqid(time()));
|
return new self(uniqid(time(), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ class DatabaseDriver implements MappingDriver
|
|||||||
$fkCols = $myFk->getForeignColumns();
|
$fkCols = $myFk->getForeignColumns();
|
||||||
$cols = $myFk->getColumns();
|
$cols = $myFk->getColumns();
|
||||||
|
|
||||||
for ($i = 0; $i < count($cols); $i++) {
|
for ($i = 0, $colsCount = count($cols); $i < $colsCount; $i++) {
|
||||||
$associationMapping['joinTable']['joinColumns'][] = array(
|
$associationMapping['joinTable']['joinColumns'][] = array(
|
||||||
'name' => $cols[$i],
|
'name' => $cols[$i],
|
||||||
'referencedColumnName' => $fkCols[$i],
|
'referencedColumnName' => $fkCols[$i],
|
||||||
@ -237,7 +237,7 @@ class DatabaseDriver implements MappingDriver
|
|||||||
$fkCols = $otherFk->getForeignColumns();
|
$fkCols = $otherFk->getForeignColumns();
|
||||||
$cols = $otherFk->getColumns();
|
$cols = $otherFk->getColumns();
|
||||||
|
|
||||||
for ($i = 0; $i < count($cols); $i++) {
|
for ($i = 0, $colsCount = count($cols); $i < $colsCount; $i++) {
|
||||||
$associationMapping['joinTable']['inverseJoinColumns'][] = array(
|
$associationMapping['joinTable']['inverseJoinColumns'][] = array(
|
||||||
'name' => $cols[$i],
|
'name' => $cols[$i],
|
||||||
'referencedColumnName' => $fkCols[$i],
|
'referencedColumnName' => $fkCols[$i],
|
||||||
@ -465,7 +465,7 @@ class DatabaseDriver implements MappingDriver
|
|||||||
$associationMapping['id'] = true;
|
$associationMapping['id'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < count($fkColumns); $i++) {
|
for ($i = 0, $fkColumnsCount = count($fkColumns); $i < $fkColumnsCount; $i++) {
|
||||||
$associationMapping['joinColumns'][] = array(
|
$associationMapping['joinColumns'][] = array(
|
||||||
'name' => $fkColumns[$i],
|
'name' => $fkColumns[$i],
|
||||||
'referencedColumnName' => $fkForeignColumns[$i],
|
'referencedColumnName' => $fkForeignColumns[$i],
|
||||||
|
@ -45,7 +45,7 @@ class ParameterTypeInferer
|
|||||||
*/
|
*/
|
||||||
public static function inferType($value)
|
public static function inferType($value)
|
||||||
{
|
{
|
||||||
if (is_integer($value)) {
|
if (is_int($value)) {
|
||||||
return Type::INTEGER;
|
return Type::INTEGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class ParameterTypeInferer
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
return is_integer(current($value))
|
return is_int(current($value))
|
||||||
? Connection::PARAM_INT_ARRAY
|
? Connection::PARAM_INT_ARRAY
|
||||||
: Connection::PARAM_STR_ARRAY;
|
: Connection::PARAM_STR_ARRAY;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function offsetSet($offset, $value)
|
public function offsetSet($offset, $value)
|
||||||
{
|
{
|
||||||
if (is_null($offset)) {
|
if (null === $offset) {
|
||||||
$this->walkers[] = $value;
|
$this->walkers[] = $value;
|
||||||
} else {
|
} else {
|
||||||
$this->walkers[$offset] = $value;
|
$this->walkers[$offset] = $value;
|
||||||
|
@ -1458,7 +1458,7 @@ class QueryBuilder
|
|||||||
*/
|
*/
|
||||||
public function resetDQLParts($parts = null)
|
public function resetDQLParts($parts = null)
|
||||||
{
|
{
|
||||||
if (is_null($parts)) {
|
if (null === $parts) {
|
||||||
$parts = array_keys($this->_dqlParts);
|
$parts = array_keys($this->_dqlParts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ EOT
|
|||||||
$output->writeln('');
|
$output->writeln('');
|
||||||
}
|
}
|
||||||
|
|
||||||
$exit += 1;
|
++$exit;
|
||||||
} else {
|
} else {
|
||||||
$output->writeln('<info>[Mapping] OK - The mapping files are correct.</info>');
|
$output->writeln('<info>[Mapping] OK - The mapping files are correct.</info>');
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class DebugUnitOfWorkListener
|
|||||||
$uow = $em->getUnitOfWork();
|
$uow = $em->getUnitOfWork();
|
||||||
$identityMap = $uow->getIdentityMap();
|
$identityMap = $uow->getIdentityMap();
|
||||||
|
|
||||||
$fh = fopen($this->file, "x+");
|
$fh = fopen($this->file, 'xb+');
|
||||||
if (count($identityMap) == 0) {
|
if (count($identityMap) == 0) {
|
||||||
fwrite($fh, "Flush Operation [".$this->context."] - Empty identity map.\n");
|
fwrite($fh, "Flush Operation [".$this->context."] - Empty identity map.\n");
|
||||||
|
|
||||||
|
@ -808,7 +808,7 @@ public function __construct(<params>)
|
|||||||
$inNamespace = false;
|
$inNamespace = false;
|
||||||
$inClass = false;
|
$inClass = false;
|
||||||
|
|
||||||
for ($i = 0; $i < count($tokens); $i++) {
|
for ($i = 0, $tokensCount = count($tokens); $i < $tokensCount; $i++) {
|
||||||
$token = $tokens[$i];
|
$token = $tokens[$i];
|
||||||
if (in_array($token[0], array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT))) {
|
if (in_array($token[0], array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT))) {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user