Update some code with rector.

This commit is contained in:
James Cole
2025-05-29 15:22:55 +02:00
parent 5be6bb755d
commit adba360466
14 changed files with 27 additions and 26 deletions

View File

@@ -34,16 +34,17 @@ return RectorConfig::configure()
ChangeOrIfContinueToMultiContinueRector::class, ChangeOrIfContinueToMultiContinueRector::class,
StringToClassConstantRector::class => [ StringToClassConstantRector::class => [
__DIR__ . '/../app/Http/Controllers/Auth/LoginController.php', __DIR__ . '/../app/Http/Controllers/Auth/LoginController.php',
] ],
__DIR__.'/../bootstrap/cache/*'
]) ])
->withPaths([ ->withPaths([
__DIR__ . '/../app', __DIR__ . '/../app',
// __DIR__ . '/../bootstrap', __DIR__ . '/../bootstrap',
// __DIR__ . '/../config', __DIR__ . '/../config',
// __DIR__ . '/../public', __DIR__ . '/../public',
// __DIR__ . '/../resources/lang/en_US', __DIR__ . '/../resources/lang/en_US',
// __DIR__ . '/../routes', __DIR__ . '/../routes',
// __DIR__ . '/../tests', __DIR__ . '/../tests',
]) ])
->withSets([ ->withSets([
LaravelLevelSetList::UP_TO_LARAVEL_120, LaravelLevelSetList::UP_TO_LARAVEL_120,

View File

@@ -56,7 +56,7 @@ final class BillDateCalculatorTest extends TestCase
public function testGivenSomeDataItWorks(Carbon $earliest, Carbon $latest, Carbon $billStart, string $period, int $skip, ?Carbon $lastPaid, array $expected): void public function testGivenSomeDataItWorks(Carbon $earliest, Carbon $latest, Carbon $billStart, string $period, int $skip, ?Carbon $lastPaid, array $expected): void
{ {
$result = $this->calculator->getPayDates($earliest, $latest, $billStart, $period, $skip, $lastPaid); $result = $this->calculator->getPayDates($earliest, $latest, $billStart, $period, $skip, $lastPaid);
self::assertSame($expected, $result); $this->assertSame($expected, $result);
} }
public static function provideDates(): Iterator public static function provideDates(): Iterator

View File

@@ -45,6 +45,6 @@ final class NavigationCustomEndOfPeriodTest extends TestCase
$navigation = new Navigation(); $navigation = new Navigation();
$period = $navigation->endOfPeriod($from, 'custom'); $period = $navigation->endOfPeriod($from, 'custom');
self::assertSame($expected->toDateString(), $period->toDateString()); $this->assertSame($expected->toDateString(), $period->toDateString());
} }
} }

View File

@@ -73,7 +73,7 @@ final class CalculatorTest extends TestCase
{ {
$calculator = new Calculator(); $calculator = new Calculator();
$period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity); $period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity);
self::assertSame($provider->expected()->toDateString(), $period->toDateString()); $this->assertSame($provider->expected()->toDateString(), $period->toDateString());
} }
public static function provideAllPeriodicity(): iterable public static function provideAllPeriodicity(): iterable
@@ -102,7 +102,7 @@ final class CalculatorTest extends TestCase
{ {
$calculator = new Calculator(); $calculator = new Calculator();
$period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity, $provider->skip); $period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity, $provider->skip);
self::assertSame($provider->expected()->toDateString(), $period->toDateString()); $this->assertSame($provider->expected()->toDateString(), $period->toDateString());
} }
public static function provideSkippedIntervals(): iterable public static function provideSkippedIntervals(): iterable

View File

@@ -36,7 +36,7 @@ abstract class IntervalTestCase extends TestCase
public function testGivenAnEpochWhenCallTheNextDateThenReturnsTheExpectedDateSuccessful(IntervalProvider $provider): void public function testGivenAnEpochWhenCallTheNextDateThenReturnsTheExpectedDateSuccessful(IntervalProvider $provider): void
{ {
$period = static::factory()->nextDate($provider->epoch); $period = static::factory()->nextDate($provider->epoch);
self::assertSame($provider->expected->toDateString(), $period->toDateString()); $this->assertSame($provider->expected->toDateString(), $period->toDateString());
} }
public static function provider(): iterable public static function provider(): iterable

View File

@@ -56,7 +56,7 @@ final class NavigationAddPeriodTest extends TestCase
public function testGivenAFrequencyAndSkipIntervalWhenCalculateTheDateThenReturnsTheSkippedDateSuccessful(int $skip, string $frequency, Carbon $from, Carbon $expected): void public function testGivenAFrequencyAndSkipIntervalWhenCalculateTheDateThenReturnsTheSkippedDateSuccessful(int $skip, string $frequency, Carbon $from, Carbon $expected): void
{ {
$period = $this->navigation->addPeriod($from, $frequency, $skip); $period = $this->navigation->addPeriod($from, $frequency, $skip);
self::assertSame($expected->toDateString(), $period->toDateString()); $this->assertSame($expected->toDateString(), $period->toDateString());
} }
public static function providePeriodsWithSkippingParam(): iterable public static function providePeriodsWithSkippingParam(): iterable
@@ -108,7 +108,7 @@ final class NavigationAddPeriodTest extends TestCase
public function testGivenAFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void public function testGivenAFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void
{ {
$period = $this->navigation->addPeriod($from, $frequency, 0); $period = $this->navigation->addPeriod($from, $frequency, 0);
self::assertSame($expected->toDateString(), $period->toDateString()); $this->assertSame($expected->toDateString(), $period->toDateString());
} }
public static function providePeriods(): Iterator public static function providePeriods(): Iterator
@@ -158,7 +158,7 @@ final class NavigationAddPeriodTest extends TestCase
public function testGivenAIntervalWhenCallTheNextDateByIntervalMethodThenReturnsTheExpectedDateSuccessful(Periodicity $periodicity, Carbon $from, Carbon $expected): void public function testGivenAIntervalWhenCallTheNextDateByIntervalMethodThenReturnsTheExpectedDateSuccessful(Periodicity $periodicity, Carbon $from, Carbon $expected): void
{ {
$period = $this->navigation->nextDateByInterval($from, $periodicity); $period = $this->navigation->nextDateByInterval($from, $periodicity);
self::assertSame($expected->toDateString(), $period->toDateString()); $this->assertSame($expected->toDateString(), $period->toDateString());
} }
public static function provideFrequencies(): Iterator public static function provideFrequencies(): Iterator
@@ -212,7 +212,7 @@ final class NavigationAddPeriodTest extends TestCase
public function testGivenAMonthFrequencyWhenCalculateTheDateThenReturnsTheLastDayOfMonthSuccessful(string $frequency, Carbon $from, Carbon $expected): void public function testGivenAMonthFrequencyWhenCalculateTheDateThenReturnsTheLastDayOfMonthSuccessful(string $frequency, Carbon $from, Carbon $expected): void
{ {
$period = $this->navigation->addPeriod($from, $frequency, 0); $period = $this->navigation->addPeriod($from, $frequency, 0);
self::assertSame($expected->toDateString(), $period->toDateString()); $this->assertSame($expected->toDateString(), $period->toDateString());
} }
public static function provideMonthPeriods(): Iterator public static function provideMonthPeriods(): Iterator

View File

@@ -55,7 +55,7 @@ final class NavigationEndOfPeriodTest extends TestCase
public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void
{ {
$period = clone $this->navigation->endOfPeriod($from, $frequency); $period = clone $this->navigation->endOfPeriod($from, $frequency);
self::assertSame($expected->toDateString(), $period->toDateString()); $this->assertSame($expected->toDateString(), $period->toDateString());
} }
public static function provideDates(): Iterator public static function provideDates(): Iterator
@@ -116,7 +116,7 @@ final class NavigationEndOfPeriodTest extends TestCase
Log::spy(); Log::spy();
$period = $this->navigation->endOfPeriod($from, $frequency); $period = $this->navigation->endOfPeriod($from, $frequency);
self::assertSame($expected->toDateString(), $period->toDateString()); $this->assertSame($expected->toDateString(), $period->toDateString());
$expectedMessage = sprintf('Cannot do endOfPeriod for $repeat_freq "%s"', $frequency); $expectedMessage = sprintf('Cannot do endOfPeriod for $repeat_freq "%s"', $frequency);
Log::shouldHaveReceived('error', [$expectedMessage]); Log::shouldHaveReceived('error', [$expectedMessage]);

View File

