Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
kfriars authored and github-actions[bot] committed Jul 5, 2024
1 parent a04ef4b commit 205515f
Show file tree
Hide file tree
Showing 32 changed files with 69 additions and 62 deletions.
6 changes: 1 addition & 5 deletions src/Concerns/HasIdentifyingRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public function identifyingBelongsToMany(
/**
* Instantiate a new BelongsToMany relationship.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param string|class-string<\Illuminate\Database\Eloquent\Model> $table
* @param string $foreignPivotKey
* @param string $relatedPivotKey
Expand Down Expand Up @@ -124,7 +122,7 @@ protected function newIdentifyingBelongsToMany(
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/
public function identifyingMorphedByMany($related, $name, $table = null, $foreignPivotKey = null,
$relatedPivotKey = null, $parentKey = null, $relatedKey = null, $relation = null)
$relatedPivotKey = null, $parentKey = null, $relatedKey = null, $relation = null)
{
$foreignPivotKey = $foreignPivotKey ?: $this->getForeignKey();

Expand Down Expand Up @@ -203,8 +201,6 @@ public function identifyingMorphToMany(
/**
* Instantiate a new MorphToMany relationship.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param string $name
* @param string $table
* @param string $foreignPivotKey
Expand Down
8 changes: 4 additions & 4 deletions src/Concerns/IdentifiedContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ protected static function identifyingRelationships(): Collection
}

return Collection::wrap(static::$identifyingRelationships)
->sort()
->values();
->sort()
->values();
}

protected static function nonIdentifyingAttributes(): Collection
{
return Collection::wrap(static::$nonIdentifyingAttributes ?? [])
->sort()
->values();
->sort()
->values();
}
}
4 changes: 2 additions & 2 deletions src/Concerns/IdentifiesContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function updateRelationshipHashes(string $relationship): void
public static function identifiesRelationships(): Collection
{
return Collection::wrap(static::$identifiesRelationships ?? [])
->sort()
->values();
->sort()
->values();
}
}
5 changes: 2 additions & 3 deletions src/Events/TableCopied.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ class TableCopied

public function __construct(
public string $table,
public (Version&Model) | null $version,
public (Version&Model)|null $version,
public ?string $model = null,
) {
}
) {}

public static function fromCreated(TableCreated $created): self
{
Expand Down
5 changes: 2 additions & 3 deletions src/Events/TableCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class TableCreated

public function __construct(
public string $table,
public (Version&Model) | null $version,
public (Version&Model)|null $version,
public ?string $model = null,
) {
}
) {}
}
4 changes: 1 addition & 3 deletions src/Exceptions/SnapshotsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Exception;

class SnapshotsException extends Exception
{
}
class SnapshotsException extends Exception {}
3 changes: 1 addition & 2 deletions src/Listeners/Copier.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class Copier
public function __construct(
protected ManagesVersions $versions,
protected ManagesCreatedTables $tables
) {
}
) {}

public function handle()
{
Expand Down
3 changes: 1 addition & 2 deletions src/Observers/VersionObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class VersionObserver
{
public function __construct(
protected ManagesVersions $versions
) {
}
) {}

public function creating(Version $version)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Repository/VersionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function clearActive(): void
/**
* {@inheritDoc}
*/
public function active(): (Version&Model) | null
public function active(): (Version&Model)|null
{
return $this->active;
}
Expand All @@ -67,7 +67,7 @@ public function withVersionActive(string|VersionNumber|Version $version, Closure
/**
* {@inheritDoc}
*/
public function latest(): (Version&Model) | null
public function latest(): (Version&Model)|null
{
return $this->model()
->query()
Expand All @@ -78,7 +78,7 @@ public function latest(): (Version&Model) | null
/**
* {@inheritDoc}
*/
public function find($key): (Version&Model) | null
public function find($key): (Version&Model)|null
{
return $this->model()
->query()
Expand All @@ -89,7 +89,7 @@ public function find($key): (Version&Model) | null
/**
* {@inheritDoc}
*/
public function byNumber(string $number): (Version&Model) | null
public function byNumber(string $number): (Version&Model)|null
{
return $this->model()
->query()
Expand Down
3 changes: 1 addition & 2 deletions src/ValueObjects/Revision.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public function __construct(
public Version $version,
public Model $content,
public bool $hidden,
) {
}
) {}

public static function fromHistory(History $history): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/ValueObjects/VersionNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public function __construct(
protected int $major,
protected int $minor,
protected int $patch
) {
}
) {}

public static function fromVersionString(string $number): self
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @property-read Collection<Like> $likes
* @property-read Collection<Seo> $seos
*/
class Post extends Model implements Trackable, Identifying, Versioned
class Post extends Model implements Identifying, Trackable, Versioned
{
use AsVersionedContent;
use HasFactory;
Expand Down
2 changes: 1 addition & 1 deletion tests/Models/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
class Tag extends Model implements Identifying
{
use HasFactory;
use InteractsWithVersionedContent;
use IdentifiesContent;
use InteractsWithVersionedContent;

protected $guarded = [];

Expand Down
3 changes: 2 additions & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

use function Pest\Laravel\travel;
use Plank\Snapshots\Contracts\ManagesVersions;
use Plank\Snapshots\Models\Version;
use Plank\Snapshots\Repository\VersionRepository;
use Plank\Snapshots\Tests\TestCase;
use Plank\Snapshots\ValueObjects\VersionNumber;

use function Pest\Laravel\travel;

uses(TestCase::class)->in(__DIR__);

function versions(): VersionRepository
Expand Down
3 changes: 2 additions & 1 deletion tests/Suites/Feature/History/HistoryTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

use Illuminate\Support\Facades\Auth;
use function Pest\Laravel\artisan;
use Plank\Snapshots\Enums\Operation;
use Plank\Snapshots\Events\TableCopied;
use Plank\Snapshots\Exceptions\CauserException;
Expand All @@ -14,6 +13,8 @@
use Plank\Snapshots\Tests\Models\Flag;
use Plank\Snapshots\Tests\Models\Image;

use function Pest\Laravel\artisan;

beforeEach(function () {
config()->set('snapshots.history.observer', HistoryObserver::class);
});
Expand Down
5 changes: 3 additions & 2 deletions tests/Suites/Feature/History/IdentityTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

use function Pest\Laravel\artisan;
use function Pest\Laravel\seed;
use Plank\Snapshots\Enums\Operation;
use Plank\Snapshots\Observers\HistoryObserver;
use Plank\Snapshots\Tests\Database\Seeders\Model\PostSeeder;
use Plank\Snapshots\Tests\Database\Seeders\Model\TagSeeder;
use Plank\Snapshots\Tests\Database\Seeders\Model\VideoSeeder;
use Plank\Snapshots\Tests\Models\Post;

use function Pest\Laravel\artisan;
use function Pest\Laravel\seed;

beforeEach(function () {
config()->set('snapshots.history.observer', HistoryObserver::class);
});
Expand Down
3 changes: 2 additions & 1 deletion tests/Suites/Feature/History/VisibilityTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

use Illuminate\Support\Facades\Event;
use function Pest\Laravel\artisan;
use Plank\Snapshots\Events\TableCopied;
use Plank\Snapshots\Listeners\LabelHistory;
use Plank\Snapshots\Observers\HistoryObserver;
use Plank\Snapshots\Tests\Models\Flag;
use Plank\Snapshots\ValueObjects\Revision;

use function Pest\Laravel\artisan;

beforeEach(function () {
config()->set('snapshots.history.observer', HistoryObserver::class);
config()->set('snapshots.history.labler', LabelHistory::class);
Expand Down
1 change: 1 addition & 0 deletions tests/Suites/Feature/InstallationTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Illuminate\Support\Facades\File;

use function Pest\Laravel\artisan;

describe('The install command properly installs the package.', function () {
Expand Down
3 changes: 2 additions & 1 deletion tests/Suites/Feature/Migrations/CopyTablesTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use function Pest\Laravel\artisan;
use Plank\Snapshots\Tests\Models\Document;

use function Pest\Laravel\artisan;

describe('The CopyTables listener correctly copies data', function () {
beforeEach(function () {
artisan('migrate', [
Expand Down
3 changes: 2 additions & 1 deletion tests/Suites/Feature/Migrations/CopyWithModelEventsTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use function Pest\Laravel\artisan;
use Plank\Snapshots\Tests\Models\Document;

use function Pest\Laravel\artisan;

describe('The Copier correctly copies data with Model Events', function () {
beforeEach(function () {
config()->set('snapshots.copier.model_events', true);
Expand Down
3 changes: 2 additions & 1 deletion tests/Suites/Feature/Migrations/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;
use Plank\Snapshots\Tests\Models\Item;

use function Pest\Laravel\artisan;
use function Pest\Laravel\assertDatabaseHas;
use function Pest\Laravel\assertDatabaseMissing;
use function Pest\Laravel\withoutMockingConsoleOutput;
use Plank\Snapshots\Tests\Models\Item;

describe('SnapshotMigrations use versions to run up and down', function () {
beforeEach(function () {
Expand Down
5 changes: 3 additions & 2 deletions tests/Suites/Feature/Migrations/PretendTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

use Doctrine\DBAL\Schema\SchemaException;
use function Pest\Laravel\artisan;
use function Pest\Laravel\assertDatabaseHas;
use Plank\Snapshots\Contracts\ManagesCreatedTables;
use Plank\Snapshots\Contracts\ManagesVersions;
use Plank\Snapshots\Contracts\Version;
use Plank\Snapshots\Migrator\SnapshotMigrator;
use Plank\Snapshots\Models\Version as VersionModel;

use function Pest\Laravel\artisan;
use function Pest\Laravel\assertDatabaseHas;

describe('SnapshotMigrations can be pretended', function () {
beforeEach(function () {
artisan('migrate', [
Expand Down
7 changes: 4 additions & 3 deletions tests/Suites/Feature/Migrations/SchemaBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use function Pest\Laravel\artisan;
use function Pest\Laravel\assertDatabaseHas;
use function Pest\Laravel\partialMock;
use Plank\Snapshots\Exceptions\MigrationFailedException;
use Plank\Snapshots\Facades\SnapshotSchema;
use Plank\Snapshots\Tests\Models\Document;

use function Pest\Laravel\artisan;
use function Pest\Laravel\assertDatabaseHas;
use function Pest\Laravel\partialMock;

describe('SnapshotMigrations use versions to run `up`', function () {
beforeEach(function () {
artisan('migrate', [
Expand Down
5 changes: 3 additions & 2 deletions tests/Suites/Feature/ModelQueriesTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

use function Pest\Laravel\artisan;
use function Pest\Laravel\seed;
use Plank\Snapshots\Tests\Database\Seeders\Model\PostSeeder;
use Plank\Snapshots\Tests\Models\Post;

use function Pest\Laravel\artisan;
use function Pest\Laravel\seed;

describe('Versioned models use the version prefixed table when interacting with the database', function () {
beforeEach(function () {
artisan('migrate', [
Expand Down
5 changes: 3 additions & 2 deletions tests/Suites/Feature/Relations/BelongsToManyTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

use function Pest\Laravel\artisan;
use function Pest\Laravel\seed;
use Plank\Snapshots\Tests\Database\Seeders\Model\PostSeeder;
use Plank\Snapshots\Tests\Models\Post;

use function Pest\Laravel\artisan;
use function Pest\Laravel\seed;

describe('BelongsToMany relationships use versioned tables when one of the models is versioned', function () {
beforeEach(function () {
artisan('migrate', [
Expand Down
5 changes: 3 additions & 2 deletions tests/Suites/Feature/Relations/BelongsToTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

use function Pest\Laravel\artisan;
use function Pest\Laravel\seed;
use Plank\Snapshots\Tests\Database\Seeders\Model\PostSeeder;
use Plank\Snapshots\Tests\Models\Like;
use Plank\Snapshots\Tests\Models\Post;
use Plank\Snapshots\Tests\Models\Seo;
use Plank\Snapshots\Tests\Models\User;

use function Pest\Laravel\artisan;
use function Pest\Laravel\seed;

describe('BelongsTo relationships use versioned tables when one of the models is versioned', function () {
beforeEach(function () {
artisan('migrate', [
Expand Down
3 changes: 2 additions & 1 deletion tests/Suites/Feature/Relations/HasManyTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

use function Pest\Laravel\artisan;
use Plank\Snapshots\Tests\Models\Post;
use Plank\Snapshots\Tests\Models\User;

use function Pest\Laravel\artisan;

describe('HasMany relationships use versioned tables correctly', function () {
beforeEach(function () {
artisan('migrate', [
Expand Down
3 changes: 2 additions & 1 deletion tests/Suites/Feature/Relations/HasOneTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

use function Pest\Laravel\artisan;
use Plank\Snapshots\Tests\Models\Post;
use Plank\Snapshots\Tests\Models\User;

use function Pest\Laravel\artisan;

describe('HasMany relationships use versioned tables correctly', function () {
beforeEach(function () {
artisan('migrate', [
Expand Down
Loading

0 comments on commit 205515f

Please sign in to comment.