Skip to content

Commit 74c3bbd

Browse files
authored
Merge pull request #148 from wintercms/wip/1.2
Support Laravel 9 / PHP 8.1
2 parents e764d0f + 6f12f8a commit 74c3bbd

File tree

1,009 files changed

+48718
-33140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,009 files changed

+48718
-33140
lines changed

.github/workflows/code-quality.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install PHP and PHP Code Sniffer
2727
uses: shivammathur/setup-php@v2
2828
with:
29-
php-version: 7.3
29+
php-version: 8.0
3030
extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip
3131
tools: phpcs
3232

.github/workflows/tests.yml

+15-7
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ jobs:
2424
node-version: 12
2525

2626
- name: Install Node dependencies
27-
working-directory: ./tests/js
27+
working-directory: ./modules/system/tests/js
2828
run: npm install
2929

3030
- name: Run tests
31-
working-directory: ./tests/js
31+
working-directory: ./modules/system/tests/js
3232
run: npm run test
33+
3334
phpUnitTests:
3435
strategy:
3536
max-parallel: 8
3637
matrix:
3738
operatingSystem: [ubuntu-latest, windows-latest]
38-
phpVersion: ['7.2', '7.3', '7.4', '8.0']
39+
phpVersion: ['8.0', '8.1']
3940
fail-fast: false
4041
runs-on: ${{ matrix.operatingSystem }}
4142
name: ${{ matrix.operatingSystem }} / PHP ${{ matrix.phpVersion }}
@@ -72,18 +73,25 @@ jobs:
7273
php-version: ${{ matrix.phpVersion }}
7374
extensions: ${{ env.extensions }}
7475

76+
- name: Echo branches
77+
run: echo "${{ github.ref }} | ${{ github.head_ref }} | ${{ github.ref_name }} | ${{ github.base_ref }}"
78+
7579
- name: Switch library dependency (develop)
7680
if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop'
7781
run: php ./.github/workflows/utilities/library-switcher "dev-develop as 1.1"
7882

7983
- name: Switch library dependency (1.0)
80-
if: github.ref == 'refs/heads/1.0' || github.base_ref == '1.0'
84+
if: github.head_ref == '1.0' || github.ref == 'refs/heads/1.0' || github.base_ref == '1.0'
8185
run: php ./.github/workflows/utilities/library-switcher "1.0.x-dev as 1.0"
8286

8387
- name: Switch library dependency (1.1)
84-
if: github.ref == 'refs/heads/1.1' || github.base_ref == '1.1'
88+
if: github.head_ref == '1.1' || github.ref == 'refs/heads/1.1' || github.base_ref == '1.1'
8589
run: php ./.github/workflows/utilities/library-switcher "1.1.x-dev as 1.1"
8690

91+
- name: Switch library dependency (1.2)
92+
if: github.head_ref == 'wip/1.2' || github.ref == 'refs/heads/wip/1.2' || github.base_ref == 'wip/1.2'
93+
run: php ./.github/workflows/utilities/library-switcher "dev-wip/1.2 as 1.2"
94+
8795
- name: Setup dependency cache
8896
id: composercache
8997
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
@@ -105,10 +113,10 @@ jobs:
105113
run: php artisan package:discover
106114

107115
- name: Setup problem matchers for PHPUnit
108-
if: matrix.phpVersion == '7.4'
116+
if: matrix.phpVersion == '8.1'
109117
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
110118

111119
- name: Run Linting and Tests
112120
run: |
113-
./vendor/bin/parallel-lint --exclude vendor --exclude storage --exclude tests/fixtures/plugins/testvendor/goto/Plugin.php .
121+
composer lint
114122
./vendor/bin/phpunit

.github/workflows/utilities/phpcs-pr

+43-39
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* of changed files. The PHPCS tests are only run against these changed files, to speed up the tests.
88
*/
99
if (empty($argv[1])) {
10-
echo 'You must provide a base branch to check this PR against.';
11-
echo "\n";
10+
fwrite(STDERR, 'You must provide a base branch to check this PR against.');
11+
fwrite(STDERR, "\n");
1212
exit(1);
1313
}
1414

