Skip to content

Commit bdc0e69

Browse files
committed
Composer Require Checker
1 parent 4958ea0 commit bdc0e69

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,33 @@ jobs:
9999
name: 'Check coding standard'
100100
run: 'bin/phing create-dirs cs || cat build/log/phpcs-checkstyle.xml | cs2pr'
101101

102+
composer-require-checker:
103+
name: 'Composer require check'
104+
needs: 'lint'
105+
runs-on: 'ubuntu-latest'
106+
107+
steps:
108+
-
109+
name: 'Checkout'
110+
uses: 'actions/checkout@v3.3.0'
111+
-
112+
name: 'Setup PHP ${{ env.CONSISTENCE_PHP_VERSION }}'
113+
uses: 'shivammathur/setup-php@2.24.0'
114+
with:
115+
php-version: '${{ env.CONSISTENCE_PHP_VERSION }}'
116+
coverage: 'none'
117+
-
118+
name: 'Setup problem matchers for PHP'
119+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
120+
-
121+
name: 'Composer install'
122+
uses: 'ramsey/composer-install@2.2.0'
123+
with:
124+
dependency-versions: 'highest'
125+
-
126+
name: 'Check missing Composer requires'
127+
run: 'bin/phing composer-require-checker'
128+
102129
tests:
103130
name: 'Tests - PHP ${{ matrix.php-version }}, ${{ matrix.composer-dependencies }} dependencies'
104131
needs: 'lint'

build.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<property name="path.bin" value="${path.root}/bin"/>
1212
<property name="path.build.log" value="${path.build}/log"/>
1313
<property name="path.composer.executable" value="composer"/>
14+
<property name="path.composer-require-checker.executable" value="${path.bin}/composer-require-checker"/>
1415
<property name="path.phpcs.executable" value="${path.bin}/phpcs"/>
1516
<property name="path.phpcs.ruleset" value="${path.build}/cs-ruleset.xml"/>
1617
<property name="path.phplint.executable" value="${path.bin}/parallel-lint"/>
@@ -28,7 +29,8 @@
2829
composer,
2930
phplint,
3031
cs,
31-
tests
32+
tests,
33+
composer-require-checker
3234
"/>
3335

3436
<target name="composer" depends="composer-validate">
@@ -42,6 +44,17 @@
4244
</exec>
4345
</target>
4446

47+
<target name="composer-require-checker">
48+
<exec
49+
executable="${path.composer-require-checker.executable}"
50+
logoutput="true"
51+
passthru="true"
52+
checkreturn="true"
53+
>
54+
<arg value="--config-file=${path.build}/composer-require-checker.json"/>
55+
</exec>
56+
</target>
57+
4558
<target name="composer-validate">
4659
<exec
4760
executable="${path.composer.executable}"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"php-core-extensions" : [
3+
"Core",
4+
"Phar",
5+
"Reflection",
6+
"SPL",
7+
"date",
8+
"pcre",
9+
"standard"
10+
],
11+
"scan-files" : [],
12+
"symbol-whitelist" : [
13+
"PHP_CodeSniffer\\Sniffs\\AbstractVariableSniff",
14+
"PHP_CodeSniffer\\Sniffs\\Sniff",
15+
"PHP_CodeSniffer\\Files\\File",
16+
"PHP_CodeSniffer\\Util\\Common",
17+
"array",
18+
"bool",
19+
"callable",
20+
"false",
21+
"float",
22+
"int",
23+
"iterable",
24+
"null",
25+
"object",
26+
"parent",
27+
"self",
28+
"static",
29+
"string",
30+
"true",
31+
"void"
32+
]
33+
}

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
],
1313
"require": {
1414
"php": "~7.2",
15+
"ext-tokenizer": "*",
1516
"squizlabs/php_codesniffer": "~3.5.5",
1617
"slevomat/coding-standard": "~6.0"
1718
},
1819
"require-dev": {
1920
"phing/phing": "2.17.2",
21+
"maglnet/composer-require-checker": "2.0",
2022
"php-parallel-lint/php-console-highlighter": "1.0",
2123
"php-parallel-lint/php-parallel-lint": "1.3.2",
2224
"phpunit/phpunit": "8.5.25"

0 commit comments

Comments
 (0)