Skip to content

Commit ab9e0fe

Browse files
committed
Update boilerplate + PHP 8/Laravel 9 tests
1 parent 8eca350 commit ab9e0fe

7 files changed

+223
-166
lines changed

.codeclimate.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
exclude_patterns:
2+
- ".github/"
3+
- ".idea/"
4+
- "stubs/"
5+
- "tests/"
6+
- "**/vendor/"
7+
- "**/node_modules/"
8+
- "*.md"
9+
- ".*.yml"
10+
- "LICENSE"
11+
- "composer.json"
12+
- "phpunit.xml"

.github/workflows/phpunit.yml

+12-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
pull_request:
66
schedule:
7-
- cron: '0 0 * * *'
7+
- cron: '0 14 * * 3' # Run Wednesdays at 2pm EST
88

99
jobs:
1010
php-tests:
@@ -13,13 +13,14 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php: [ 7.4, 8.0 ]
17-
laravel: [ ^8.12 ]
18-
dependency-version: [ lowest, stable ]
19-
include:
20-
- laravel: ^8.12
21-
testbench: ^6.0
22-
minimum-stability: stable
16+
php: [ 7.4, 8.0, 8.1 ]
17+
laravel: [ ^8.12, ^9.0 ]
18+
dependency-version: [ stable, lowest ]
19+
exclude:
20+
- php: 7.4
21+
laravel: ^9.0
22+
- laravel: ^9.0
23+
dependency-version: lowest
2324

2425
name: "${{ matrix.php }} / ${{ matrix.laravel }} (${{ matrix.dependency-version }})"
2526

@@ -32,7 +33,7 @@ jobs:
3233
with:
3334
php-version: ${{ matrix.php }}
3435
extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, intl, iconv
35-
coverage: none
36+
tools: composer:v2
3637

3738
- name: Register composer cache directory
3839
id: composer-cache-files-dir
@@ -44,7 +45,7 @@ jobs:
4445
path: |
4546
vendor
4647
${{ steps.composer-cache-files-dir.outputs.dir }}
47-
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}-${{ matrix.dependency-version }}
48+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
4849
restore-keys: |
4950
${{ runner.os }}-composer-
5051
@@ -54,7 +55,7 @@ jobs:
5455
- name: Install dependencies
5556
env:
5657
COMPOSER_DISCARD_CHANGES: true
57-
run: composer require --no-progress --no-interaction --prefer-dist --update-with-all-dependencies "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}"
58+
run: composer require --no-suggest --no-progress --no-interaction --prefer-dist --update-with-all-dependencies "laravel/framework:${{ matrix.laravel }}"
5859

