Skip to content

Commit

Permalink
Merge pull request #2 from SocolaDaiCa/feat/support-laravel-8-9-10
Browse files Browse the repository at this point in the history
feat: support laravel 9 10
  • Loading branch information
SocolaDaiCa authored Feb 8, 2023
2 parents 384edca + 562a65d commit c234520
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs.dist --allow-risky=yes
args: --config=.php-cs-fixer.dist.php --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [7.4]
php: [7.4, '8.0', 8.1, 8.2]
stability: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"8.1.14","version":"3.14.3","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["method","property"]},"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"alpha"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":{"after_heredoc":true,"elements":["arrays","parameters"]},"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,"class_attributes_separation":{"elements":{"const":"one","method":"one","property":"one","trait_import":"one","case":"none"}},"single_trait_insert_per_statement":true},"hashes":{"src\/HasTablePrefix.php":"e0100941b714da1d335d4cd307fd6deb","tests\/SimpleTest.php":"9d50546e784e6d136705316216e79c8d","tests\/Models\/Category.php":"8ac5fd47f0a4e33f97d29413e98c7702","tests\/Models\/Prefix.php":"38b2af1925b788b6ce9082c0121cc2dd","tests\/Models\/Post.php":"fb68189fff9480c73636c72adca8e5f9","tests\/Models\/CategoryPost.php":"2bb2da32f8657b90d0ed4f45cc27d7af","tests\/ExampleTest.php":"eaff326f6cdabfd706b4d60851c5efda"}}
63 changes: 63 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

use PhpCsFixer\Config;

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

return (new Config())
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => [
'imports_order' => [
\PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CLASS,
\PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_FUNCTION,
\PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CONST,
],
'sort_algorithm' => \PhpCsFixer\Fixer\Import\OrderedImportsFixer::SORT_ALPHA,
],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => [
\PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer::ELEMENTS_ARRAYS,
// \PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer::ELEMENTS_ARGUMENTS, apply late has issue
...(version_compare(phpversion(), '8.0+', '>=') ? [
\PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer::ELEMENTS_PARAMETERS,
] : []),
// 'match',
],
],
'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,
'class_attributes_separation' => [
'elements' => [
'const' => 'one',
'method' => 'one',
'property' => 'one',
'trait_import' => 'one',
'case' => 'none',
],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'single_trait_insert_per_statement' => true,
])
->setFinder($finder);
40 changes: 0 additions & 40 deletions .php_cs.dist

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"require": {
"php": "^7.4|^8.0",
"laravel/framework": "^5.0|^6.0|^7.0|^8.0"
"laravel/framework": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
Expand Down
1 change: 1 addition & 0 deletions tests/Models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
class Category extends Model
{
use Prefix;

protected $table = 'categories';
}
1 change: 1 addition & 0 deletions tests/Models/CategoryPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
class CategoryPost extends Pivot
{
use Prefix;

protected $table = 'category_post';
}
1 change: 1 addition & 0 deletions tests/Models/Prefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
trait Prefix
{
use HasTablePrefix;

public string $prefix = 'socola_cms_blog__';
}

0 comments on commit c234520

Please sign in to comment.