Skip to content

Commit

Permalink
feat(php): ignore multiple php extensions (#1225)
Browse files Browse the repository at this point in the history
* feat(php): ignore multiple php extensions

* feat(php): formatting

---------

Co-authored-by: Jake Runzer <jakerunzer@gmail.com>
  • Loading branch information
dnwjn and coffee-cup authored Nov 19, 2024
1 parent 9788ab0 commit 2d16cd9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/providers/php/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,13 @@ impl PhpProvider {
let composer_json: ComposerJson = app.read_json("composer.json")?;
let version = PhpProvider::get_php_version(app)?;
let mut extensions = Vec::new();
// ext-json is included by default in PHP >= 8.0 (and not available in Nix)
// ext-zend-opcache is included by default in PHP >= 5.5
let ignored_extensions = [String::from("ext-json"), String::from("ext-zend-opcache")];
for extension in composer_json.require.keys() {
// ext-json is included by default in PHP >= 8.0 (and not available in Nix) so skip over it
if extension.starts_with("ext-") && (version == "7.4" || extension != "ext-json") {
if extension.starts_with("ext-")
&& (version == "7.4" || !ignored_extensions.contains(extension))
{
extensions.push(
extension
.strip_prefix("ext-")
Expand Down

0 comments on commit 2d16cd9

Please sign in to comment.