Skip to content

Commit a500880

Browse files
fix: redirect stderr before cs2pr to prevent PHP deprecation warnings from breaking XML parsing
On PHP 8.5, packages like sentry-symfony emit deprecation warnings that get mixed into the checkstyle XML output, causing cs2pr to fail with: 'Start tag expected, < not found' Adding 2>/dev/null before the pipe ensures only clean XML reaches cs2pr. Applied to phpcs, php-cs-fixer, and twig-cs-fixer commands.
1 parent 6c13da3 commit a500880

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

src/tools/codesniffer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {ToolExecutionType} from '../enum/toolExecutionType';
44
export const PhpCodeSnifferTool = {
55
executionType : ToolExecutionType.STATIC,
66
name : 'PHPCodeSniffer',
7-
command : './vendor/bin/phpcs -q --report=checkstyle | cs2pr',
7+
command : './vendor/bin/phpcs -q --report=checkstyle 2>/dev/null | cs2pr',
88
filesToCheck : [ 'phpcs.xml', 'phpcs.xml.dist' ],
99
toolType : ToolType.CODE_CHECK,
1010
lintConfigCommand : 'xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd',

src/tools/phpCsFixer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {ToolExecutionType} from '../enum/toolExecutionType';
44
export const PhpCsFixerTool = {
55
executionType : ToolExecutionType.STATIC,
66
name : 'PHP CS Fixer',
7-
command : './vendor/bin/php-cs-fixer fix -v --diff --dry-run --format=checkstyle | cs2pr',
7+
command : './vendor/bin/php-cs-fixer fix -v --diff --dry-run --format=checkstyle 2>/dev/null | cs2pr',
88
filesToCheck : [ '.php-cs-fixer.php', '.php-cs-fixer.dist.php' ],
99
toolType : ToolType.CODE_CHECK,
1010
};

src/tools/twigCsFixer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {ToolExecutionType} from '../enum/toolExecutionType';
44
export const TwigCsFixerTool = {
55
executionType : ToolExecutionType.STATIC,
66
name : 'Twig CS Fixer',
7-
command : './vendor/bin/twig-cs-fixer lint --report checkstyle | cs2pr',
7+
command : './vendor/bin/twig-cs-fixer lint --report checkstyle 2>/dev/null | cs2pr',
88
filesToCheck : [ '.twig-cs-fixer.php', '.twig-cs-fixer.dist.php' ],
99
toolType : ToolType.CODE_CHECK,
1010
};

tests/code-check-phpcs-dist/matrix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"include": [
33
{
44
"name": "PHPCodeSniffer [7.4, latest]",
5-
"job": "{\"command\":\"./vendor/bin/phpcs -q --report=checkstyle | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml.dist\"]}",
5+
"job": "{\"command\":\"./vendor/bin/phpcs -q --report=checkstyle 2>/dev/null | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml.dist\"]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

tests/code-check-phpcs-nodist/matrix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"include": [
33
{
44
"name": "PHPCodeSniffer [7.4, latest]",
5-
"job": "{\"command\":\"./vendor/bin/phpcs -q --report=checkstyle | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml\"]}",
5+
"job": "{\"command\":\"./vendor/bin/phpcs -q --report=checkstyle 2>/dev/null | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml\"]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

tests/code-check-phpcsfixer-php-dist/matrix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"include": [
33
{
44
"name": "PHP CS Fixer [7.4, latest]",
5-
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run --format=checkstyle | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
5+
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run --format=checkstyle 2>/dev/null | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

tests/code-check-phpcsfixer-php/matrix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"include": [
33
{
44
"name": "PHP CS Fixer [7.4, latest]",
5-
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run --format=checkstyle | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
5+
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run --format=checkstyle 2>/dev/null | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

tests/code-check-twig-cs-fixer-php-dist/matrix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"include": [
33
{
44
"name": "Twig CS Fixer [7.4, latest]",
5-
"job": "{\"command\":\"./vendor/bin/twig-cs-fixer lint --report checkstyle | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
5+
"job": "{\"command\":\"./vendor/bin/twig-cs-fixer lint --report checkstyle 2>/dev/null | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

tests/code-check-twig-cs-fixer-php/matrix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"include": [
33
{
44
"name": "Twig CS Fixer [7.4, latest]",
5-
"job": "{\"command\":\"./vendor/bin/twig-cs-fixer lint --report checkstyle | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
5+
"job": "{\"command\":\"./vendor/bin/twig-cs-fixer lint --report checkstyle 2>/dev/null | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

0 commit comments

Comments
 (0)