Skip to content

Commit

Permalink
Sorry, Yoda
Browse files Browse the repository at this point in the history
  • Loading branch information
GwendolenLynch committed Nov 19, 2017
1 parent ec8792c commit 3329815
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Form/Validator/Constraints/ExistingEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ExistingEntity extends Constraint
*/
public function __construct($options = null)
{
if (null !== $options && !is_array($options)) {
if ($options !== null && !is_array($options)) {
$options = [
'className' => $options,
'fieldNames' => $options,
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function trimText($str, $desiredLength, $hellip = true, $cutOffCap
$nextChar = mb_substr($str, $newLength, 1);
$str = mb_substr($str, 0, $newLength);
if ($nextChar != ' ') {
if (false !== ($lastSpace = mb_strrpos($str, ' '))) {
if (($lastSpace = mb_strrpos($str, ' ')) !== false) {
// Check for to long cutoff
if (mb_strlen($str) - $lastSpace >= $cutOffCap) {
// Trim the ellipse, as we do not want a space now
Expand Down
2 changes: 1 addition & 1 deletion src/Logger/Handler/RecordChangeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function handle(array $record)
// Nothing.
}

return false === $this->bubble;
return $this->bubble === false;
}

protected function write(array $record)
Expand Down
2 changes: 1 addition & 1 deletion src/Logger/Handler/SystemHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function handle(array $record)
// Nothing.
}

return false === $this->bubble;
return $this->bubble === false;
}

protected function write(array $record)
Expand Down
2 changes: 1 addition & 1 deletion src/Nut/Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected function onRead($data)
*/
private function hasSttyAvailable()
{
if (null !== self::$stty) {
if (self::$stty !== null) {
return self::$stty;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Nut/Style/NutStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function confirmThenRemove($question, $default = true)
*/
public function choiceThenRemove($question, array $choices, $default = null)
{
if (null !== $default) {
if ($default !== null) {
$values = array_flip($choices);
$default = $values[$default];
}
Expand Down Expand Up @@ -166,7 +166,7 @@ public function captureUserInput($input)
*/
public function isQuiet()
{
return self::VERBOSITY_QUIET === $this->getVerbosity();
return $this->getVerbosity() === self::VERBOSITY_QUIET;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Field/Type/FieldTypeBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function persist(QuerySet $queries, $entity)

$type = $this->getStorageTypeObject();

if (null !== $value) {
if ($value !== null) {
$value = $type->convertToDatabaseValue($value, $this->getPlatform());
} elseif (isset($this->mapping['default'])) {
$value = $this->mapping['default'];
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Field/Type/TemplateFieldsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function persist(QuerySet $queries, $entity)

$type = $this->getStorageType();

if (null !== $value) {
if ($value !== null) {
$metadata = $this->buildMetadata($entity);
$value = $this->serialize($value, $metadata);
$value = $type->convertToDatabaseValue($value, $this->getPlatform());
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Mapping/MetadataDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public function setContentFields($contentKey, $className, $table)
public function loadMetadataForClass($className, ClassMetadata $metadata = null)
{
$fullClassName = null;
if (null === $metadata) {
if ($metadata === null) {
$fullClassName = $this->resolveClassName($className);
$metadata = new BoltClassMetadata($fullClassName, $this->namingStrategy);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function create($params = [], ClassMetadata $metadata = null)
*/
public function createQueryBuilder($alias = null)
{
if (null === $alias) {
if ($alias === null) {
$alias = $this->getAlias();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twig/SwitchNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function compile(Compiler $compiler)
;
}

if ($this->hasNode('default') && null !== $this->getNode('default')) {
if ($this->hasNode('default') && $this->getNode('default') !== null) {
$compiler
->write("default:\n")
->indent()
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/unit/BoltUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function addDefaultUser(Application $app)
{
// Check if default user exists before adding
$existingUser = $app['users']->getUser('admin');
if (false !== $existingUser) {
if ($existingUser !== false) {
return $existingUser;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/unit/Menu/MenuBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function testpopulateItemFromRecord($expected, $content, $item, $link)
$app['request'] = Request::createFromGlobals();

$contentMock = null;
if (false !== $content) {
if ($content !== false) {
$contentMock = $this->getMockBuilder(Content::class)
->setMethods(['getContent', 'link'])
->setConstructorArgs([$app])
Expand Down

0 comments on commit 3329815

Please sign in to comment.