Skip to content

Commit

Permalink
Use some PHP 5.4 constants unconditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyweb committed Mar 5, 2020
1 parent 3a8da96 commit 0caf947
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Expand Up @@ -243,9 +243,9 @@ public function humanize($text)
public function formEncodeCurrency($text, $widget = '')
{
if ('UTF-8' === $charset = $this->getCharset()) {
$text = htmlspecialchars($text, ENT_QUOTES | (\defined('ENT_SUBSTITUTE') ? ENT_SUBSTITUTE : 0), 'UTF-8');
$text = htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
} else {
$text = htmlentities($text, ENT_QUOTES | (\defined('ENT_SUBSTITUTE') ? ENT_SUBSTITUTE : 0), 'UTF-8');
$text = htmlentities($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
$text = iconv('UTF-8', $charset, $text);
$widget = iconv('UTF-8', $charset, $widget);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Form/FormRenderer.php
Expand Up @@ -291,9 +291,9 @@ public function humanize($text)
public function encodeCurrency(Environment $environment, $text, $widget = '')
{
if ('UTF-8' === $charset = $environment->getCharset()) {
$text = htmlspecialchars($text, ENT_QUOTES | (\defined('ENT_SUBSTITUTE') ? ENT_SUBSTITUTE : 0), 'UTF-8');
$text = htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
} else {
$text = htmlentities($text, ENT_QUOTES | (\defined('ENT_SUBSTITUTE') ? ENT_SUBSTITUTE : 0), 'UTF-8');
$text = htmlentities($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
$text = iconv('UTF-8', $charset, $text);
$widget = iconv('UTF-8', $charset, $widget);
}
Expand Down
Expand Up @@ -28,7 +28,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
if (isset($options['json_encoding'])) {
$flags = $options['json_encoding'];
} else {
$flags = \defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
$flags = JSON_PRETTY_PRINT;
}

return json_encode($messages->all($domain), $flags);
Expand Down

0 comments on commit 0caf947

Please sign in to comment.