safe icon indicating copy to clipboard operation
safe copied to clipboard

All PHP functions, rewritten to throw exceptions instead of returning false

Results 109 safe issues
Sort by recently updated
recently updated
newest added

Hello, how can we type `scandir()` properly? Now it says it returns `array`. We can type it `list` instead.

The implementation for `imap_open` is incorrect. The generated function has the parameter `?array $params = null` which is incorrect because the `$params` parameter is only allowed to be array. The...

currently this lib has `inet_ntop` implementation, but there is no `inet_pton` implementation for this lib

Some functions can't be analyzed by `psalm` normally because they return union types examples are ` 'preg_replace', 'preg_replace_callback', ` what you can do add annotations like this ```php /** *...

`simplexml_load_string` will not return false, but will emits errors unless you are setting `libxml_use_internal_errors(true);` before. I am not sure this is necessarly something you want to handle. 🤔 To me...

enhancement

Hi, it looks like [current()](https://www.php.net/manual/en/function.current.php) is missing. Any plans to add it? Thanks!

enhancement
missing function

I wonder if it would be possible to add them. Both return either an int or false.

Hello, we have a custom error handler ``` set_error_handler(static function ($severity, $message, $file, $line): void { if (error_reporting() === 0) { /// @ sign temporary disabled error reporting return; }...

When calling `\Safe\file_get_contents("http://nonexistanturl.foo")` generates warning that cannot be caught. The problem is that file_get_contents not only returns FALSE on failure but can also generate warning. Supressing the warning by adding...

Ran into some code that was doing this: ```php while (@ob_end_clean()) {} ``` Safe defines `ob_end_clean` as a `void` return: https://github.com/thecodingmachine/safe/blob/master/generated/outcontrol.php#L22 However, `ob_end_clean` will return `true` when it successfully clears...