Skip to content

Commit

Permalink
Code Style
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed May 3, 2020
1 parent 232bf46 commit 6718e40
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 11 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/code-style.yml
@@ -0,0 +1,29 @@
name: Code Style

on: [push]

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

steps:
- name: Checkout code
uses: actions/checkout@v2

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

- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v2.3.0
with:
commit_message: Fix styling
branch: ${{ steps.extract_branch.outputs.branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
@@ -1,4 +1,4 @@
name: tests
name: Tests

on:
push:
Expand All @@ -8,8 +8,8 @@ on:

jobs:
tests:

runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
composer.lock
vendor
.phpunit.result.cache
.php_cs.cache
44 changes: 44 additions & 0 deletions .php_cs.dist
@@ -0,0 +1,44 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap')
->notPath('storage')
->notPath('vendor')
->in(__DIR__)
->name('*.php')
->notName('*.blade.php');

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'not_operator_with_successor_space' => true,
'no_extra_blank_lines' => [
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'throw',
'use',
],
'no_unused_imports' => true,
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'ternary_operator_spaces' => true,
'single_blank_line_before_namespace' => true,

// PSR-12
'blank_line_after_opening_tag' => true,
'braces' => ['allow_single_line_closure' => true],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'function_typehint_space' => true,
'new_with_braces' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_whitespace_in_blank_line' => true,
'return_type_declaration' => ['space_before' => 'none'],
'single_trait_insert_per_statement' => true,
])
->setFinder($finder);
16 changes: 12 additions & 4 deletions README.md
@@ -1,9 +1,17 @@
# Blade Icons

<a href="https://github.com/adamwathan/blade-svg/actions"><img src="https://github.com/adamwathan/blade-svg/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/nothingworks/blade-svg"><img src="https://poser.pugx.org/nothingworks/blade-svg/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/nothingworks/blade-svg"><img src="https://poser.pugx.org/nothingworks/blade-svg/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/nothingworks/blade-svg"><img src="https://poser.pugx.org/nothingworks/blade-svg/license.svg" alt="License"></a>
<a href="https://github.com/adamwathan/blade-svg/actions?query=workflow%3ATests">
<img src="https://github.com/adamwathan/blade-svg/workflows/Tests/badge.svg" alt="Tests">
</a>
<a href="https://github.com/adamwathan/blade-svg/actions?query=workflow%3A%22Code+Style%22">
<img src="https://github.com/adamwathan/blade-svg/workflows/Code%20Style/badge.svg" alt="Code Style">
</a>
<a href="https://packagist.org/packages/nothingworks/blade-svg">
<img src="https://poser.pugx.org/nothingworks/blade-svg/v/stable.svg" alt="Latest Stable Version">
</a>
<a href="https://packagist.org/packages/nothingworks/blade-svg">
<img src="https://poser.pugx.org/nothingworks/blade-svg/d/total.svg" alt="Total Downloads">
</a>

A package to easily make use of SVG icons in your Laravel Blade views.

Expand Down
12 changes: 9 additions & 3 deletions composer.json
Expand Up @@ -24,6 +24,7 @@
"illuminate/view": "^7.6"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"mockery/mockery": "^1.3",
"orchestra/testbench": "^5.0",
"phpunit/phpunit": "^8.0|^9.0"
Expand All @@ -41,16 +42,21 @@
"Tests\\": "tests"
}
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"BladeUI\\Icons\\BladeIconsServiceProvider"
]
}
},
"scripts": {
"format": [
"vendor/bin/php-cs-fixer fix"
]
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
2 changes: 1 addition & 1 deletion src/BladeIconsServiceProvider.php
Expand Up @@ -13,7 +13,7 @@ final class BladeIconsServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/blade-icons.php', 'blade-icons');
$this->mergeConfigFrom(__DIR__ . '/../config/blade-icons.php', 'blade-icons');

$this->registerFactory();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/FactoryTest.php
Expand Up @@ -6,8 +6,8 @@

use BladeUI\Icons\BladeIconsServiceProvider;
use BladeUI\Icons\Exceptions\SvgNotFound;
use BladeUI\Icons\Svg;
use BladeUI\Icons\Factory;
use BladeUI\Icons\Svg;
use Illuminate\Filesystem\Filesystem;
use Mockery;

Expand Down

0 comments on commit 6718e40

Please sign in to comment.