Skip to content

Commit 88b86d3

Browse files
committed
Fix artifact downloade does not accept boolean options bug
1 parent dbc6dbe commit 88b86d3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/StaticPHP/Artifact/ArtifactDownloader.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function __construct(protected array $options = [])
113113
foreach ($ls as $name) {
114114
$this->fetch_prefs[$name] = Artifact::FETCH_PREFER_SOURCE;
115115
}
116-
} elseif ($options['prefer-source'] === null) {
116+
} elseif ($options['prefer-source'] === null || $options['prefer-source'] === true) {
117117
$this->default_fetch_pref = Artifact::FETCH_PREFER_SOURCE;
118118
}
119119
}
@@ -124,7 +124,7 @@ public function __construct(protected array $options = [])
124124
foreach ($ls as $name) {
125125
$this->fetch_prefs[$name] = Artifact::FETCH_PREFER_BINARY;
126126
}
127-
} elseif ($options['prefer-binary'] === null) {
127+
} elseif ($options['prefer-binary'] === null || $options['prefer-binary'] === true) {
128128
$this->default_fetch_pref = Artifact::FETCH_PREFER_BINARY;
129129
}
130130
}
@@ -134,7 +134,7 @@ public function __construct(protected array $options = [])
134134
foreach ($ls as $name) {
135135
$this->fetch_prefs[$name] = Artifact::FETCH_PREFER_BINARY;
136136
}
137-
} elseif ($options['prefer-pre-built'] === null) {
137+
} elseif ($options['prefer-pre-built'] === null || $options['prefer-pre-built'] === true) {
138138
$this->default_fetch_pref = Artifact::FETCH_PREFER_BINARY;
139139
}
140140
}
@@ -145,7 +145,7 @@ public function __construct(protected array $options = [])
145145
foreach ($ls as $name) {
146146
$this->fetch_prefs[$name] = Artifact::FETCH_ONLY_SOURCE;
147147
}
148-
} elseif ($options['source-only'] === null) {
148+
} elseif ($options['source-only'] === null || $options['source-only'] === true) {
149149
$this->default_fetch_pref = Artifact::FETCH_ONLY_SOURCE;
150150
}
151151
}
@@ -156,23 +156,23 @@ public function __construct(protected array $options = [])
156156
foreach ($ls as $name) {
157157
$this->fetch_prefs[$name] = Artifact::FETCH_ONLY_BINARY;
158158
}
159-
} elseif ($options['binary-only'] === null) {
159+
} elseif ($options['binary-only'] === null || $options['binary-only'] === true) {
160160
$this->default_fetch_pref = Artifact::FETCH_ONLY_BINARY;
161161
}
162162
}
163163
// Ignore cache
164164
if (array_key_exists('ignore-cache', $options)) {
165165
if (is_string($options['ignore-cache'])) {
166166
$this->ignore_cache = parse_comma_list($options['ignore-cache']);
167-
} elseif ($options['ignore-cache'] === null) {
167+
} elseif ($options['ignore-cache'] === null || $options['ignore-cache'] === true) {
168168
$this->ignore_cache = true;
169169
}
170170
}
171171
// backward compatibility for ignore-cache-sources
172172
if (array_key_exists('ignore-cache-sources', $options)) {
173173
if (is_string($options['ignore-cache-sources'])) {
174174
$this->ignore_cache = parse_comma_list($options['ignore-cache-sources']);
175-
} elseif ($options['ignore-cache-sources'] === null) {
175+
} elseif ($options['ignore-cache-sources'] === null || $options['ignore-cache-sources'] === true) {
176176
$this->ignore_cache = true;
177177
}
178178
}

0 commit comments

Comments
 (0)