Skip to content

add missing MessageFormatter::parseMessage() method#582

Open
xabbuh wants to merge 1 commit into
symfony:1.xfrom
xabbuh:message-formatter-parse-message-method
Open

add missing MessageFormatter::parseMessage() method#582
xabbuh wants to merge 1 commit into
symfony:1.xfrom
xabbuh:message-formatter-parse-message-method

Conversation

@xabbuh
Copy link
Copy Markdown
Member

@xabbuh xabbuh commented Apr 24, 2026

No description provided.


public static function parseMessage(string $locale, string $pattern, string $message)
{
return static::create($locale, $pattern)->parse($message);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

as parse is not implemented, how do this report missing support in the polyfill ? This static method does not give access to the error getters of the instance.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am not sure I understand what you mean. Is it that from your POV the exception message raised by parse() would be confusing?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My understanding: parse() in the instance will not throw, it will only populate error as state in properties, which are supposed to be read, but no available when using the static API.
intl_get_error_code() / intl_get_error_message() are the global functions supposed to work for static methods, but here, not sure we can use them since they might be already declared when polyfilling a subpart of intl (guessing, I didn't double check this)
Which means we might prefer throwing as not implemented here and tell to use the non-static API?

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.

3 participants