Skip to content

Commit

Permalink
Chore: Update phpcs and phpstan config
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Tubach committed Jul 26, 2024
1 parent 1b277b0 commit 5b9fece
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 28 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/phpcs_activity.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: PHP_CodeSniffer - civiremote_activity

on:
push: ~
pull_request:
branches: [ main ]
paths:
- 'modules/civiremote_activity/src/**.php'
- modules/civiremote_activity/composer.json
- modules/civiremote_activity/phpcs.xml.dist

jobs:
phpcs:
Expand All @@ -19,7 +21,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
coverage: none
tools: cs2pr
env:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/phpcs_entity.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: PHP_CodeSniffer - civiremote_entity

on:
push: ~
pull_request:
branches: [ main ]
paths:
- 'modules/civiremote_entity/src/**.php'
- modules/civiremote_entity/composer.json
- modules/civiremote_entity/phpcs.xml.dist

jobs:
phpcs:
Expand All @@ -19,7 +21,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
coverage: none
tools: cs2pr
env:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/phpstan_activity.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
name: PHPStan - civiremote_activity

on:
push: ~
pull_request:
branches: [ main ]
paths:
- 'modules/civiremote_activity/src/**.php'
- modules/civiremote_activity/composer.json
- modules/civiremote_activity/tools/phpstan/composer.json
- modules/civiremote_activity/ci/composer.json
- modules/civiremote_activity/phpstan.ci.neon
- modules/civiremote_activity/phpstan.neon.dist
- 'modules/civiremote_entity/src/**.php'

jobs:
phpstan:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.2']
php-versions: ['7.4', '8.0', '8.3']
prefer: ['prefer-stable', 'prefer-lowest']
name: PHPStan with PHP ${{ matrix.php-versions }} ${{ matrix.prefer }}
defaults:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/phpstan_entity.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
name: PHPStan - civiremote_entity

on:
push: ~
pull_request:
branches: [ main ]
paths:
- 'modules/civiremote_entity/src/**.php'
- modules/civiremote_entity/composer.json
- modules/civiremote_entity/tools/phpstan/composer.json
- modules/civiremote_entity/ci/composer.json
- modules/civiremote_entity/phpstan.ci.neon
- modules/civiremote_entity/phpstan.neon.dist
- 'src/**.php'

jobs:
phpstan:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.2']
php-versions: ['7.4', '8.0', '8.3']
prefer: ['prefer-stable', 'prefer-lowest']
name: PHPStan with PHP ${{ matrix.php-versions }} ${{ matrix.prefer }}
defaults:
Expand Down
3 changes: 2 additions & 1 deletion modules/civiremote_activity/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"php-http/discovery": false
}
},
"repositories": [
Expand Down
2 changes: 0 additions & 2 deletions modules/civiremote_activity/phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

<file>src</file>
<!--<file>tests</file>-->
<!--<file>civiremote_activity.module</file>-->

<arg name="extensions" value="php"/>
<arg name="cache" value=".phpcs.cache"/>
Expand Down
2 changes: 0 additions & 2 deletions modules/civiremote_activity/phpstan.ci.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ includes:
parameters:
bootstrapFiles:
- ci/vendor/autoload.php
scanFiles:
- ci/vendor/drupal/core/tests/Drupal/Tests/UnitTestCase.php
2 changes: 0 additions & 2 deletions modules/civiremote_activity/phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
parameters:
paths:
- src
#- tests
#- civiremote_activity.module
bootstrapFiles:
- vendor/autoload.php
scanDirectories:
Expand Down
9 changes: 9 additions & 0 deletions modules/civiremote_activity/phpstan.neon.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copy this file to phpstan.neon and replace {VENDOR_DIR} with the vendor
# directory of your Drupal project.

includes:
- phpstan.neon.dist

parameters:
bootstrapFiles:
- {VENDOR_DIR}/autoload.php
3 changes: 2 additions & 1 deletion modules/civiremote_entity/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"php-http/discovery": false
}
},
"repositories": [
Expand Down
5 changes: 3 additions & 2 deletions modules/civiremote_entity/phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

<file>src</file>
<!--<file>tests</file>-->
<!--<file>civiremote_entity.module</file>-->

<arg name="extensions" value="php"/>
<arg name="cache" value=".phpcs.cache"/>
Expand All @@ -15,6 +13,9 @@
<config name="ignore_warnings_on_exit" value="true"/>

<rule ref="vendor/drupal/coder/coder_sniffer/Drupal">
<!-- Keep PHP 7.4 compatibility -->
<exclude name="Drupal.Functions.MultiLineFunctionDeclaration.MissingTrailingComma"/>

<!-- Don't enforce phpdoc type hint because it (might) only duplicate a PHP type hint -->
<exclude name="Drupal.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="Drupal.Commenting.FunctionComment.ParamMissingDefinition"/>
Expand Down
2 changes: 0 additions & 2 deletions modules/civiremote_entity/phpstan.ci.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ includes:
parameters:
bootstrapFiles:
- ci/vendor/autoload.php
scanFiles:
- ci/vendor/drupal/core/tests/Drupal/Tests/UnitTestCase.php
3 changes: 0 additions & 3 deletions modules/civiremote_entity/phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
parameters:
paths:
- src
#- tests
#- civiremote_entity.module
bootstrapFiles:
- vendor/autoload.php
scanDirectories:
Expand All @@ -22,7 +20,6 @@ parameters:
ignoreErrors:
# Note paths are prefixed with ""*/" to work with inspections in PHPStorm because of:
# https://youtrack.jetbrains.com/issue/WI-63891/PHPStan-ignoreErrors-configuration-isnt-working-with-inspections
- '/^Parameter #1 \$form \(array<int\|string, mixed>\) of method [^\s]+::(build|validate|submit)Form\(\) should be contravariant with parameter \$form \(array\) of method Drupal\\Core\\Form\\(FormInterface|FormBase)::(build|validate|submit)Form\(\)$/'
-
message: '/^Parameter #1 \$value of static method Drupal\\civiremote_entity\\Api\\[^:]+::fromApiResultValue\(\) expects array\{.+\}, array<int\|string, mixed> given.$/'
path: */Api/AbstractEntityApi.php
Expand Down
9 changes: 9 additions & 0 deletions modules/civiremote_entity/phpstan.neon.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copy this file to phpstan.neon and replace {VENDOR_DIR} with the vendor
# directory of your Drupal project.

includes:
- phpstan.neon.dist

parameters:
bootstrapFiles:
- {VENDOR_DIR}/autoload.php
3 changes: 2 additions & 1 deletion modules/civiremote_entity/src/Form/AbstractEntityForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ abstract class AbstractEntityForm extends AbstractJsonFormsForm {

protected FormResponseHandlerInterface $formResponseHandler;

public function __construct(FormArrayFactoryInterface $formArrayFactory,
public function __construct(
FormArrayFactoryInterface $formArrayFactory,
FormValidatorInterface $formValidator,
FormValidationMapperInterface $formValidationMapper,
FormRequestHandlerInterface $formRequestHandler,
Expand Down

0 comments on commit 5b9fece

Please sign in to comment.