3636 PHP_85_VERSION_ID ,
3737];
3838
39+ // file_put_contents() but with a success message printed after saving
40+ function reportFilePutContents (string $ filename , string $ content ): void {
41+ if (file_put_contents ($ filename , $ content )) {
42+ echo "Saved $ filename \n" ;
43+ }
44+ }
45+
3946/**
4047 * @return FileInfo[]
4148 */
@@ -121,8 +128,8 @@ function processStubFile(string $stubFile, Context $context, bool $includeOnly =
121128 $ context ->allConstInfos ,
122129 $ stubHash
123130 );
124- if (( $ context ->forceRegeneration || $ stubHash !== $ oldStubHash) && file_put_contents ( $ arginfoFile , $ arginfoCode ) ) {
125- echo " Saved $ arginfoFile\n" ;
131+ if ($ context ->forceRegeneration || $ stubHash !== $ oldStubHash ) {
132+ reportFilePutContents ( $ arginfoFile, $ arginfoCode ) ;
126133 }
127134
128135 if ($ fileInfo ->shouldGenerateLegacyArginfo ()) {
@@ -146,8 +153,8 @@ function processStubFile(string $stubFile, Context $context, bool $includeOnly =
146153 $ context ->allConstInfos ,
147154 $ stubHash
148155 );
149- if (( $ context ->forceRegeneration || $ stubHash !== $ oldStubHash) && file_put_contents ( $ legacyFile , $ arginfoCode ) ) {
150- echo " Saved $ legacyFile\n" ;
156+ if ($ context ->forceRegeneration || $ stubHash !== $ oldStubHash ) {
157+ reportFilePutContents ( $ legacyFile, $ arginfoCode ) ;
151158 }
152159 }
153160
@@ -6290,9 +6297,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc
62906297
62916298 if ($replacePredefinedConstants) {
62926299 foreach ($predefinedConstants as $filename => $content) {
6293- if (file_put_contents($filename, $content)) {
6294- echo "Saved $filename\n";
6295- }
6300+ reportFilePutContents($filename, $content);
62966301 }
62976302 }
62986303}
@@ -6307,9 +6312,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc
63076312 }
63086313
63096314 foreach ($classSynopses as $filename => $content) {
6310- if (file_put_contents("$classSynopsesDirectory/$filename", $content)) {
6311- echo "Saved $filename\n";
6312- }
6315+ reportFilePutContents("$classSynopsesDirectory/$filename", $content);
63136316 }
63146317 }
63156318}
@@ -6319,9 +6322,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc
63196322
63206323 if ($replaceClassSynopses) {
63216324 foreach ($classSynopses as $filename => $content) {
6322- if (file_put_contents($filename, $content)) {
6323- echo "Saved $filename\n";
6324- }
6325+ reportFilePutContents($filename, $content);
63256326 }
63266327 }
63276328}
@@ -6340,9 +6341,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc
63406341 mkdir(dirname($path));
63416342 }
63426343
6343- if (file_put_contents($path, $content)) {
6344- echo "Saved $filename\n";
6345- }
6344+ reportFilePutContents($path, $content);
63466345 }
63476346 }
63486347}
@@ -6352,9 +6351,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc
63526351
63536352 if ($replaceMethodSynopses) {
63546353 foreach ($methodSynopses as $filename => $content) {
6355- if (file_put_contents($filename, $content)) {
6356- echo "Saved $filename\n";
6357- }
6354+ reportFilePutContents($filename, $content);
63586355 }
63596356 }
63606357}
@@ -6363,9 +6360,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc
63636360 $filename = dirname(__FILE__, 2) . "/Zend/Optimizer/zend_func_infos.h";
63646361 $optimizerInfo = generateOptimizerInfo($funcMap);
63656362
6366- if (file_put_contents($filename, $optimizerInfo)) {
6367- echo "Saved $filename\n";
6368- }
6363+ reportFilePutContents($filename, $optimizerInfo);
63696364}
63706365
63716366if ($verifyManual) {
0 commit comments