Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Translation] added option json_options to JsonFileDumper. #14750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

gepo
Copy link
Contributor

@gepo gepo commented May 25, 2015

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? no
Fixed tickets
License MIT
Doc PR

It's passed to json_encode function second argument.

@@ -23,9 +23,23 @@ class JsonFileDumper extends FileDumper
/**
* {@inheritdoc}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong docblock. This method isn't inherited from anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's 2.8 branch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry. Now I understand. Please forget about my next comment.

@aitboudad
Copy link
Contributor

can we found another name rather than json_options ?

@gepo gepo force-pushed the json_dumper_options branch from 07d3f8b to 0dd9365 Compare May 25, 2015 16:29
@gepo
Copy link
Contributor Author

gepo commented May 25, 2015

@aitboudad I will think about better name, just 'options' are even worse.

Other alternative is to add several options - one per JSON_* constants and hide from user, that this class use json_encode internally. But it would be hard to maintain such code.

@aitboudad
Copy link
Contributor

encode_options or bitmasks (an array of bitmask options) ?

@dosten
Copy link
Contributor

dosten commented May 25, 2015

@@ -23,9 +23,23 @@ class JsonFileDumper extends FileDumper
/**
* {@inheritdoc}
*/
protected function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
{
$jsonOptions = isset($options['json_options']) ? (int) $options['json_options'] : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer $flags instead of $jsonOptions

@aitboudad
Copy link
Contributor

@dosten 👍

@gepo gepo force-pushed the json_dumper_options branch from 0dd9365 to f1848b8 Compare May 25, 2015 17:56
@gepo
Copy link
Contributor Author

gepo commented May 25, 2015

@dosten 👍 apply

@gepo gepo force-pushed the json_dumper_options branch from f1848b8 to 52ab7b6 Compare May 25, 2015 17:58
@@ -23,9 +23,23 @@ class JsonFileDumper extends FileDumper
/**
* {@inheritdoc}
*/
protected function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
{
$flags = isset($options['flags']) ? (int) $options['flags'] : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, the variable name must be $flags but the option name must be "json_encoding"

@gepo gepo force-pushed the json_dumper_options branch 2 times, most recently from 8a92e11 to fb11aac Compare May 25, 2015 22:41
@gepo
Copy link
Contributor Author

gepo commented May 25, 2015

@dosten done

@dosten
Copy link
Contributor

dosten commented May 26, 2015

You should fix the two failing tests

@gepo gepo force-pushed the json_dumper_options branch from fb11aac to e4a6317 Compare June 1, 2015 21:02
@gepo
Copy link
Contributor Author

gepo commented Jun 1, 2015

sorry, missed your message. Done

@dosten
Copy link
Contributor

dosten commented Jun 1, 2015

👍

@aitboudad aitboudad added the Ready label Jun 2, 2015
@aitboudad
Copy link
Contributor

ping @symfony/deciders

$flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;

if (defined('JSON_PRETTY_PRINT')) {
$flags |= JSON_PRETTY_PRINT;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we really force it all them time, even when encoding options are specified ? this forbids disabling the pretty printing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gepo any change to fix this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrite this code, do not force pretty print now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sound good to me thanks ^^

@aitboudad aitboudad removed the Ready label Jun 3, 2015
It's passed to json_encode function second argument.
@gepo gepo force-pushed the json_dumper_options branch from e4a6317 to 3a3496b Compare July 6, 2015 06:58
@aitboudad aitboudad added the Ready label Jul 6, 2015
@xabbuh
Copy link
Member

xabbuh commented Jul 7, 2015

Is there a reason to modify the existing test instead of adding an extra one that uses custom options? If I don't miss anything we wouldn't have a test for the default options anymore.

@aitboudad aitboudad removed the Ready label Sep 2, 2015
@aitboudad
Copy link
Contributor

@gepo Do you have a little time to fix the latest remark :) ?

@aitboudad
Copy link
Contributor

Closing in favor of #15756

@aitboudad aitboudad closed this Sep 10, 2015
aitboudad added a commit that referenced this pull request Sep 11, 2015
…per. (gepo)

This PR was merged into the 2.8 branch.

Discussion
----------

[Translation] added option json_options to JsonFileDumper.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | ~
| License       | MIT
| Doc PR        |

Replaces #14750

Commits
-------

bfdc354 [Translation] added option flags to JsonFileDumper. It's passed to json_encode function second argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants