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

Missing phpdoc comment in alsoknow() method #297

Closed
jcvignoli opened this issue Feb 15, 2023 · 2 comments
Closed

Missing phpdoc comment in alsoknow() method #297

jcvignoli opened this issue Feb 15, 2023 · 2 comments

Comments

@jcvignoli
Copy link

Just found out that method alsoknow() in title.php is missing in its phpdoc comment the "comment" (singular) variable in @return line 1175.
This line
* @return array<array{title: string, country: string, countryCode: string|null, language: string, languageCode: string|null, comments: string[]}>
should be replaced by
* @return array<array{title: string, country: string, countryCode: string|null, language: string, languageCode: string|null, comment: string, comments: string[]}>
I added "comment: string, ".
It is necessary for projects using imdbphp and phpstan.

@tboothman
Copy link
Owner

tboothman commented Feb 15, 2023

It was slightly deliberate. I didn't want it to be there, but left the comment in the actual return for backwards compatibility.
The docbloc used to say

* Note: This may return an empty country or comments. The original title will have a country of '' and a comment of 'original title'
* comment, year and lang are there for backwards compatibility and should not be used
* @return array array[0..n] of array[title,country,comments[]]

alsoknow() was the first method I fixed for 8.0 so I was trying to keep backwards compatibility. As I went on so many things had to change I started removing depricated stuff.
Explicitely talking about the field I'd wanted to remove in the comment was pretty stupid though.

It's actually impossible to have more than one 'comment'. The language used to get rolled into the comments array (["German title", "DVD title"]), but not any more.
image

Arguably then comment is the good field and comments is the one that should be deprecated

@tboothman
Copy link
Owner

Probably could've just posted the conclusion rather than the conversation with myself :D

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

2 participants