Skip to content

Commit

Permalink
FLOAT_AS_STRING -> FLOATS_AS_STRINGS
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrov committed Mar 5, 2018
1 parent 8f7a876 commit 9194f17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/JsonReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class JsonReader
const END_OBJECT = "END_OBJECT";

/* Options */
const FLOAT_AS_STRING = 0b00000001;
const FLOATS_AS_STRINGS = 0b00000001;

/**
* @var Parser|null
Expand Down Expand Up @@ -278,7 +278,7 @@ private function buildTree(string $type, bool $writeCache): array
private function castNumber(string $number)
{
$cast = +$number;
if (($this->options & self::FLOAT_AS_STRING) && \is_float($cast)) {
if (($this->options & self::FLOATS_AS_STRINGS) && \is_float($cast)) {
return $number;
}
return $cast;
Expand Down
2 changes: 1 addition & 1 deletion test/JsonReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function testReadWithOptionFloatAsString()
[JsonReader::END_OBJECT, null, null, 0],
];

$reader = new JsonReader(JsonReader::FLOAT_AS_STRING);
$reader = new JsonReader(JsonReader::FLOATS_AS_STRINGS);
$reader->init($this->parser);

$i = 0;
Expand Down

0 comments on commit 9194f17

Please sign in to comment.