Skip to content

Commit

Permalink
Coding style: NULL => null
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Jan 3, 2021
1 parent 456c457 commit fa9a1b3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/LeanMapper/Bridges/Nette/DI/LeanMapperExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class LeanMapperExtension extends Nette\DI\CompilerExtension


/**
* @param string[]|string|NULL $scanDirs
* @param string[]|string|null $scanDirs
*/
public function __construct($scanDirs = NULL)
public function __construct($scanDirs = null)
{
$this->defaults['scanDirs'] = $scanDirs;
}
Expand Down
2 changes: 1 addition & 1 deletion src/LeanMapper/DefaultMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getRelationshipTable(string $sourceTable, string $targetTable):
*/
public function getRelationshipColumn(string $sourceTable, string $targetTable, ?string $relationshipName = null): string
{
return ($relationshipName !== NULL ? $relationshipName : $targetTable) . '_' . $this->getPrimaryKey($targetTable);
return ($relationshipName !== null ? $relationshipName : $targetTable) . '_' . $this->getPrimaryKey($targetTable);
}


Expand Down
2 changes: 1 addition & 1 deletion src/LeanMapper/Relationship/BelongsTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getTargetTable(): ?string

public function hasTargetTable(): bool
{
return $this->targetTable !== NULL;
return $this->targetTable !== null;
}


Expand Down
2 changes: 1 addition & 1 deletion src/LeanMapper/Relationship/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getRelationshipTable(): ?string

public function hasRelationshipTable(): bool
{
return $this->relationshipTable !== NULL;
return $this->relationshipTable !== null;
}


Expand Down
2 changes: 1 addition & 1 deletion src/LeanMapper/Relationship/HasOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getTargetTable(): ?string

public function hasTargetTable(): bool
{
return $this->targetTable !== NULL;
return $this->targetTable !== null;
}

}
11 changes: 11 additions & 0 deletions tools/code-checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@
$checker->addTask([$tasks, 'tabIndentationChecker'], '*.json');
$checker->addTask([$tasks, 'yamlIndentationChecker'], '*.php,*.phpt');
$checker->addTask([$tasks, 'unexpectedTabsChecker'], '*.yml');
$checker->addTask(function (string $contents, Nette\CodeChecker\Result $result) {
foreach (@token_get_all($contents) as $token) { // @ can trigger error
if (is_array($token) && $token[0] === T_STRING) {
$keyword = strtolower($token[1]);

if (($keyword === 'null' || $keyword === 'true' || $keyword === 'false') && $token[1] !== $keyword) {
$result->error("Invalid $keyword keyword", $token[2]);
}
}
}
}, '*.php,*.phpt');

$ok = $checker->run([__DIR__ . '/../']);

Expand Down

0 comments on commit fa9a1b3

Please sign in to comment.