<?php
declare(strict_types=1);
$pairs=[['app/terminal/model/meal/Meal.php',$argv[1]??'',$argv[2]??'','bac789fb4be272f3be84fc82cc7e3b8497cb11643092412e19cd953edf1d8558','84cf5e96b8d968e7bb2c59927688d999400df280fbba329556b17b8cad3cb1e9'],['app/terminal/service/meal/Meal.php',$argv[3]??'',$argv[4]??'','a6aa6081b78d77c8c4feb117ef36976bb2b6974b6adaf0ee037d372a0da9a657','d818cffc6ace67ba3fcb108b8da3d4ff760574b9c38a84e5e71312edc77ca632']];$patch='';foreach($pairs as [$rel,$old,$new,$wantOld,$wantNew]){if(hash_file('sha256',$old)!==$wantOld||hash_file('sha256',$new)!==$wantNew)throw new RuntimeException('Exact frozen candidate source SHA');$p=proc_open(['diff','-u','--label','a/'.$rel,'--label','b/'.$rel,$old,$new],[0=>STDIN,1=>['pipe','w'],2=>STDERR],$pipes);$text=stream_get_contents($pipes[1]);fclose($pipes[1]);if(proc_close($p)!==1||$text==='')throw new RuntimeException('Exact diff generator failed');$patch.=$text;}file_put_contents(__DIR__.'/MealInfosProjectionCandidate.patch',$patch);echo json_encode(['patch_sha256'=>hash('sha256',$patch),'target_files'=>array_column($pairs,0)]),"\n";
