Skip to content

Commit

Permalink
Merge pull request #25 from worksome/feature/ecs
Browse files Browse the repository at this point in the history
style: apply fixes from ECS
  • Loading branch information
owenvoke authored Oct 18, 2024
2 parents 4f5e36c + 68e458e commit 034d030
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/FoggyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$process = new DumpProcess($dsn, $configFile, $output);
$process->run();

return 0;
}
}
2 changes: 1 addition & 1 deletion src/Rules/FakerRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class FakerRule implements Rule
{
protected static ?FakerGenerator $faker = null;
protected static FakerGenerator|null $faker = null;

public static function faker(): FakerGenerator
{
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/PhpRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static function handle(SettingsRule $rule, Connection $db, array $row, st
$result = eval("return {$rule->getValue()};");

if ($result === null) {
return "NULL";
return 'NULL';
}

return $db->quote($result);
Expand Down
6 changes: 3 additions & 3 deletions src/Settings/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function hasCondition(): bool
return $this->getCondition() !== null || $this->getTimes() !== null;
}

public function getCondition(): ?string
public function getCondition(): string|null
{
return $this->settings->condition ?? null;
}
Expand All @@ -44,12 +44,12 @@ public function getColumn(): string
return $this->settings->column;
}

public function getValue(): ?string
public function getValue(): string|null
{
return $this->settings->value ?? null;
}

public function getTimes(): ?int
public function getTimes(): int|null
{
return $this->settings->times ?? null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Settings/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function withData(): bool
return $this->settings->withData ?? true;
}

public function getWhere(): ?string
public function getWhere(): string|null
{
if (isset($this->settings->where)) {
return " WHERE {$this->settings->where}";
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/FakerRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
$fakeRule,
$fakeConnection,
[],
""
''
);
});
6 changes: 3 additions & 3 deletions tests/Rules/PhpRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use Worksome\Foggy\Settings\Rule;

it('can evaluate php string', function () {
$value = "column value";
$value = 'column value';
$phpString = '"appended " . $value';
$generatedValue = "appended column value";
$generatedValue = 'appended column value';

$fakerRule = new PhpRule();

Expand All @@ -31,7 +31,7 @@
});

it('can cast null to SQL NULL', function () {
$value = "column value";
$value = 'column value';
$phpString = 'null';

$fakerRule = new PhpRule();
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/ReplaceRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
$fakeRule,
$fakeConnection,
[],
""
''
);
});

0 comments on commit 034d030

Please sign in to comment.