Skip to content

Commit 5bed01f

Browse files
committed
Merge remote-tracking branch 'origin/8.3.x' into replace-namespace-qualify
2 parents 8b062d4 + 59f52b8 commit 5bed01f

File tree

108 files changed

+2207
-891
lines changed

Some content is hidden

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

108 files changed

+2207
-891
lines changed

.cspell.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
// Version of the setting file. Always 0.2
3+
"version": "0.2",
4+
// language - current active spelling language
5+
"language": "en-US",
6+
"ignorePaths": [
7+
"composer.*",
8+
"tests",
9+
"vendor"
10+
],
11+
"dictionaries": [
12+
"dictionary",
13+
"drupal",
14+
"companies",
15+
"fonts",
16+
"html",
17+
"php",
18+
"softwareTerms"
19+
],
20+
// words - list of words to be always considered correct
21+
"words": [
22+
"addtogroup",
23+
"autoloader",
24+
"codesniffer",
25+
"ColourDefinitionSniff",
26+
"CURLOPT_SSL_VERIFYPEER",
27+
"datestamp",
28+
"defgroup",
29+
"drush",
30+
"endcode",
31+
"endlink",
32+
"heredocs",
33+
"Kernighan",
34+
"Komodo",
35+
"multibyte",
36+
"Netbeans",
37+
"phpcbf",
38+
"Ritchie",
39+
"ruleset",
40+
"sirbrillig",
41+
"squizlabs",
42+
"Squiz",
43+
"startOfLine",
44+
"Superglobal",
45+
"T_ASPERAND",
46+
"T_COLOUR",
47+
"T_CONSTANT_ENCAPSED_STRING",
48+
"T_DNUMBER",
49+
"T_LNUMBER",
50+
"T_NULLSAFE_OBJECT_OPERATOR",
51+
"tableselect",
52+
"ungreedy",
53+
"unserialized",
54+
"webform"
55+
],
56+
// flagWords - list of words to be always considered incorrect
57+
// This is useful for offensive words and common spelling errors.
58+
// For example "hte" should be "the"
59+
"flagWords": [
60+
"hte"
61+
]
62+
}

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
/.cspell.json export-ignore
12
/.gitattributes export-ignore
2-
/.travis.yml export-ignore
33
/README.md export-ignore
44
/phpcs.xml.dist export-ignore
55
/phpunit.xml.dist export-ignore

.github/workflows/testing.yml

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,48 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
11-
phpstan: ['0']
12-
# We only need to run PHPStan once on the latest PHP version.
10+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
11+
extra-tests: ['0']
12+
# We only need to run PHPStan and Drupal core regression tests once on
13+
# the latest PHP version.
1314
include:
14-
- php-versions: '8.2'
15-
phpstan: '1'
15+
- php-versions: '8.4'
16+
extra-tests: '1'
1617
steps:
1718
- name: Checkout Coder
18-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
20+
1921
- name: Setup PHP, with composer and extensions
2022
uses: shivammathur/setup-php@v2
2123
with:
2224
php-version: ${{ matrix.php-versions }}
2325
extensions: mbstring
2426
# Disable Xdebug for better performance.
2527
coverage: none
28+
2629
- name: Get composer cache directory
2730
id: composercache
2831
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
32+
2933
- name: Cache composer dependencies
30-
uses: actions/cache@v3
34+
uses: actions/cache@v4
3135
with:
3236
path: ${{ steps.composercache.outputs.dir }}
3337
# Use composer.json for key, if composer.lock is not committed.
3438
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
3539
restore-keys: ${{ runner.os }}-composer-
40+
3641
- name: Install Composer dependencies
3742
# Running composer install without a lock file will also update cached
3843
# dependencies in vendor.
39-
# Remove the PHPStan dependency from composer.json if it should not be
40-
# run for this PHP version.
41-
run: |
42-
if [[ ${{ matrix.phpstan }} == "0" ]]; then sed -i "/phpstan/d" composer.json; fi
43-
composer install --no-progress --prefer-dist --optimize-autoloader
44+
run: composer install --no-progress --prefer-dist --optimize-autoloader
45+
4446
- name: Run PHPUnit
4547
run: ./vendor/bin/phpunit
48+
4649
- name: Run PHPCS
4750
run: ./vendor/bin/phpcs
51+
4852
- name: Check custom standard autoloading
4953
# Ensure that a custom standard can be invoked and the auto-loading of
5054
# abstract classes works.
@@ -53,5 +57,31 @@ jobs:
5357
run: |
5458
./vendor/bin/phpcs -p --standard=tests/Drupal/phpcs-ruleset.xml tests/Drupal/good/ --ignore=tests/Drupal/good/GoodUnitTest.php
5559
./vendor/bin/phpcs -p --standard=coder_sniffer/DrupalPractice tests/DrupalPractice/good/ --ignore=tests/DrupalPractice/good/GoodUnitTest.php
60+
5661
- name: Run PHPStan
57-
run: if [[ ${{ matrix.phpstan }} == "1" ]]; then ./vendor/bin/phpstan analyse; fi
62+
if: ${{ matrix.extra-tests == '1' }}
63+
run: ./vendor/bin/phpstan analyse
64+
65+
- name: Run Cspell
66+
if: ${{ matrix.extra-tests == '1' }}
67+
uses: streetsidesoftware/cspell-action@v6
68+
with:
69+
incremental_files_only: false
70+
71+
- name: Checkout Drupal core
72+
if: ${{ matrix.extra-tests == '1' }}
73+
uses: actions/checkout@v3
74+
with:
75+
repository: drupal/drupal
76+
ref: "11.x"
77+
path: drupal
78+
79+
- name: Run PHPCS on Drupal core for regressions
80+
if: ${{ matrix.extra-tests == '1' }}
81+
# In case Drupal core files have known problems that should be
82+
# ignored temporarily, add them with the --ignore option.
83+
# @todo Remove ignore option once Coder 8.3.27 is released and Drupal
84+
# core is updated to that version.
85+
run: |
86+
cd drupal/core
87+
../../vendor/bin/phpcs -p -s --ignore=lib/Drupal/Core/Entity/EntityType.php,lib/Drupal/Core/Recipe/RecipeInputFormTrait.php,lib/Drupal/Core/Form/FormState.php,modules/migrate/src/Plugin/Migration.php,modules/views/src/ViewExecutable.php,modules/views/src/Plugin/views/style/StylePluginBase.php

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ phpcs.xml.dist file in your project like this:
7373

