Skip to content

Commit bf9d283

Browse files
author
Mike van den Hoek
committed
(feat): upgrade to php8
1 parent e0de8d5 commit bf9d283

26 files changed

+658
-762
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
# track this file .gitignore (i.e. do NOT ignore it)
3737
!.gitignore
3838

39-
!.php_cs
39+
!.php-cs-fixer.php
40+
.php-cs-fixer.cache
4041

4142
# Eslint
4243
!.eslintrc
@@ -64,6 +65,7 @@ Thumbs.db
6465
*.log
6566
*.sql
6667
*.sqlite
68+
pg-log-*.json
6769

6870
# ignore compiled files
6971
*.com

.php-cs-fixer.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$finder = PhpCsFixer\Finder::create()
6+
->notPath('vendor')
7+
->notPath('node_modules')
8+
->in(__DIR__)
9+
->in('./resources/views')
10+
->in('./config')
11+
->name('*.php')
12+
->notName('*.blade.php')
13+
->ignoreDotFiles(true)
14+
->ignoreVCS(true);
15+
16+
return (new PhpCsFixer\Config)
17+
->setRules([
18+
'@PSR2' => true,
19+
'array_syntax' => [
20+
'syntax' => 'short',
21+
],
22+
'ordered_imports' => [
23+
'sort_algorithm' => 'alpha',
24+
],
25+
'no_unused_imports' => true,
26+
'binary_operator_spaces' => [
27+
'default' => 'single_space',
28+
'operators' => [
29+
'=>' => null,
30+
'|' => 'no_space',
31+
],
32+
],
33+
'full_opening_tag' => true,
34+
'yoda_style' => [
35+
'always_move_variable' => true,
36+
'equal' => true,
37+
'identical' => true,
38+
'less_and_greater' => true,
39+
],
40+
])
41+
->setFinder($finder);

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,31 @@ See [here](https://github.com/OpenWebconcept/plugin-prefill-gravity-forms/blob/m
4949
## License
5050

5151
The source code is made available under the [EUPL 1.2 license](https://github.com/OpenWebconcept/plugin-prefill-gravity-forms/blob/main/LICENSE.md). Some of the dependencies are licensed differently, with the BSD or MIT license, for example.
52+
53+
## Logging
54+
55+
Enable logging to monitor errors during communication with the BRP suppliers.
56+
57+
- Logs are written daily to `pg-log{-date}.json` in the uploads directory.
58+
- A rotating file handler keeps up to 7 log files by default, deleting the oldest as needed.
59+
- You can change the maximum number of log files using the filter described below.
60+
61+
## Hooks
62+
63+
#### Change the maximum number of log files
64+
65+
Use the following filter to alter the rotating file handler's max files setting:
66+
67+
```php
68+
apply_filters('pg::logger/rotating_filer_handler_max_files', PG_LOGGER_DEFAULT_MAX_FILES)
69+
```
70+
71+
#### Intercept exceptions for custom handling
72+
73+
You can intercept exceptions caught by the plugin for additional processing or custom logging using this filter:
74+
75+
```php
76+
apply_filters('pg::exception/intercept', $exception, $method)
77+
```
78+
79+
The `$exception` parameter contains the caught exception object.

build/blocks.asset.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '33b24b2f8a8b7ff4f915');
1+
<?php
2+
3+
return ['dependencies' => ['react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'], 'version' => '33b24b2f8a8b7ff4f915'];

build/icons.asset.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
<?php return array('dependencies' => array(), 'version' => '12341f29470476729a0c');
1+
<?php
2+
3+
return ['dependencies' => [], 'version' => '12341f29470476729a0c'];

build/style.asset.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
<?php return array('dependencies' => array(), 'version' => 'd63fd4982613309d5c57');
1+
<?php
2+
3+
return ['dependencies' => [], 'version' => 'd63fd4982613309d5c57'];

composer.json

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,49 @@
11
{
2-
"name": "plugin/prefill-gravity-forms",
3-
"description": "Prefill GravityForms Plugin",
4-
"authors": [
5-
{
6-
"name": "Yard | Digital Agency",
7-
"email": "[email protected]",
8-
"homepage": "https://www.yard.nl"
9-
}
10-
],
11-
"type": "wordpress-plugin",
12-
"repositories": [
13-
{
14-
"type": "composer",
15-
"url": "https://wpackagist.org"
16-
},
17-
{
2+
"name": "plugin/prefill-gravity-forms",
3+
"description": "Prefill GravityForms Plugin",
4+
"authors": [
5+
{
6+
"name": "Yard | Digital Agency",
7+
"email": "[email protected]",
8+
"homepage": "https://www.yard.nl"
9+
}
10+
],
11+
"type": "wordpress-plugin",
12+
"repositories": [
13+
{
14+
"type": "composer",
15+
"url": "https://wpackagist.org"
16+
},
17+
{
1818
"type": "vcs",
1919
"url": "[email protected]:OpenWebconcept/idp-userdata"
2020
}
21-
],
22-
"require": {
23-
"php": ">=7.0",
24-
"php-di/php-di": "^6.0",
25-
"owc/idp-userdata": "^1.0"
26-
},
27-
"require-dev": {
28-
"mockery/mockery": "^1.0",
29-
"phpunit/phpunit": "^9.0",
30-
"10up/wp_mock": "^0.5.0",
31-
"friendsofphp/php-cs-fixer": "^3.0",
32-
"phpstan/phpstan": "^0.12",
33-
"szepeviktor/phpstan-wordpress": "^0.6.0"
34-
},
35-
"autoload": {
36-
"psr-4": {
37-
"OWC\\PrefillGravityForms\\": "./src/PrefillGravityForms"
38-
}
39-
},
40-
"autoload-dev": {
41-
"psr-4": {
42-
"OWC\\PrefillGravityForms\\Tests\\": "./tests/Unit"
43-
}
44-
},
45-
"scripts": {
46-
"test": "clear && ./vendor/bin/phpunit --testsuite 'Unit Test Suite' --colors=always",
47-
"format": "vendor/bin/php-cs-fixer fix",
48-
"phpstan": "./vendor/bin/phpstan analyse"
49-
}
21+
],
22+
"require": {
23+
"php": "^8.0",
24+
"php-di/php-di": "^7.0",
25+
"owc/idp-userdata": "^1.0"
26+
},
27+
"require-dev": {
28+
"10up/wp_mock": "^0.5.0",
29+
"friendsofphp/php-cs-fixer": "^3.0",
30+
"mockery/mockery": "^1.0",
31+
"phpunit/phpunit": "^9.0",
32+
"szepeviktor/phpstan-wordpress": "^1.0"
33+
},
34+
"autoload": {
35+
"psr-4": {
36+
"OWC\\PrefillGravityForms\\": "./src/PrefillGravityForms"
37+
}
38+
},
39+
"autoload-dev": {
40+
"psr-4": {
41+
"OWC\\PrefillGravityForms\\Tests\\": "./tests/Unit"
42+
}
43+
},
44+
"scripts": {
45+
"test": "clear && ./vendor/bin/phpunit --testsuite 'Unit Test Suite' --colors=always",
46+
"format": "vendor/bin/php-cs-fixer fix",
47+
"phpstan": "./vendor/bin/phpstan analyse"
48+
}
5049
}

0 commit comments

Comments
 (0)