5960
- name: Set dependency version
6061
env:
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Update Changelog
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
update-publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
repository: ${{ github.event.repository.full_name }}
14+
ref: 'main'
15+
16+
- name: Update changelog
17+
uses: thomaseizinger/keep-a-changelog-new-release@v1
18+
with:
19+
version: ${{ github.event.release.tag_name }}
20+
21+
- name: Commit changelog back to repo
22+
uses: EndBug/add-and-commit@v8
23+
with:
24+
add: 'CHANGELOG.md'
25+
message: ${{ github.event.release.tag_name }}
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.php-cs-fixer.dist.php

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?php
2+
3+
require_once __DIR__.'/vendor/autoload.php';
4+
5+
return (new PhpCsFixer\Config())
6+
->setRiskyAllowed(true)
7+
->setIndent("\t")
8+
->setLineEnding("\n")
9+
->setRules([
10+
'@PSR2' => true,
11+
'function_declaration' => [
12+
'closure_function_spacing' => 'none',
13+
],
14+
'ordered_imports' => [
15+
'sort_algorithm' => 'alpha',
16+
],
17+
'array_indentation' => true,
18+
'braces' => [
19+
'allow_single_line_closure' => true,
20+
],
21+
'no_break_comment' => false,
22+
'return_type_declaration' => [
23+
'space_before' => 'none',
24+
],
25+
'blank_line_after_opening_tag' => true,
26+
'compact_nullable_typehint' => true,
27+
'cast_spaces' => true,
28+
'concat_space' => [
29+
'spacing' => 'none',
30+
],
31+
'declare_equal_normalize' => [
32+
'space' => 'none',
33+
],
34+
'function_typehint_space' => true,
35+
'new_with_braces' => true,
36+
'method_argument_space' => true,
37+
'no_empty_statement' => true,
38+
'no_empty_comment' => true,
39+
'no_empty_phpdoc' => true,
40+
'no_extra_blank_lines' => [
41+
'tokens' => [
42+
'extra',
43+
'use',
44+
'use_trait',
45+
'return',
46+
],
47+
],
48+
'no_leading_import_slash' => true,
49+
'no_leading_namespace_whitespace' => true,
50+
'no_blank_lines_after_class_opening' => true,
51+
'no_blank_lines_after_phpdoc' => true,
52+
'no_whitespace_in_blank_line' => false,
53+
'no_whitespace_before_comma_in_array' => true,
54+
'no_useless_else' => true,
55+
'no_useless_return' => true,
56+
'single_trait_insert_per_statement' => true,
57+
'psr_autoloading' => true,
58+
'dir_constant' => true,
59+
'single_line_comment_style' => [
60+
'comment_types' => ['hash'],
61+
],
62+
'include' => true,
63+
'is_null' => true,
64+
'linebreak_after_opening_tag' => true,
65+
'lowercase_cast' => true,
66+
'lowercase_static_reference' => true,
67+
'magic_constant_casing' => true,
68+
'magic_method_casing' => true,
69+
'class_attributes_separation' => [
70+
// TODO: This can be reverted when https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/5869 is merged
71+
'elements' => ['const' => 'one', 'method' => 'one', 'property' => 'one'],
72+
],
73+
'modernize_types_casting' => true,
74+
'native_function_casing' => true,
75+
'native_function_type_declaration_casing' => true,
76+
'no_alias_functions' => true,
77+
'no_multiline_whitespace_around_double_arrow' => true,
78+
'multiline_whitespace_before_semicolons' => true,
79+
'no_short_bool_cast' => true,
80+
'no_unused_imports' => true,
81+
'no_php4_constructor' => true,
82+
'no_singleline_whitespace_before_semicolons' => true,
83+
'no_spaces_around_offset' => true,
84+
'no_trailing_comma_in_list_call' => true,
85+
'no_trailing_comma_in_singleline_array' => true,
86+
'normalize_index_brace' => true,
87+
'object_operator_without_whitespace' => true,
88+
'phpdoc_annotation_without_dot' => true,
89+
'phpdoc_indent' => true,
90+
'phpdoc_no_package' => true,
91+
'phpdoc_no_access' => true,
92+
'phpdoc_no_useless_inheritdoc' => true,
93+
'phpdoc_single_line_var_spacing' => true,
94+
'phpdoc_trim' => true,
95+
'phpdoc_types' => true,
96+
'semicolon_after_instruction' => true,
97+
'array_syntax' => [
98+
'syntax' => 'short',
99+
],
100+
'list_syntax' => [
101+
'syntax' => 'short',
102+
],
103+
'short_scalar_cast' => true,
104+
'single_blank_line_before_namespace' => true,
105+
'single_quote' => true,
106+
'standardize_not_equals' => true,
107+
'ternary_operator_spaces' => true,
108+
'whitespace_after_comma_in_array' => true,
109+
'not_operator_with_successor_space' => true,
110+
'trailing_comma_in_multiline' => true,
111+
'trim_array_spaces' => true,
112+
'binary_operator_spaces' => true,
113+
'unary_operator_spaces' => true,
114+
'php_unit_method_casing' => [
115+
'case' => 'snake_case',
116+
],
117+
'php_unit_test_annotation' => [
118+
'style' => 'prefix',
119+
],
120+
])
121+
->setFinder(
122+
PhpCsFixer\Finder::create()
123+
->exclude('.circleci')
124+
->exclude('bin')
125+
->exclude('node_modules')
126+
->exclude('vendor')
127+
->notPath('.phpstorm.meta.php')
128+
->notPath('_ide_helper.php')
129+
->notPath('artisan')
130+
->in(__DIR__)
131+
);

.php-cs-fixer.php

-120
This file was deleted.

composer.json

+14-8
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@
2222
],
2323
"require": {
2424
"php": "^7.4|^8.0",
25-
"illuminate/contracts": "^v7.0|^v8.0",
26-
"illuminate/support": "^v7.0|^v8.0",
27-
"illuminate/http": "^v7.0|^v8.0",
28-
"illuminate/routing": "^v7.0|^v8.0",
29-
"illuminate/validation": "^v7.0|^v8.0",
25+
"illuminate/contracts": "^v7.0|^v8.0|^9.0|dev-master",
26+
"illuminate/support": "^v7.0|^v8.0|^9.0|dev-master",
27+
"illuminate/http": "^v7.0|^v8.0|^9.0|dev-master",
28+
"illuminate/routing": "^v7.0|^v8.0|^9.0|dev-master",
29+
"illuminate/validation": "^v7.0|^v8.0|^9.0|dev-master",
3030
"commerceguys/addressing": "^v1.2",
3131
"symfony/intl": "^v4.2|^v5.0|^v6.0",
3232
"commerceguys/intl": "^v1.1",
3333
"doctrine/collections": "^1.6.2"
3434
},
3535
"require-dev": {
3636
"ext-json": "*",
37-
"phpunit/phpunit": "^7.0|^8.0",
38-
"orchestra/testbench": "^5.0|^6.0",
37+
"phpunit/phpunit": "^7.0|^8.0|^9.5",
38+
"orchestra/testbench": "^5.0|^6.0|^7.0",
3939
"friendsofphp/php-cs-fixer": "^3.0"
4040
},
4141
"autoload": {
@@ -51,6 +51,10 @@
5151
"Galahad\\LaravelAddressing\\Tests\\": "tests/"
5252
}
5353
},
54+
"scripts": {
55+
"fix-style": "vendor/bin/php-cs-fixer fix",
56+
"check-style": "vendor/bin/php-cs-fixer fix --diff --dry-run"
57+
},
5458
"license": "MIT",
5559
"extra": {
5660
"laravel": {
@@ -61,5 +65,7 @@
6165
"Addressing": "Galahad\\LaravelAddressing\\Support\\Facades\\Addressing"
6266
}
6367
}
64-
}
68+
},
69+
"minimum-stability": "dev",
70+
"prefer-stable": true
6571
}

0 commit comments

Comments
 (0)