7474
```xml
7575
<?xml version="1.0" encoding="UTF-8"?>
76-
<ruleset name="myproject">
77-
<description>PHP CodeSniffer configuration for myproject development.</description>
76+
<ruleset name="example">
77+
<description>PHP CodeSniffer configuration for example development.</description>
7878
<!-- Check all files in the current directory and below. -->
7979
<file>.</file>
8080
<arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"/>
@@ -139,7 +139,7 @@ Then execute the coding standards checker on Coder itself:
139139

140140
Then execute static analysis:
141141

142-
./vendor/bin/phpstan analyse
142+
./vendor/bin/phpstan
143143

144144

145145
## Contributing
@@ -154,6 +154,8 @@ Thank you!
154154

155155
## Maintainers
156156

157+
[//]: # cspell:ignore Pieter Frenssen Welford
158+
157159
- Pieter Frenssen, https://www.drupal.org/u/pfrenssen
158160
- Michael Welford, https://www.drupal.org/u/mikejw
159161
- Klaus Purer, https://www.drupal.org/u/klausi

coder_sniffer/Drupal/Docs/Functions/FunctionCallArgumentSpacingStandard.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

coder_sniffer/Drupal/Docs/Functions/FunctionCallSignatureStandard.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

coder_sniffer/Drupal/Docs/Functions/ValidDefaultValueStandard.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

coder_sniffer/Drupal/Sniffs/Arrays/ArraySniff.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ class ArraySniff implements Sniff
3131
/**
3232
* The limit that the length of a line should not exceed.
3333
*
34-
* This can be configured to have a different value but the default is 80.
34+
* This can be configured to have a different value but the default is 120.
35+
* We don't enforce 80 characters by default because that can make array
36+
* definitions in nested arrays or function calls less readable.
3537
*
3638
* @var integer
3739
*/
38-
public $lineLimit = 80;
40+
public $lineLimit = 120;
3941

4042

4143
/**

coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ public function process(File $phpcsFile, $stackPtr)
9898
&& in_array($tokens[($i - 1)]['code'], [T_WHITESPACE, T_COMMA]) === false
9999
) {
100100
$error = 'Selectors must be on a single line';
101-
$fix = $phpcsFile->addFixableError($error, $i, 'SeletorSingleLine');
101+
// cspell:ignore SeletorSingleLine
102+
$fix = $phpcsFile->addFixableError($error, $i, 'SeletorSingleLine');
102103
if ($fix === true) {
103104
$phpcsFile->fixer->replaceToken($i, str_replace($phpcsFile->eolChar, ' ', $tokens[$i]['content']));
104105
}

coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* \Drupal\Sniffs\CSS\ColourDefinitionSniff.
1717
*
18-
* Ensure colours are defined in lower-case.
18+
* Ensure colors are defined in lower-case.
1919
*
2020
* @category PHP
2121
* @package PHP_CodeSniffer
@@ -56,14 +56,14 @@ public function register()
5656
public function process(File $phpcsFile, $stackPtr)
5757
{
5858
$tokens = $phpcsFile->getTokens();
59-
$colour = $tokens[$stackPtr]['content'];
59+
$color = $tokens[$stackPtr]['content'];
6060

61-
$expected = strtolower($colour);
62-
if ($colour !== $expected) {
63-
$error = 'CSS colours must be defined in lowercase; expected %s but found %s';
61+
$expected = strtolower($color);
62+
if ($color !== $expected) {
63+
$error = 'CSS colors must be defined in lowercase; expected %s but found %s';
6464
$data = [
6565
$expected,
66-
$colour,
66+
$color,
6767
];
6868
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotLower', $data);
6969
if ($fix === true) {

0 commit comments

Comments
 (0)