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

``` /** * Retrieve last error from libxml. * * @return \LibXMLError Returns a LibXMLError object if there is any error in the * buffer, FALSE otherwise. * @throws LibxmlException...

# Summary Since PHP 7.3.0, the `json_encode` and `json_decode` functions have a `JSON_THROW_ON_ERROR` to be set in order to throw an exception instead of returning `false` in case of error....

I like to use named arguments with `\json_decode()`, particularly with the `associative` argument. e.g. `\json_decode($json, associative: true);` Switching to use `thecodingmachine/safe` currently necessitates switching `associative` to `assoc`. This slows down...

Hi! This is more of a request rather than a feature/bug. Recently I included this package in [PHP-Scoper](https://github.com/humbug/php-scoper) and I encountered a few issues... Indeed, PHP-Scoper changes the namespace, and...

It's very well explained in this comment: https://github.com/phpstan/phpstan-src/pull/2693#issuecomment-1784026934 TLDR the functionMap is not always correct. Safe should consider multiple resources for codegeneration.

generator

Php 8.0 will be EOLed in one month.

Phpstan defines multiple variants now which breaks it for Safe https://github.com/phpstan/phpstan-src/blob/80ce9a404787133ff3fa266f90602728bf1c349c/resources/functionMap.php#L410-L411

(except datetime and gmp modules) Datetime can be generated after https://github.com/phpstan/phpstan-src/pull/2693 Gmp is not generated with my php for some reason