Skip to content

Commit

Permalink
Merge pull request #84 from TysonAndre/release-2.1.0
Browse files Browse the repository at this point in the history
Release simdjson 2.1.0
  • Loading branch information
TysonAndre authored Oct 14, 2022
2 parents a860354 + ad454b7 commit aec72eb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ var_dump($res) //int(5)

```php
<?php

/**
* Similar to json_decode()
*
* @return array|stdClass|string|float|int|bool|null
* @throws RuntimeException for invalid JSON (or document over 4GB, or out of range integer/float)
* @throws SimdJsonException for invalid JSON
* (or document over 4GB, or out of range integer/float)
*/
function simdjson_decode(string $json, bool $assoc = false, int $depth = 512) {}

Expand All @@ -125,23 +127,39 @@ function simdjson_is_valid(string $json, int $depth = 512) : ?bool {}
* Parses $json and returns the number of keys in $json matching the JSON pointer $key
*
* @return ?int (null if depth is invalid)
* @throws SimdJsonException for invalid JSON
* (or document over 4GB, or out of range integer/float)
*/
function simdjson_key_count(string $json, string $key, int $depth = 512) : ?int {}

/**
* Returns true if the JSON pointer $key could be found.
*
* @return ?bool (null if depth is invalid, false if json is invalid or key is not found)
* @throws SimdJsonException for invalid JSON
* (or document over 4GB, or out of range integer/float)
*/
function simdjson_key_exists(string $json, string $key, int $depth = 512) : ?bool {}

/**
* Returns the value at $key
*
* @return array|stdClass|string|float|int|bool|null the value at $key
* @throws RuntimeException for invalid JSON (or document over 4GB, or out of range integer/float)
* @throws SimdJsonException for invalid JSON
* (or document over 4GB, or out of range integer/float)
*/
function simdjson_key_value(string $json, string $key, bool $assoc = unknown, int $depth = unknown) {}

/**
* An error thrown by simdjson when processing json.
*
* The error code is available as $e->getCode().
* This can be compared against the `SIMDJSON_ERR_*` constants.
*
* Before simdjson 2.1.0, a regular RuntimeException with an error code of 0 was thrown.
*/
class SimdJsonException extends RuntimeException {
}
```

## Edge cases
Expand Down
6 changes: 3 additions & 3 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
<active>yes</active>
</lead>
-->
<date>2022-10-12</date>
<date>2022-10-14</date>
<version>
<release>2.1.0dev</release>
<api>2.1.0dev</api>
<release>2.1.0</release>
<api>2.1.0</api>
</version>
<stability>
<release>stable</release>
Expand Down
2 changes: 1 addition & 1 deletion php_simdjson.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
extern zend_module_entry simdjson_module_entry;
#define phpext_simdjson_ptr &simdjson_module_entry

#define PHP_SIMDJSON_VERSION "2.1.0dev"
#define PHP_SIMDJSON_VERSION "2.1.0"
#define SIMDJSON_SUPPORT_URL "https://github.com/crazyxman/simdjson_php"
#define SIMDJSON_PARSE_FAIL 0
#define SIMDJSON_PARSE_SUCCESS 1
Expand Down

0 comments on commit aec72eb

Please sign in to comment.