Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Clean elses #1382

Merged
merged 1 commit into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Faker/ORM/Propel/ColumnTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public function guessFormat(ColumnMap $column)
return function () use ($generator) {
return $generator->dateTime;
};
} else {
return function () use ($generator) {
return $generator->dateTimeAD;
};
}

return function () use ($generator) {
return $generator->dateTimeAD;
};
}
$type = $column->getType();
switch ($type) {
Expand Down
8 changes: 4 additions & 4 deletions src/Faker/ORM/Propel2/ColumnTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public function guessFormat(ColumnMap $column)
return function () use ($generator) {
return $generator->dateTime;
};
} else {
return function () use ($generator) {
return $generator->dateTimeAD;
};
}

return function () use ($generator) {
return $generator->dateTimeAD;
};
}
$type = $column->getType();
switch ($type) {
Expand Down
26 changes: 13 additions & 13 deletions src/Faker/ORM/Spot/EntityPopulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,22 @@ public function guessColumnFormatters(Generator $generator)
$formatters[$fieldName] = function ($inserted) use ($required, $entityName, $locator) {
if (!empty($inserted[$entityName])) {
return $inserted[$entityName][mt_rand(0, count($inserted[$entityName]) - 1)]->getId();
} else {
if ($required && $this->useExistingData) {
// We did not add anything like this, but it's required,
// So let's find something existing in DB.
$mapper = $this->locator->mapper($entityName);
$records = $mapper->all()->limit(self::RELATED_FETCH_COUNT)->toArray();
if (empty($records)) {
return null;
}
$id = $records[mt_rand(0, count($records) - 1)]['id'];

return $id;
} else {
}

if ($required && $this->useExistingData) {
// We did not add anything like this, but it's required,
// So let's find something existing in DB.
$mapper = $this->locator->mapper($entityName);
$records = $mapper->all()->limit(self::RELATED_FETCH_COUNT)->toArray();
if (empty($records)) {
return null;
}
$id = $records[mt_rand(0, count($records) - 1)]['id'];

return $id;
}

return null;
};

}
Expand Down
6 changes: 3 additions & 3 deletions src/Faker/Provider/es_VE/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Person extends \Faker\Provider\Person
protected static $titleFemale = array('Sra.', 'Srita.', 'Dra.', 'Lcda.', 'Ing.');

private static $suffix = array('Hijo');

private static $nationalityId = array('V', 'E');

/**
Expand All @@ -160,8 +160,8 @@ public function nationalId($separator = '')
$id = static::randomElement(static::$nationalityId);
if ($id == 'V') {
return $id . $separator . $this->numberBetween(10000, 100000000);
} else {
return $id . $separator . $this->numberBetween(80000000, 100000000);
}

return $id . $separator . $this->numberBetween(80000000, 100000000);
}
}