Skip to content

Commit 8fc6146

Browse files
committed
Check if file exists instead of suppressing the exception
1 parent aaa7c61 commit 8fc6146

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Configurator/AbstractConfigurator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,14 @@ protected function markXmlData(Recipe $recipe, string $data): string
7575
*/
7676
protected function updateData(string $file, string $data): bool
7777
{
78+
if (!file_exists($file)) {
79+
return false;
80+
}
81+
7882
$pieces = explode("\n", trim($data));
7983
$startMark = trim(reset($pieces));
8084
$endMark = trim(end($pieces));
81-
$contents = @file_get_contents($file);
85+
$contents = file_get_contents($file);
8286

8387
if (false === strpos($contents, $startMark) || false === strpos($contents, $endMark)) {
8488
return false;

0 commit comments

Comments
 (0)