Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DoctrineDataCollector: taught sanitizeParam to support classes with __toString implemented.#20680

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@FractalizeR
Copy link
Contributor

This PR teaches \Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector::sanitizeParam support objects, which implement __toString and therefore can be represented as a string with more sense, than "(object) ClassName". It also includes test for the feature.

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets20673
LicenseMIT
Doc PRno

@nicolas-grekas
Copy link
Member

I think we need to dump the class name all the time. At least this is what Monolog does in this case:
https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/NormalizerFormatter.php#L101-L120

@FractalizeR
Copy link
ContributorAuthor

Monolog in that source does both. It uses class name as a key, and __toString() call result as a value.

@nicolas-grekasnicolas-grekas added this to the3.x milestoneDec 6, 2016
@nicolas-grekas
Copy link
Member

@FractalizeR that's what I meant :) And I think that's wise.

if (is_object($var)) {
returnarray(sprintf('Object(%s)',get_class($var)),false);
returnmethod_exists($var,'__toString') ?
array($var->__toString(),false) :
Copy link
Member

Choose a reason for hiding this comment

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

I agree that the class name should be dumped here as well. The way it is implemented will cause confusing results.

@fabpot
Copy link
Member

What's the status of this PR?

@fabpot
Copy link
Member

@FractalizeR Any news? Are still interested in finishing this PR?

@FractalizeR
Copy link
ContributorAuthor

Yeah, sure. But I am at lost who makes a decision about how this PR should really look like. I'm ready to make desired modifications, but someone responsible needs to tell me what needs to be adjusted.

@fabpot
Copy link
Member

I think we all agree that we need to keep the class name, even when there is a string representation.

@FractalizeR
Copy link
ContributorAuthor

Can we, then, use the following representation for objects, implementing__toString()

(object) className: '__toString() return result'

?

xabbuh reacted with thumbs up emoji

@fabpot
Copy link
Member

@FractalizeR I think that makes sense.

@FractalizeRFractalizeRforce-pushed thefeature-doctrine-data-collector-tostringable-params branch from14e2631 tod3f9d16CompareMarch 2, 2017 09:00
@FractalizeR
Copy link
ContributorAuthor

Done. Some tests fail, but this is not due my PR, but several other components. Looks like some PR was merged without ensuring tests pass.


publicfunction__toString()
{
return$this->representation;
Copy link
Member

Choose a reason for hiding this comment

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

Can we simplify this class by removing therepresentation property and hardcode the text here directly?

FractalizeR reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

FractalizeR reacted with thumbs up emoji
@fabpot
Copy link
Member

Thank you@FractalizeR.

@FractalizeRFractalizeR deleted the feature-doctrine-data-collector-tostringable-params branchMarch 3, 2017 08:21
@nicolas-grekasnicolas-grekas modified the milestones:3.x,3.3Mar 24, 2017
@fabpotfabpot mentioned this pull requestMay 1, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot left review comments

@xabbuhxabbuhxabbuh requested changes

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

6 participants

@FractalizeR@nicolas-grekas@fabpot@xabbuh@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp