Skip to content

Commit

Permalink
Merge pull request #351 from vjik/fix
Browse files Browse the repository at this point in the history
Add `json` to core extensions and minor improvements
  • Loading branch information
Ocramius authored Jul 6, 2022
2 parents e737b9f + b79447d commit 4d18781
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
],
"require": {
"php": "^8.0",
"ext-json": "*",
"ext-phar": "*",
"composer-runtime-api": "^2.0.0",
"nikic/php-parser": "^4.13.0",
Expand All @@ -49,7 +48,8 @@
"optimize-autoloader": true,
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"infection/extension-installer": true
}
},
"extra": {
Expand Down
1 change: 1 addition & 0 deletions data/config.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"php-core-extensions" : [
"Core",
"date",
"json",
"pcre",
"Phar",
"Reflection",
Expand Down
1 change: 1 addition & 0 deletions src/ComposerRequireChecker/Cli/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Options
private array $phpCoreExtensions = [
'Core',
'date',
'json',
'pcre',
'Phar',
'Reflection',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use function array_merge;
use function file_get_contents;
use function json_decode;
use function strpos;
use function str_starts_with;
use function substr;

class DefinedExtensionsResolver
Expand All @@ -32,7 +32,7 @@ public function __invoke(string $composerJson, array $phpCoreExtensions = []): a
continue;
}

if (strpos($require, 'ext-') !== 0) {
if (! str_starts_with($require, 'ext-')) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __invoke(string $symbolName): Generator
continue;
}

if ($this->coreExtensions && in_array($extensionName, $this->coreExtensions)) {
if ($this->coreExtensions && in_array($extensionName, $this->coreExtensions, true)) {
yield 'php';
}

Expand Down

0 comments on commit 4d18781

Please sign in to comment.