Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@


name: Check & fix styling

on: [push]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs.dist.php --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
composer.lock
vendor
.phpunit.result.cache
.php_cs.cache
.php-cs-fixer.cache
142 changes: 0 additions & 142 deletions .php_cs.dist

This file was deleted.

35 changes: 35 additions & 0 deletions .php_cs.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'single_trait_insert_per_statement' => true,
])
->setFinder($finder);
2 changes: 1 addition & 1 deletion src/Entries/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Entry extends FileEntry

public static function fromModel(Model $model)
{
return (new static)
return (new static())
->locale($model->site)
->slug($model->slug)
->date($model->date)
Expand Down
2 changes: 1 addition & 1 deletion src/Entries/EntryQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class EntryQueryBuilder extends EloquentQueryBuilder implements QueryBuilder
{
use QueriesTaxonomizedEntries;

const COLUMNS = [
public const COLUMNS = [
'id', 'site', 'origin_id', 'published', 'status', 'slug', 'uri',
'date', 'collection', 'created_at', 'updated_at',
];
Expand Down
1 change: 0 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Statamic\Contracts\Entries\EntryRepository as EntryRepositoryContract;
use Statamic\Eloquent\Commands\ImportEntries;
use Statamic\Eloquent\Entries\CollectionRepository;
use Statamic\Eloquent\Entries\EntryModel;
use Statamic\Eloquent\Entries\EntryQueryBuilder;
use Statamic\Eloquent\Entries\EntryRepository;
use Statamic\Providers\AddonServiceProvider;
Expand Down
4 changes: 2 additions & 2 deletions tests/Entries/EntryModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function it_gets_attributes_from_json_column()
$model = new EntryModel([
'slug' => 'the-slug',
'data' => [
'foo' => 'bar'
]
'foo' => 'bar',
],
]);

$this->assertEquals('the-slug', $model->slug);
Expand Down