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

Improve support for anonymous classes#28218

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

Merged
nicolas-grekas merged 1 commit intosymfony:masterfromnicolas-grekas:anonymous
Aug 24, 2018

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedAug 17, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Before:
image

After:
image

Same in other places, e.g. Console failures.

sroze, linaori, and sstok reacted with thumbs up emoji
if ('' ===$message || OutputInterface::VERBOSITY_VERBOSE <=$output->getVerbosity()) {
$title =sprintf(' [%s%s]',\get_class($e),0 !== ($code =$e->getCode()) ?' ('.$code.')' :'');
$class =\get_class($e);
$class ='c' ===$class[0] &&0 ===strpos($class,"class@anonymous\0") ?get_parent_class($class).'@anonymous' :$class;
Copy link
Member

@KocalKocalAug 17, 2018
edited
Loading

Choose a reason for hiding this comment

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

I'm curious about\0, I know it represents a null byte, but it's the first time I see it in PHP code.
Does it improve perf or something like that? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

You cannot print a null char usingnull as this would result in an empty string 😃

Kocal reacted with thumbs up emoji
Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasAug 25, 2018
edited
Loading

Choose a reason for hiding this comment

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

That's desired, see#28218 (comment) (or maybe you mean something else... :))

@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedAug 17, 2018 via email

Nothing like that. It's just part of the generated class name for anonymousclasses.

@Kocal
Copy link
Member

Kocal commentedAug 17, 2018
edited
Loading

Oh okay, thanks 👍

@nicolas-grekasnicolas-grekasforce-pushed theanonymous branch 3 times, most recently fromda351cd to6380b7dCompareAugust 18, 2018 20:45
{
if (false !==strpos($message,"class@anonymous\0")) {
$message =preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/',function ($m) {
return\class_exists($m[0],false) ?get_parent_class($m[0]).'@anonymous' :$m[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

technically this can occur for anon. clases without a parent class.. do we care? Same forsetClass.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

yes we do, and this is handled: the result will be just@anonymous, as the VarDumper component already does.


if (($this->loggedErrors &$type) ||$exceptioninstanceof FatalThrowableError) {
if (false !==strpos($message =$exception->getMessage(),"class@anonymous\0")) {
($message =newFlattenException())->setMessage($message);
Copy link
Member

Choose a reason for hiding this comment

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

naming the temporary variable$message here looks weird, as it does not contain the message.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Fixed by makingFlattenException fluent.

@nicolas-grekasnicolas-grekas merged commite41ced2 intosymfony:masterAug 24, 2018
nicolas-grekas added a commit that referenced this pull requestAug 24, 2018
This PR was merged into the 4.2-dev branch.Discussion----------Improve support for anonymous classes| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Before:![image](https://user-images.githubusercontent.com/243674/44276933-5c522600-a249-11e8-8bcc-6d55c9fa5a5e.png)After:![image](https://user-images.githubusercontent.com/243674/44276912-4cd2dd00-a249-11e8-943f-b6b0d0eb8908.png)Same in other places, e.g. Console failures.Commits-------e41ced2 Improve support for anonymous classes
@nicolas-grekasnicolas-grekas deleted the anonymous branchAugust 24, 2018 13:46
{
$this->statusCode =$code;

return$this;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need fluent interface here?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We don'tneed it. It still makes it easier to use the class.

@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
This was referencedNov 3, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@chalasrchalasrchalasr approved these changes

+4 more reviewers

@KocKocKoc left review comments

@sstoksstoksstok left review comments

@KocalKocalKocal left review comments

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

8 participants

@nicolas-grekas@Kocal@Koc@stof@sstok@ro0NL@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp