Skip to content

Commit

Permalink
pint & strict types 🔧
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-rubel committed Jul 27, 2023
1 parent c601df5 commit 796a489
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 12 deletions.
2 changes: 2 additions & 0 deletions config/formatters.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [

/*
Expand Down
1 change: 1 addition & 0 deletions pint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"preset": "laravel",
"rules": {
"phpdoc_separation": false,
"declare_strict_types": true,
"concat_space": {
"spacing": "one"
},
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/DateFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class DateFormatter implements Formatter
*/
public function __construct(
public string|null|CarbonInterface $date = null,
public string|null $timezone = null,
public string|null $date_format = 'Y-m-d',
public ?string $timezone = null,
public ?string $date_format = 'Y-m-d',
) {
if (empty($this->date)) {
$this->date = null;
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/DateTimeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class DateTimeFormatter implements Formatter
*/
public function __construct(
public string|null|CarbonInterface $datetime = null,
public string|null $timezone = null,
public string|null $datetime_format = 'Y-m-d H:i',
public ?string $timezone = null,
public ?string $datetime_format = 'Y-m-d H:i',
) {
if (empty($this->datetime)) {
$this->datetime = null;
Expand Down
2 changes: 2 additions & 0 deletions tests/DateFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use Carbon\Carbon;
Expand Down
2 changes: 2 additions & 0 deletions tests/DateTimeFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use Carbon\Carbon;
Expand Down
2 changes: 2 additions & 0 deletions tests/FormatterBindingsTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use Illuminate\Support\Facades\File;
Expand Down
6 changes: 4 additions & 2 deletions tests/FormatterConfigTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use Illuminate\Filesystem\Filesystem;
Expand All @@ -13,8 +15,8 @@ public function testConfigSettingsAndProviderFiles()
{
$mock = $this->partialMock(Filesystem::class, function (MockInterface $mock) {
$mock->shouldReceive('isDirectory')
->once()
->andReturnFalse();
->once()
->andReturnFalse();
});

app()->instance('files', $mock);
Expand Down
2 changes: 2 additions & 0 deletions tests/FullNameFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use MichaelRubel\Formatters\Collection\FullNameFormatter;
Expand Down
3 changes: 2 additions & 1 deletion tests/LocaleNumberFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use MichaelRubel\Formatters\Collection\LocaleNumberFormatter;
use MichaelRubel\Formatters\Collection\TaxNumberFormatter;

class LocaleNumberFormatterTest extends TestCase
{
Expand Down
2 changes: 2 additions & 0 deletions tests/MakeFormatterCommandTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use Illuminate\Support\Facades\File;
Expand Down
12 changes: 7 additions & 5 deletions tests/MaskStringFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use MichaelRubel\Formatters\Collection\MaskStringFormatter;
Expand Down Expand Up @@ -59,11 +61,11 @@ public function testCanExtendFormatterBinding()
$formatter->length = -5;
$formatter->encoding = 'KOI8-U';

$this->assertStringContainsString('[email protected]', $formatter->string);
$this->assertStringContainsString('%', $formatter->character);
$this->assertStringContainsString(5, $formatter->index);
$this->assertStringContainsString(-5, $formatter->length);
$this->assertStringContainsString('KOI8-U', $formatter->encoding);
$this->assertSame('[email protected]', $formatter->string);
$this->assertSame('%', $formatter->character);
$this->assertSame(5, $formatter->index);
$this->assertSame(-5, $formatter->length);
$this->assertSame('KOI8-U', $formatter->encoding);

return $formatter;
});
Expand Down
2 changes: 2 additions & 0 deletions tests/NameFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use MichaelRubel\Formatters\Collection\NameFormatter;
Expand Down
2 changes: 2 additions & 0 deletions tests/TableColumnFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use MichaelRubel\Formatters\Collection\TableColumnFormatter;
Expand Down
2 changes: 2 additions & 0 deletions tests/TaxNumberFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use MichaelRubel\Formatters\Collection\TaxNumberFormatter;
Expand Down
2 changes: 2 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MichaelRubel\Formatters\Tests;

use MichaelRubel\Formatters\FormatterServiceProvider;
Expand Down

0 comments on commit 796a489

Please sign in to comment.