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

[Uid] Add component-specific exception classes#60226

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

Conversation

nicolas-grekas
Copy link
Member

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
Issues-
LicenseMIT

Generalization of#60154

/cc@rela589n

Copy link
Contributor

@rela589nrela589n left a comment

Choose a reason for hiding this comment

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

lovely ❤️

Comment on lines -44 to 48
$this->expectException(\InvalidArgumentException::class);
$this->expectException(InvalidUlidException::class);
$this->expectExceptionMessage('Invalid ULID: "this is not a ulid".');

Copy link
Contributor

Choose a reason for hiding this comment

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

@nicolas-grekas , really thank you, appreciate it a lot!

{
public function __construct(
public readonly int $type,
string $value,
Copy link
Contributor

Choose a reason for hiding this comment

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

do you think it'd be possible to make value accessible as well?

actually there'd been discussion regarding this in a previous MR,@fabpot prefers private property and getter

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

private property and getter

I saw that but I think this is still better :)

Comment on lines +14 to +16
class InvalidArgumentException extends \InvalidArgumentException
{
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@nicolas-grekas , do you think it could contain value?

Copy link
Member

Choose a reason for hiding this comment

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

We generally don't include a value in ourInvalidArgumentException exceptions. When such error happens for an error related to an object, this would mean that the exception retains a reference to that object (even if you never call the getter), which would have an impact on GC.

Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasApr 16, 2025
edited
Loading

Choose a reason for hiding this comment

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

What@stof wrote (and where the previous PR blocked IMHO)
So better not to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not a reference shall make the impact on garbage collection, unless it creates a circular reference.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Still, not something that makes sense to me.

Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasApr 17, 2025
edited
Loading

Choose a reason for hiding this comment

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

Sure, but it's not the responsibility of the exception to carry this as a standalone value. (the native InvalidArgumentException doesn't carry it if you want an example)

Copy link
Contributor

Choose a reason for hiding this comment

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

It is, and it must have the value inside

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'm sorry you feel frustrated about the situation. We made a step in the direction you're aiming for but we don't do the last step for reasons I already shared. You'll have to parse the message for your use case...

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel any frustration about anything. I have a big lump of faith down inside of me believing that it is the way to go, and that it should be implemented.

Copy link
Contributor

Choose a reason for hiding this comment

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

@nicolas-grekas , I want you to receive this idea

@nicolas-grekas
Copy link
MemberAuthor

Thank you@rela589n.

@nicolas-grekasnicolas-grekas merged commit1d7c9ec intosymfony:7.3Apr 17, 2025
7 of 11 checks passed
@nicolas-grekasnicolas-grekas deleted the uid-exception-classes branchApril 17, 2025 09:07
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof left review comments

@rela589nrela589nrela589n left review comments

@fabpotfabpotfabpot approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

5 participants
@nicolas-grekas@fabpot@stof@rela589n@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp