-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Array redeclare fix #333
Array redeclare fix #333
Conversation
Not completely happy with the |
Oooops, I'll try to fix the tests later today. |
@@ -89,6 +89,11 @@ public function getDocBlockType(?int $errorType = null): string | |||
} elseif ($this->nullable && $errorType !== Method::NULLSY_TYPE) { | |||
$returnTypes[] = 'null'; | |||
} | |||
|
|||
if (in_array('array', $returnTypes)) { | |||
$returnTypes = array_map(fn (string $type) => str_replace('array', '\array', $type), $returnTypes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, now that I see this, I remember that I've also had this issue with DateTime
. Do you think there's a (scalable) way to do this for all PHP namespace types/objects (keeping https://wiki.php.net/rfc/namespaces_in_bundled_extensions in mind)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting, didn't realize DateTime
also has a function file and a class file. Another solution would be to change the filenames of the generated functions. Say, if we use array_func.php
and datetime_func.php
(for example, whatever that doesn't match the original return types) there won't be any issue when the autoloader looks for the types. That actually may be more "scalable".
It is debatable (at least, I couldn't find any authoritative info on it) whether the primitive types on phpdoc shouldn't be the first option unless explicitly defined otherwise, so this very well may be a bug on PHPDocParser, but it just seemed easier to fix here.
This is great. Do you need think you can fix the CI yourself or do you need help with the tests? |
@Kharhamel Yeah, it shouldn't be a problem, I just need to find the time to do it, haha, but I think I can pick it up some time this week for sure. |
This is great. Don't hesitate to ask questions if you need |
I've fixed the tests here. I've tried rebasing with |
I just updated the generator |
504d4bf
to
ba48d3a
Compare
I've rebased the branch and now phpunit is reporting no errors. |
Didn't realize the latest changes from |
I'll try to get to this today. |
I am sorry, I still cannot merge. I don't know why i am not notified when you answer. |
4a91860
to
5e3e492
Compare
5e3e492
to
25c39b0
Compare
Ok, sorry it took me this long, I've rebased against |
Great. I am deploying this right now |
Revert "Merge pull request #333 from j3j5/array-redeclare-fix"
Fixes #253