Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Feb 12, 2021
1 parent 8aaba64 commit bf02fd4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/AuditReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function find($className, $id, $revision, array $options = [])
}

foreach ($class->associationMappings as $assoc) {
if (($assoc['type'] & ClassMetadata::TO_ONE) == 0 || !$assoc['isOwningSide']) {
if (($assoc['type'] & ClassMetadata::TO_ONE) === 0 || !$assoc['isOwningSide']) {
continue;
}

Expand All @@ -278,7 +278,7 @@ public function find($className, $id, $revision, array $options = [])
}

$joinSql = '';
if ($class->isInheritanceTypeJoined() && $class->name != $class->rootEntityName) {
if ($class->isInheritanceTypeJoined() && $class->name !== $class->rootEntityName) {
/** @var ClassMetadataInfo|ClassMetadata $rootClass */
$rootClass = $this->em->getClassMetadata($class->rootEntityName);
$rootTableName = $this->config->getTableName($rootClass);
Expand Down Expand Up @@ -314,7 +314,7 @@ public function find($className, $id, $revision, array $options = [])
throw new NoRevisionFoundException($class->name, $id, $revision);
}

if ($options['threatDeletionsAsExceptions'] && 'DEL' == $row[$this->config->getRevisionTypeFieldName()]) {
if ($options['threatDeletionsAsExceptions'] && 'DEL' === $row[$this->config->getRevisionTypeFieldName()]) {
throw new DeletedException($class->name, $id, $revision);
}

Expand Down Expand Up @@ -415,7 +415,7 @@ public function findEntitiesChangedAtRevision($revision)
$columnList .= ', e.'.$class->discriminatorColumn['name'];
$whereSQL .= ' AND e.'.$class->discriminatorColumn['fieldName'].' = ?';
$params[] = $class->discriminatorValue;
} elseif ($class->isInheritanceTypeJoined() && $class->rootEntityName != $class->name) {
} elseif ($class->isInheritanceTypeJoined() && $class->rootEntityName !== $class->name) {
$columnList .= ', re.'.$class->discriminatorColumn['name'];

/** @var ClassMetadataInfo|ClassMetadata $rootClass */
Expand Down Expand Up @@ -466,7 +466,7 @@ public function findRevision($rev)
$query = 'SELECT * FROM '.$this->config->getRevisionTableName().' r WHERE r.id = ?';
$revisionsData = $this->em->getConnection()->fetchAll($query, [$rev]);

if (1 == \count($revisionsData)) {
if (1 === \count($revisionsData)) {
return new Revision(
$revisionsData[0]['id'],
\DateTime::createFromFormat($this->platform->getDateTimeFormatString(), $revisionsData[0]['timestamp']),
Expand Down Expand Up @@ -664,7 +664,7 @@ public function getEntityHistory($className, $id)
}

foreach ($class->associationMappings as $assoc) {
if (($assoc['type'] & ClassMetadata::TO_ONE) == 0 || !$assoc['isOwningSide']) {
if (($assoc['type'] & ClassMetadata::TO_ONE) === 0 || !$assoc['isOwningSide']) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Collection/AuditedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function isEmpty()
{
$this->initialize();

return 0 == \count($this->entities);
return 0 === \count($this->entities);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/CreateSchemaListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $eventArgs)

if (!$this->metadataFactory->isAudited($cm->name)) {
$audited = false;
if ($cm->isInheritanceTypeJoined() && $cm->rootEntityName == $cm->name) {
if ($cm->isInheritanceTypeJoined() && $cm->rootEntityName === $cm->name) {
foreach ($cm->subClasses as $subClass) {
if ($this->metadataFactory->isAudited($subClass)) {
$audited = true;
Expand Down
14 changes: 7 additions & 7 deletions src/EventListener/LogRevisionsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function postFlush(PostFlushEventArgs $eventArgs): void
foreach ($meta->associationMappings as $mapping) {
if (isset($mapping['joinColumns'])) {
foreach ($mapping['joinColumns'] as $definition) {
if ($definition['name'] == $column) {
if ($definition['name'] === $column) {
$targetTable = $em->getClassMetadata($mapping['targetEntity']);
$type = $targetTable->getTypeOfColumn($definition['referencedColumnName']);
}
Expand Down Expand Up @@ -219,7 +219,7 @@ public function postUpdate(LifecycleEventArgs $eventArgs): void
}

// if we have no changes left => don't create revision log
if (0 == \count($changeset)) {
if (0 === \count($changeset)) {
return;
}

Expand Down Expand Up @@ -369,7 +369,7 @@ private function getInsertRevisionSQL($class)
$sql .= ', '.$this->quoteStrategy->getColumnName($field, $class, $this->platform);
}

if (($class->isInheritanceTypeJoined() && $class->rootEntityName == $class->name)
if (($class->isInheritanceTypeJoined() && $class->rootEntityName === $class->name)
|| $class->isInheritanceTypeSingleTable()
) {
$sql .= ', '.$class->discriminatorColumn['name'];
Expand Down Expand Up @@ -444,13 +444,13 @@ private function saveRevisionEntityData($class, $entityData, $revType): void
$params[] = $class->discriminatorValue;
$types[] = $class->discriminatorColumn['type'];
} elseif ($class->isInheritanceTypeJoined()
&& $class->name == $class->rootEntityName
&& $class->name === $class->rootEntityName
) {
$params[] = $entityData[$class->discriminatorColumn['name']];
$types[] = $class->discriminatorColumn['type'];
}

if ($class->isInheritanceTypeJoined() && $class->name != $class->rootEntityName) {
if ($class->isInheritanceTypeJoined() && $class->name !== $class->rootEntityName) {
$entityData[$class->discriminatorColumn['name']] = $class->discriminatorValue;
$this->saveRevisionEntityData(
$this->em->getClassMetadata($class->rootEntityName),
Expand Down Expand Up @@ -504,12 +504,12 @@ private function prepareUpdateData($persister, $entity)
$versionField = null;
$result = [];

if (false != ($versioned = $classMetadata->isVersioned)) {
if (false !== ($versioned = $classMetadata->isVersioned)) {
$versionField = $classMetadata->versionField;
}

foreach ($uow->getEntityChangeSet($entity) as $field => $change) {
if (isset($versionField) && $versionField == $field) {
if (isset($versionField) && $versionField === $field) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Utils/ArrayDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function diff($oldData, $newData)
$old = \array_key_exists($field, $oldData) ? $oldData[$field] : null;
$new = \array_key_exists($field, $newData) ? $newData[$field] : null;

if ($old == $new) {
if ($old === $new) {
$row = ['old' => '', 'new' => '', 'same' => $old];
} else {
$row = ['old' => $old, 'new' => $new, 'same' => ''];
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/SimpleDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function diff(array $old, array $new)
}
}
}
if (0 == $maxlen) {
if (0 === $maxlen) {
return [['d' => $old, 'i' => $new]];
}

Expand Down

0 comments on commit bf02fd4

Please sign in to comment.