Skip to content

Rename toolbar config to profiling #105

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

Merged
merged 1 commit into from
Jul 28, 2016
Merged

Rename toolbar config to profiling #105

merged 1 commit into from
Jul 28, 2016

Conversation

sagikazarmark
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Related tickets fixes #99
License MIT

What's in this PR?

Rename toolbar config to profiling as it seems to be more common.

$v['toolbar']['enabled'] = $this->debug; // @deprecated value auto in 1.3.0
}

if (array_key_exists('profiling', $v) && is_array($v['profiling'])) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

imho we should consider configuration invalid if both profiling and toolbar exist. the user should decide for one.

do we have a problem at this stage with default values from the Configuration? i think they will only come after this step.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the BC promise at this point is that toolbar will work at least until 2.0 which means if toolbar is configured it should always work, otherwise it's a BC break, no matter if an error is thrown or overwritten by profiling.

What about default values? you mean the auto config? I added it here so that the enabled config can be defined as boolean.

Copy link
Collaborator

@dbu dbu Jul 26, 2016

Choose a reason for hiding this comment

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

imo the BC promise covers that you can update the bundle and it continues to work as before. but once you add new configuration that was not possible before the update, it is ok to complain when you leave the old config in place. merging old and new config feels strange, it would mean you can configure both at the same time.

with auto config i meant ->defaultValue() places. i think those come after beforeNormalization - if i am wrong and they are already present, we indeed would need to merge the configurations

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, so if the new config exists: complain or simply ignore the old config?

I still don't get the default value thing: yes, defaultValue comes after the normalization, but we need to check the auto value for BC in the normalization section.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, so if the new config exists: complain or simply ignore the old config?

I agree with David. If you configure both toolbar and profiling you should get an error.

Copy link
Collaborator

@dbu dbu Jul 26, 2016 via email

Choose a reason for hiding this comment

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

@sagikazarmark sagikazarmark force-pushed the profiling branch 2 times, most recently from 8fbcae2 to cb71934 Compare July 26, 2016 17:42
@sagikazarmark
Copy link
Member Author

Added exception on colliding config and separated BC tests.

})
->then(function ($v) {
if (array_key_exists('profiling', $v)) {
throw new InvalidConfigurationException('"toolbar" config is deprecated as of version 1.3.0, please use "profiling" instead.');
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets change the message: "Can't configure both "toolbar" and "profiling" section. The "toolbar" config is deprecated as of version 1.3.0, please only use "profiling"."

@sagikazarmark
Copy link
Member Author

Rewritten exception message, added trigger errors.

@@ -69,6 +69,29 @@ public function getConfigTreeBuilder()
return $v;
})
->end()
->beforeNormalization()
->ifTrue(function ($v) {
@trigger_error('"httplug.toolbar" config is deprecated since version 1.3 and will be removed in 2.0. Use "httplug.profiling" instead.', E_USER_DEPRECATED);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will trigger the warning regardless of whether toolbar is used or not. should go into ->then(), probably after the InvalidConfigurationException check

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, done.

@dbu dbu merged commit c2493b5 into master Jul 28, 2016
@dbu dbu deleted the profiling branch July 28, 2016 14:32
@dbu
Copy link
Collaborator

dbu commented Jul 28, 2016

can you please also update the documentation? with a ..versionadded note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename toolbar config to profiling
3 participants