Skip to content

Commit cb10731

Browse files
committed
chore(agent): [Step 1/4] fix PHPStan null-coalesce diagnostics
PLAN_REF: 6e65fe3 PREVIOUS_STEP: 6e65fe3 — initialized release-fix plan ## Completed in This Step - Removed impossible null-coalesce fallbacks from non-nullable AbstractProvider properties. - Removed impossible null-coalesce fallback from StatsParser size-unit match offset. - Verified the CI-equivalent local Composer script passes. ## References Used - CI run 25469111120 PHPStan output. - PHPStan nullCoalesce.property and nullCoalesce.offset diagnostics. ## Debts and Warnings - No behavioral change intended; this is a static-analysis cleanup. - make precommit skipped because this repository has no Makefile target available. - desloppify reported 100/100 scores but warned that phpstan tooling was unavailable inside desloppify. ## Progress (ref: 6e65fe3) - [x] Step 1: Inspect failing code and apply minimal static-analysis fixes. ← this commit - [x] Step 2: Run analysis and tests. - [ ] Step 3: Commit the fix. - [ ] Step 4: Create and push v4.1.1, then monitor CI. ## Next Step chore(agent): [Step 2/4] create and push v4.1.1
1 parent 6e65fe3 commit cb10731

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/Providers/AbstractProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected function validateConfig(array $flags): void
120120
if (! empty($missing)) {
121121
throw new InvalidArgumentException(sprintf(
122122
'Provider "%s" is missing required configuration: %s',
123-
$this->provider ?? 'unknown',
123+
$this->provider,
124124
implode(', ', $missing)
125125
));
126126
}
@@ -209,7 +209,7 @@ public function hasWarnings(): bool
209209
*/
210210
public function getRawFlags(): array
211211
{
212-
return $this->flags ?? [];
212+
return $this->flags;
213213
}
214214

215215
/**
@@ -229,7 +229,7 @@ public function extractSecrets(): array
229229
{
230230
$secrets = [];
231231

232-
foreach ($this->flags ?? [] as $key => $value) {
232+
foreach ($this->flags as $key => $value) {
233233
if (! is_string($value) || strlen($value) < 4) {
234234
continue;
235235
}

src/StatsParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public static function convertSizeToBytes(string $sizeStr): int
147147
}
148148

149149
$value = (float) $matches[1];
150-
$unit = strtoupper(($matches[2] ?? '') === '' ? 'B' : $matches[2]);
150+
$unit = strtoupper($matches[2] === '' ? 'B' : $matches[2]);
151151

152152
if (isset($units[$unit])) {
153153
return (int) ($value * (1024 ** $units[$unit]));

0 commit comments

Comments
 (0)