@@ -54,7 +54,7 @@ final class NavigationPreferredCarbonFormatByPeriodTest extends TestCase
public function testGivenAPeriodWhenCallPreferredCarbonFormatByPeriodThenReturnsExpectedFormat(string $period, string $expected): void public function testGivenAPeriodWhenCallPreferredCarbonFormatByPeriodThenReturnsExpectedFormat(string $period, string $expected): void
{ {
$formatPeriod = $this->navigation->preferredCarbonFormatByPeriod($period); $formatPeriod = $this->navigation->preferredCarbonFormatByPeriod($period);
self::assertSame($expected, $formatPeriod); $this->assertSame($expected, $formatPeriod);
} }
public static function providePeriods(): Iterator public static function providePeriods(): Iterator

View File

@@ -55,7 +55,7 @@ final class NavigationPreferredCarbonFormatTest extends TestCase
public function testGivenStartAndEndDatesWhenCallPreferredCarbonFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void public function testGivenStartAndEndDatesWhenCallPreferredCarbonFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void
{ {
$carbonFormat = $this->navigation->preferredCarbonFormat($start, $end); $carbonFormat = $this->navigation->preferredCarbonFormat($start, $end);
self::assertSame($expected, $carbonFormat); $this->assertSame($expected, $carbonFormat);
} }
public static function providePeriods(): Iterator public static function providePeriods(): Iterator

View File

@@ -55,7 +55,7 @@ final class NavigationPreferredEndOfPeriodTest extends TestCase
public function testGivenStartAndEndDatesWhenCallPreferredEndOfPeriodThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void public function testGivenStartAndEndDatesWhenCallPreferredEndOfPeriodThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void
{ {
$formatPeriod = $this->navigation->preferredEndOfPeriod($start, $end); $formatPeriod = $this->navigation->preferredEndOfPeriod($start, $end);
self::assertSame($expected, $formatPeriod); $this->assertSame($expected, $formatPeriod);
} }
public static function providePeriods(): Iterator public static function providePeriods(): Iterator

View File

@@ -55,7 +55,7 @@ final class NavigationPreferredRangeFormatTest extends TestCase
public function testGivenStartAndEndDatesWhenCallPreferredRangeFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void public function testGivenStartAndEndDatesWhenCallPreferredRangeFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void
{ {
$formatPeriod = $this->navigation->preferredRangeFormat($start, $end); $formatPeriod = $this->navigation->preferredRangeFormat($start, $end);
self::assertSame($expected, $formatPeriod); $this->assertSame($expected, $formatPeriod);
} }
public static function providePeriods(): Iterator public static function providePeriods(): Iterator

View File

@@ -55,7 +55,7 @@ final class NavigationPreferredSqlFormatTest extends TestCase
public function testGivenStartAndEndDatesWhenCallPreferredSqlFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void public function testGivenStartAndEndDatesWhenCallPreferredSqlFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void
{ {
$formatPeriod = $this->navigation->preferredSqlFormat($start, $end); $formatPeriod = $this->navigation->preferredSqlFormat($start, $end);
self::assertSame($expected, $formatPeriod); $this->assertSame($expected, $formatPeriod);
} }
public static function provideDates(): Iterator public static function provideDates(): Iterator

View File

@@ -56,7 +56,7 @@ final class NavigationStartOfPeriodTest extends TestCase
public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void
{ {
$period = $this->navigation->startOfPeriod($from, $frequency); $period = $this->navigation->startOfPeriod($from, $frequency);
self::assertSame($expected->toDateString(), $period->toDateString()); $this->assertSame($expected->toDateString(), $period->toDateString());
} }
public static function provideDates(): Iterator public static function provideDates(): Iterator
@@ -121,7 +121,7 @@ final class NavigationStartOfPeriodTest extends TestCase
; ;
$period = $this->navigation->startOfPeriod($from, $frequency); $period = $this->navigation->startOfPeriod($from, $frequency);
self::assertSame($expected->toDateString(), $period->toDateString()); $this->assertSame($expected->toDateString(), $period->toDateString());
} }
public static function provideUnknownFrequencies(): Iterator public static function provideUnknownFrequencies(): Iterator

View File

@@ -26,7 +26,7 @@ abstract class AbstractQueryParserInterfaceParseQueryTester extends TestCase
{ {
$actual = $this->createParser()->parse($query); $actual = $this->createParser()->parse($query);
self::assertObjectEquals($expected, $actual); $this->assertObjectEquals($expected, $actual);
} }