-
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move configuration-y bits to /generator/config
- Loading branch information
Showing
10 changed files
with
140 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
return function (string $text): bool { | ||
if (preg_match('/an\s+empty\s+string\s+on\s+error/', $text)) { | ||
return true; | ||
} | ||
|
||
return false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
return function (string $text): bool { | ||
$falsies = [ | ||
'/[Tt]he function returns &false;/m', | ||
'/&false;\s+on\s+error/m', | ||
'/&false;\s+on\s+failure/m', | ||
'/&false;\s+if\s+an\s+error\s+occurred/m', | ||
'/&return.success;/m', | ||
'/&return.nullorfalse;/m', | ||
'/&return.falseforfailure;/m', | ||
'/&date.datetime.return.modifiedobjectorfalseforfailure;/m', | ||
'/ or &false; \\(and generates an error/m', | ||
'/&false;\s+if\s+the\s+number\s+of\s+elements\s+for\s+each\s+array\s+isn\'t\s+equal/m', | ||
'/If\s+the\s+call\s+fails,\s+it\s+will\s+return\s+&false;/m', | ||
'/Upon\s+failure,?\s+\<function\>[\w_]{1,15}?\<\/function\>\s+returns\s+&false;/m', | ||
'/On\s+failure,\s+&false;\s+is\s+returned/m', | ||
'/on\s+success,\s+otherwise\s+&false;\s+is\s+returned/m', | ||
'/Returns.*on success[.\s\S]+Returns &false;\s+if/m', | ||
'/&gd\.return\.identifier;/m', | ||
'/If a non-numeric value is used for\s+\<parameter\>timestamp\<\/parameter\>, &false; is returned/m', // date | ||
'/&false; is returned if\s+the image type is unsupported, the data is not in a recognised format,\s+or the image is corrupt and cannot be loaded/m', // imagecreatefromstring | ||
"/&false; when the given class doesn't exist/m", // class_implements | ||
"/&false; on failure/m" , // get_headers and ldap_search | ||
"/&false; if a syntactically invalid/m", // inet_pton | ||
"/&false; if the pipe\s+cannot be established/m", // shell_exec | ||
"/&false; if an error occurs/m", // cfg_get_var | ||
"/On failure\s+returns &false;./m", // proc_open | ||
]; | ||
foreach ($falsies as $falsie) { | ||
if (preg_match($falsie, $text)) { | ||
return true; | ||
} | ||
} | ||
if (preg_match('/&false;\s+otherwise/m', $text) && !preg_match('/(returns\s+&true;|&true;\s+on\s+success|&true;\s+if)/im', $text)) { | ||
return true; | ||
} | ||
if (preg_match('/may\s+return\s+&false;/m', $text) && !preg_match('/(returns\s+&true;|&true;\s+on\s+success|&true;\s+if)/im', $text)) { | ||
return true; | ||
} | ||
|
||
return false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
return function (string $text): bool { | ||
if (preg_match('/&null;\s+on\s+failure/', $text)) { | ||
return true; | ||
} | ||
|
||
// used to detect old (8.1) versions of array_replace | ||
if (preg_match('/&null;\s+if\s+an\s+error\s+occurs/', $text)) { | ||
// skip a false positive for shell-exec (the docs mention that it | ||
// "returns null if an error occurs" _in the subprocess_ OR if the | ||
// subprocess returns nothing, and users should use `exec` if they | ||
// actually care about error handling) | ||
if (preg_match('/&null; if an error occurs or the program/', $text)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
return false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters