Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bastien-phi committed Apr 19, 2024
1 parent e6e80e5 commit df64ea0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions tests/Fixtures/NoMutableDateTimeStaticCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@

namespace Soyhuce\PhpstanExtension\Tests\Fixtures;

use function is_object;

class NoMutableDateTimeStaticCall
{
public function run(): bool
public function run(): void
{
$start = \DateTime::createFromFormat('Y-m-d', '2021-01-01');
$end = \Carbon\Carbon::createFromFormat('Y-m-d', '2021-01-01');

return is_object($start) && is_object($end) && $end->isAfter($start);
var_dump($start, $end);
}

public function runImmutable(): bool
public function runImmutable(): void
{
$start = \DateTimeImmutable::createFromFormat('Y-m-d', '2021-01-01');
$end = \Carbon\CarbonImmutable::createFromFormat('Y-m-d', '2021-01-01');

return is_object($start) && is_object($end) && $end->isAfter($start);
var_dump($start, $end);
}
}
4 changes: 2 additions & 2 deletions tests/Rules/NoMutableDateTimeStaticCallRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function dateTimeStaticCallCannotBeUsed(): void
$errors = $this->findErrorsByLine(__DIR__ . '/../Fixtures/NoMutableDateTimeStaticCall.php');

$this->assertEquals([
11 => 'Static calls of mutable DateTime is forbidden, currently using DateTime.',
12 => 'Static calls of mutable DateTime is forbidden, currently using Carbon\Carbon.',
9 => 'Static calls of mutable DateTime is forbidden, currently using DateTime.',
10 => 'Static calls of mutable DateTime is forbidden, currently using Carbon\Carbon.',
], $errors);
}
}

0 comments on commit df64ea0

Please sign in to comment.