@@ -22,6 +22,13 @@ foreach ($files as &$file) {
2222
}
2323
}
2424

25+
// no changes found in diff, early exit
26+
if (!count($files)) {
27+
fwrite(STDOUT, "\e[0;32mFound no changed files.\e[0m");
28+
fwrite(STDOUT, "\n");
29+
exit(0);
30+
}
31+
2532
// Run all changed files through the PHPCS code sniffer and generate a CSV report
2633
$csv = shell_exec('phpcs --colors -nq --report="csv" --extensions="php" ' . implode(' ', $files));
2734
$lines = array_map(function ($row) {
@@ -34,50 +41,47 @@ $lines = array_map(function ($row) {
3441
array_shift($lines);
3542

3643
if (!count($lines)) {
37-
echo "\e[0;32mFound no issues with code quality.\e[0m";
38-
echo "\n";
44+
fwrite(STDOUT, "\e[0;32mFound no issues with code quality.\e[0m");
45+
fwrite(STDOUT, "\n");
3946
exit(0);
40-
} else {
41-
// Group errors by file
42-
$files = [];
47+
}
4348

44-
foreach ($lines as $line) {
45-
$filename = str_replace(dirname(dirname(dirname(__DIR__))), '', $line[0]);
49+
// Group errors by file
50+
$files = [];
4651

47-
if (empty($files[$filename])) {
48-
$files[$filename] = [];
49-
}
52+
foreach ($lines as $line) {
53+
$filename = str_replace(dirname(dirname(dirname(__DIR__))), '', $line[0]);
5054

51-
$files[$filename][] = [
52-
'warning' => ($line[3] === 'warning'),
53-
'message' => $line[4],
54-
'line' => $line[1],
55-
];
55+
if (empty($files[$filename])) {
56+
$files[$filename] = [];
5657
}
5758

58-
// Render report
59-
echo "\e[0;31mFound "
60-
. ((count($lines) === 1)
61-
? '1 issue'
62-
: count($lines) . ' issues')
63-
. " with code quality.\e[0m";
64-
echo "\n";
59+
$files[$filename][] = [
60+
'warning' => (($line[3] ?? 'err') === 'warning'),
61+
'message' => $line[4] ?? 'unknown',
62+
'line' => $line[1] ?? '0',
63+
];
64+
}
65+
66+
// Render report
67+
fwrite(STDERR, "\e[0;31mFound "
68+
. ((count($lines) === 1)
69+
? '1 issue'
70+
: count($lines) . ' issues')
71+
. " with code quality.\e[0m");
72+
fwrite(STDERR, "\n");
6573

66-
foreach ($files as $file => $errors) {
67-
echo "\n";
68-
echo "\e[1;37m" . str_replace('"', '', $file) . "\e[0m";
69-
echo "\n\n";
74+
foreach ($files as $file => $errors) {
75+
fwrite(STDERR, "\n");
76+
fwrite(STDERR, "\e[1;37m" . str_replace('"', '', $file) . "\e[0m");
77+
fwrite(STDERR, "\n\n");
7078

71-
foreach ($errors as $error) {
72-
echo "\e[2m" . str_pad(' L' . $error['line'], 7) . " | \e[0m";
73-
if ($error['warning'] === false) {
74-
echo "\e[0;31mERR:\e[0m ";
75-
} else {
76-
echo "\e[1;33mWARN:\e[0m ";
77-
}
78-
echo $error['message'];
79-
echo "\n";
80-
}
79+
foreach ($errors as $error) {
80+
fwrite(STDERR, "\e[2m" . str_pad(' L' . $error['line'], 7) . " | \e[0m");
81+
fwrite(STDERR, $error['warning'] ? "\e[1;33mWARN:\e[0m " : "\e[0;31mERR:\e[0m ");
82+
fwrite(STDERR, $error['message']);
83+
fwrite(STDERR, "\n");
8184
}
82-
exit(1);
8385
}
86+
87+
exit(1);

.github/workflows/utilities/phpcs-push

+43-39
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* against these changed files, to speed up the tests.
88
*/
99
if (empty($argv[1])) {
10-
echo 'You must provide a commit SHA to check.';
11-
echo "\n";
10+
fwrite(STDERR, 'You must provide a commit SHA to check.');
11+
fwrite(STDERR, "\n");
1212
exit(1);
1313
}
1414

@@ -22,6 +22,13 @@ foreach ($files as &$file) {
2222
}
2323
}
2424

25+
// no changes found in diff, early exit
26+
if (!count($files)) {
27+
fwrite(STDOUT, "\e[0;32mFound no changed files.\e[0m");
28+
fwrite(STDOUT, "\n");
29+
exit(0);
30+
}
31+
2532
// Run all changed files through the PHPCS code sniffer and generate a CSV report
2633
$csv = shell_exec('phpcs --colors -nq --report="csv" --extensions="php" ' . implode(' ', $files));
2734
$lines = array_map(function ($row) {
@@ -34,50 +41,47 @@ $lines = array_map(function ($row) {
3441
array_shift($lines);
3542

3643
if (!count($lines)) {
37-
echo "\e[0;32mFound no issues with code quality.\e[0m";
38-
echo "\n";
44+
fwrite(STDOUT, "\e[0;32mFound no issues with code quality.\e[0m");
45+
fwrite(STDOUT, "\n");
3946
exit(0);
40-
} else {
41-
// Group errors by file
42-
$files = [];
47+
}
4348

44-
foreach ($lines as $line) {
45-
$filename = str_replace(dirname(dirname(dirname(__DIR__))), '', $line[0]);
49+
// Group errors by file
50+
$files = [];
4651

47-
if (empty($files[$filename])) {
48-
$files[$filename] = [];
49-
}
52+
foreach ($lines as $line) {
53+
$filename = str_replace(dirname(dirname(dirname(__DIR__))), '', $line[0]);
5054

51-
$files[$filename][] = [
52-
'warning' => ($line[3] === 'warning'),
53-
'message' => $line[4],
54-
'line' => $line[1],
55-
];
55+
if (empty($files[$filename])) {
56+
$files[$filename] = [];
5657
}
5758

58-
// Render report
59-
echo "\e[0;31mFound "
60-
. ((count($lines) === 1)
61-
? '1 issue'
62-
: count($lines) . ' issues')
63-
. " with code quality.\e[0m";
64-
echo "\n";
59+
$files[$filename][] = [
60+
'warning' => (($line[3] ?? 'err') === 'warning'),
61+
'message' => $line[4] ?? 'unknown',
62+
'line' => $line[1] ?? '0',
63+
];
64+
}
65+
66+
// Render report
67+
fwrite(STDERR, "\e[0;31mFound "
68+
. ((count($lines) === 1)
69+
? '1 issue'
70+
: count($lines) . ' issues')
71+
. " with code quality.\e[0m");
72+
fwrite(STDERR, "\n");
6573

66-
foreach ($files as $file => $errors) {
67-
echo "\n";
68-
echo "\e[1;37m" . str_replace('"', '', $file) . "\e[0m";
69-
echo "\n\n";
74+
foreach ($files as $file => $errors) {
75+
fwrite(STDERR, "\n");
76+
fwrite(STDERR, "\e[1;37m" . str_replace('"', '', $file) . "\e[0m");
77+
fwrite(STDERR, "\n\n");
7078

71-
foreach ($errors as $error) {
72-
echo "\e[2m" . str_pad(' L' . $error['line'], 7) . " | \e[0m";
73-
if ($error['warning'] === false) {
74-
echo "\e[0;31mERR:\e[0m ";
75-
} else {
76-
echo "\e[1;33mWARN:\e[0m ";
77-
}
78-
echo $error['message'];
79-
echo "\n";
80-
}
79+
foreach ($errors as $error) {
80+
fwrite(STDERR, "\e[2m" . str_pad(' L' . $error['line'], 7) . " | \e[0m");
81+
fwrite(STDERR, $error['warning'] ? "\e[1;33mWARN:\e[0m " : "\e[0;31mERR:\e[0m ");
82+
fwrite(STDERR, $error['message']);
83+
fwrite(STDERR, "\n");
8184
}
82-
exit(1);
8385
}
86+
exit(1);
87+

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ package-lock.json
3232
/node_modules
3333

3434
# Ignore generated public directory from `winter:mirror public`
35-
public
35+
public

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"**/modules/*/widgets/*/partials/*.htm": "php",
1212

1313
"**/plugins/*/*/behaviors/*/partials/*.htm": "php",
14-
"**/plugins/*/*/components/*/*.htm": "wintercms-twig",
14+
"**/plugins/*/*/components/**/*.htm": "wintercms-twig",
1515
"**/plugins/*/*/controllers/*/*.htm": "php",
1616
"**/plugins/*/*/formwidgets/*/partials/*.htm": "php",
1717
"**/plugins/*/*/layouts/*.htm": "php",

artisan

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
| Composer provides a convenient, automatically generated class loader
1010
| for our application. We just need to utilize it! We'll require it
1111
| into the script here so that we do not have to worry about the
12-
| loading of any our classes "manually". Feels great to relax.
12+
| loading of any of our classes manually. It's great to relax.
1313
|
1414
*/
1515

@@ -40,7 +40,7 @@ $status = $kernel->handle(
4040
| Shutdown The Application
4141
|--------------------------------------------------------------------------
4242
|
43-
| Once Artisan has finished running. We will fire off the shutdown events
43+
| Once Artisan has finished running, we will fire off the shutdown events
4444
| so that any final work may be done by the application before we shut
4545
| down the process. This is the last thing to happen to the request.
4646
|

composer.json

+12-21
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,25 @@
2929
"source": "https://github.com/wintercms/winter"
3030
},
3131
"require": {
32-
"php": "^7.2.9|~8.0.0",
33-
"winter/storm": "dev-develop as 1.1.999",
34-
"winter/wn-system-module": "dev-develop as 1.1.999",
35-
"winter/wn-backend-module": "dev-develop as 1.1.999",
36-
"winter/wn-cms-module": "dev-develop as 1.1.999",
37-
"laravel/framework": "~6.0",
32+
"php": "^8.0.2",
33+
"winter/storm": "dev-wip/1.2 as 1.2",
34+
"winter/wn-system-module": "dev-wip/1.2",
35+
"winter/wn-backend-module": "dev-wip/1.2",
36+
"winter/wn-cms-module": "dev-wip/1.2",
37+
"laravel/framework": "^9.1",
3838
"wikimedia/composer-merge-plugin": "~2.0.1"
3939
},
4040
"require-dev": {
41-
"phpunit/phpunit": "^8.4|^9.3.3",
42-
"mockery/mockery": "~1.3.3|^1.4.2",
43-
"fakerphp/faker": "~1.9",
44-
"squizlabs/php_codesniffer": "3.*",
41+
"phpunit/phpunit": "^9.5.8",
42+
"mockery/mockery": "^1.4.4",
43+
"fakerphp/faker": "^1.9.2",
44+
"squizlabs/php_codesniffer": "^3.2",
4545
"php-parallel-lint/php-parallel-lint": "^1.0",
4646
"dms/phpunit-arraysubset-asserts": "^0.1.0|^0.2.1"
4747
},
48-
"autoload-dev": {
49-
"classmap": [
50-
"tests/concerns/InteractsWithAuthentication.php",
51-
"tests/fixtures/backend/models/UserFixture.php",
52-
"tests/TestCase.php",
53-
"tests/PluginTestCase.php"
54-
]
55-
},
5648
"scripts": {
5749
"post-create-project-cmd": [
58-
"@php artisan key:generate",
59-
"@php artisan package:discover"
50+
"@php artisan key:generate"
6051
],
6152
"post-update-cmd": [
6253
"@php artisan winter:version",
@@ -66,7 +57,7 @@
6657
"phpunit --stop-on-failure"
6758
],
6859
"lint": [
69-
"parallel-lint --exclude vendor --exclude storage --exclude tests/fixtures/plugins/testvendor/goto/Plugin.php ."
60+
"parallel-lint --exclude vendor --exclude storage --exclude modules/system/tests/fixtures/plugins/testvendor/goto/Plugin.php ."
7061
],
7162
"sniff": [
7263
"phpcs --colors -nq --report=\"full\" --extensions=\"php\""

0 commit comments

Comments
 (0)