@@ -49,6 +49,9 @@ private function getIsDeprecated(string $file): bool
49
49
public function detectFalsyFunction (): bool
50
50
{
51
51
$ file = file_get_contents ($ this ->path );
52
+ if ($ file === false ) {
53
+ throw new \RuntimeException ('An error occured while reading ' .$ this ->path );
54
+ }
52
55
53
56
if ($ this ->getIsDeprecated ($ file )) {
54
57
return false ;
@@ -116,6 +119,9 @@ public function detectFalsyFunction(): bool
116
119
public function detectNullsyFunction (): bool
117
120
{
118
121
$ file = \file_get_contents ($ this ->path );
122
+ if ($ file === false ) {
123
+ throw new \RuntimeException ('An error occured while reading ' .$ this ->path );
124
+ }
119
125
120
126
if ($ this ->getIsDeprecated ($ file )) {
121
127
return false ;
@@ -141,6 +147,9 @@ public function getMethodSynopsis(): array
141
147
$ cleanedFunctions = [];
142
148
143
149
$ file = \file_get_contents ($ this ->path );
150
+ if ($ file === false ) {
151
+ throw new \RuntimeException ('An error occured while reading ' .$ this ->path );
152
+ }
144
153
if (!preg_match_all ('/<\/?methodsynopsis[\s\S]*?>[\s\S]*?<\/methodsynopsis>/m ' , $ file , $ functions , PREG_SET_ORDER , 0 )) {
145
154
return [];
146
155
}
@@ -171,6 +180,9 @@ public function getMethodSynopsis(): array
171
180
public function loadAndResolveFile (): \SimpleXMLElement
172
181
{
173
182
$ content = \file_get_contents ($ this ->path );
183
+ if ($ content === false ) {
184
+ throw new \RuntimeException ('An error occured while reading ' .$ this ->path );
185
+ }
174
186
$ strpos = \strpos ($ content , '?> ' )+2 ;
175
187
if (!\file_exists (__DIR__ .'/../doc/entities/generated.ent ' )) {
176
188
self ::buildEntities ();
@@ -237,10 +249,10 @@ private function arrayFlatten(array $array): array
237
249
238
250
public static function buildEntities (): void
239
251
{
240
- $ file1 = \file_get_contents (__DIR__ .'/../doc/doc-en/en/language-defs.ent ' );
241
- $ file2 = \file_get_contents (__DIR__ .'/../doc/doc-en/en/language-snippets.ent ' );
242
- $ file3 = \file_get_contents (__DIR__ .'/../doc/doc-en/en/extensions.ent ' );
243
- $ file4 = \file_get_contents (__DIR__ .'/../doc/doc-en/doc-base/entities/global.ent ' );
252
+ $ file1 = \file_get_contents (__DIR__ .'/../doc/doc-en/en/language-defs.ent ' ) ?: '' ;
253
+ $ file2 = \file_get_contents (__DIR__ .'/../doc/doc-en/en/language-snippets.ent ' ) ?: '' ;
254
+ $ file3 = \file_get_contents (__DIR__ .'/../doc/doc-en/en/extensions.ent ' ) ?: '' ;
255
+ $ file4 = \file_get_contents (__DIR__ .'/../doc/doc-en/doc-base/entities/global.ent ' ) ?: '' ;
244
256
245
257
$ completeFile = $ file1 . self ::extractXmlHeader ($ file2 ) . self ::extractXmlHeader ($ file3 ) . $ file4 ;
246
258
0 commit comments