Skip to content

Commit

Permalink
minor #5644 Token::toJson() - remove parameter (keradus)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.0 branch.

Discussion
----------

Token::toJson() - remove parameter

follows #5642

Commits
-------

051439c Token::toJson() - remove parameter
  • Loading branch information
keradus committed Apr 18, 2021
2 parents 826e113 + 051439c commit 594df2c
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/Tokenizer/Token.php
Expand Up @@ -462,26 +462,9 @@ public function toArray(): array
];
}

/**
* @param null|string[] $options JSON encode option
*/
public function toJson(?array $options = null): string
public function toJson(): string
{
if (null !== $options) {
Utils::triggerDeprecation(sprintf('Arguments of "%s()" is deprecated since 2.19 and will be removed in 3.0.', __METHOD__));
}

static $defaultOptions = null;

if (null === $options) {
if (null === $defaultOptions) {
$defaultOptions = Utils::calculateBitmask(['JSON_PRETTY_PRINT', 'JSON_NUMERIC_CHECK']);
}

$options = $defaultOptions;
} else {
$options = Utils::calculateBitmask($options);
}
$options = Utils::calculateBitmask(['JSON_PRETTY_PRINT', 'JSON_NUMERIC_CHECK']);

$jsonResult = json_encode($this->toArray(), $options);

Expand Down

0 comments on commit 594df2c

Please sign in to comment.