Aplicar Pint e formatação de frontend; delimitar o âmbito do lint
Só formatação automática (pint, vp check --fix), sem alterar comportamento. Excluídos da formatação os registos e artefactos com bytes fixos: docs/, integrations/, storage/, tmp/, output/, resources/data/, tests/Fixtures/, compras-release.json e AGENTS*.md. Scripts operacionais, integrations e auxiliares de teste ficam fora do lint (usam new Function; limpeza na fase 2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,24 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Enums\PurchasingRole;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tempo\Inventory\IssueMovementWriter;
|
||||
|
||||
final class StockIssueMovement
|
||||
{
|
||||
public function for(User $actor): \Tempo\Inventory\IssueMovementWriter
|
||||
public function for(User $actor): IssueMovementWriter
|
||||
{
|
||||
$root=base_path('packages/inventory-issue/releases/0.1.0');
|
||||
$bytes=is_file($root.'/manifest.json')?file_get_contents($root.'/manifest.json'):false;
|
||||
if(!is_string($bytes)||!hash_equals('3c24d9e9fb99bfbb274077495c3a42ddb7eccab06b5c6a956cd739b2bc9b56f0',hash('sha256',$bytes)))throw new \LogicException('Pacote de saída incompatível.');
|
||||
$m=json_decode($bytes,true,512,JSON_THROW_ON_ERROR);
|
||||
foreach(['bootstrap.php','src/IssueMovementWriter.php'] as $f) {
|
||||
$actual=is_file($root.'/'.$f)?hash_file('sha256',$root.'/'.$f):false;
|
||||
if(!is_string($actual)||!hash_equals($m['files'][$f]??'',$actual))throw new \LogicException('Pacote de saída alterado.');
|
||||
$root = base_path('packages/inventory-issue/releases/0.1.0');
|
||||
$bytes = is_file($root.'/manifest.json') ? file_get_contents($root.'/manifest.json') : false;
|
||||
if (! is_string($bytes) || ! hash_equals('3c24d9e9fb99bfbb274077495c3a42ddb7eccab06b5c6a956cd739b2bc9b56f0', hash('sha256', $bytes))) {
|
||||
throw new \LogicException('Pacote de saída incompatível.');
|
||||
}
|
||||
$m = json_decode($bytes, true, 512, JSON_THROW_ON_ERROR);
|
||||
foreach (['bootstrap.php', 'src/IssueMovementWriter.php'] as $f) {
|
||||
$actual = is_file($root.'/'.$f) ? hash_file('sha256', $root.'/'.$f) : false;
|
||||
if (! is_string($actual) || ! hash_equals($m['files'][$f] ?? '', $actual)) {
|
||||
throw new \LogicException('Pacote de saída alterado.');
|
||||
}
|
||||
}
|
||||
require_once $root.'/bootstrap.php';
|
||||
$schema=match(DB::connection()->getDriverName()){'pgsql'=>'public','sqlite'=>'main','mysql','mariadb'=>DB::connection()->getDatabaseName(),default=>throw new \LogicException('Driver não suportado.')};
|
||||
return new \Tempo\Inventory\IssueMovementWriter(DB::connection(),$schema,(int)$actor->tenant_id,(int)$actor->id,function()use($actor){app(CurrentActor::class)->lock($actor,[PurchasingRole::Warehouse]);});
|
||||
$schema = match (DB::connection()->getDriverName()) {
|
||||
'pgsql' => 'public','sqlite' => 'main','mysql','mariadb' => DB::connection()->getDatabaseName(),default => throw new \LogicException('Driver não suportado.')
|
||||
};
|
||||
|
||||
return new IssueMovementWriter(DB::connection(), $schema, (int) $actor->tenant_id, (int) $actor->id, function () use ($actor) {
|
||||
app(CurrentActor::class)->lock($actor, [PurchasingRole::Warehouse]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user