Corrigir os dois erros do PHPStan

- private-audit: env() pode devolver bool; só descodifica JSON quando é texto.
- migração de rascunhos: recriar triggers SQLite com DB::statement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 23:01:36 +02:00
co-authored by Claude Opus 5.5
parent d652b03467
commit 7615accf07
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -1,7 +1,11 @@
<?php <?php
$legacyTransitions = env('COMPRAS_AUDIT_LEGACY_TRANSITIONS', '{}');
return [ return [
'qa_enabled' => false, 'qa_enabled' => false,
// Explicit installation transition receipt: tenant => immutable export ID => original SHA-256. // Explicit installation transition receipt: tenant => immutable export ID => original SHA-256.
'legacy_export_transitions' => json_decode(env('COMPRAS_AUDIT_LEGACY_TRANSITIONS', '{}'), true, 32, JSON_THROW_ON_ERROR), 'legacy_export_transitions' => is_string($legacyTransitions) && $legacyTransitions !== ''
? json_decode($legacyTransitions, true, 32, JSON_THROW_ON_ERROR)
: [],
]; ];
@@ -61,7 +61,8 @@ return new class extends Migration
{ {
foreach ($triggers as $name => $sql) { foreach ($triggers as $name => $sql) {
if (! DB::table('sqlite_master')->where('type', 'trigger')->where('name', $name)->exists()) { if (! DB::table('sqlite_master')->where('type', 'trigger')->where('name', $name)->exists()) {
DB::unprepared($sql); // Re-create the trigger exactly as SQLite stored it before the table rebuild.
DB::statement($sql);
} }
} }
} }