Skip to content
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

PccArticlesMapper::toArticleData is very opaque #30

Open
chx opened this issue Jan 16, 2025 · 0 comments
Open

PccArticlesMapper::toArticleData is very opaque #30

chx opened this issue Jan 16, 2025 · 0 comments

Comments

@chx
Copy link

chx commented Jan 16, 2025

This method casts an object from a dependency into an array

And while the object in question currently only contains public properties it still requires cross-project referencing to figure this out -- and since the object has the AllowDynamicProperties attribute, it's really anyone's guess what this method returns.

It would be much better to spell it out like

return [
  'id' => $article->id,
  'title' => $article->title,
]

and so forth.

Alternatively, since I doubt there are any BC concerns yet just remove this method completely and inline it into toArticlesList? As far as I can see there's no other use of it and so why expose it then?

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

No branches or pull requests

1 participant