Skip to content

Commit dfc94ff

Browse files
committed
Check for required extensions in the script itself instead of composer.json
1 parent e2781d9 commit dfc94ff

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

bin/phpcs-check-doc-examples

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,22 @@
2020

2121
if (PHP_VERSION_ID < 70000) {
2222
$error = 'ERROR: This script requires PHP version 7.0.0 or greater.' . PHP_EOL;
23-
fwrite(STDERR, $error);
23+
\fwrite(STDERR, $error);
2424
exit(1);
2525
}
2626

27+
if (\extension_loaded('libxml') === false) {
28+
$error = 'ERROR: This script requires the libxml extension.' . PHP_EOL;
29+
\fwrite(STDERR, $error);
30+
exit(1);
31+
}
32+
33+
if (\extension_loaded('dom') === false) {
34+
$error = 'ERROR: This script requires the DOM extension.' . PHP_EOL;
35+
\fwrite(STDERR, $error);
36+
exit(1);
37+
}
38+
2739
require_once __DIR__ . '/../Scripts/DocCodeExamples/Functions.php';
2840

2941
$devToolsAutoloadLocations = [

composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
"require" : {
2525
"php" : ">=5.4",
2626
"squizlabs/php_codesniffer" : "^3.1.0",
27-
"dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0",
28-
"ext-dom": "*",
29-
"ext-libxml": "*"
27+
"dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0"
3028
},
3129
"require-dev" : {
3230
"roave/security-advisories" : "dev-master",

0 commit comments

Comments
 (0)