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

Describe some types more accurately #183

Merged
merged 1 commit into from
May 19, 2021

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented May 17, 2021

Downstream builds are broken partly because the last release of persistence
describes its inputs more accurately, but not its outputs.

@greg0ire greg0ire force-pushed the improve-return-type branch 2 times, most recently from e662316 to 05c99b3 Compare May 17, 2021 18:54
@@ -136,7 +136,9 @@ public function getAllClassNames($globalBasename)
}

// NOTE: All files found here means classes are not transient!
$classes[] = str_replace('.', '\\', $fileName);
/** @psalm-var class-string */
Copy link
Member Author

Choose a reason for hiding this comment

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

Using assert(class_exists($class)) on this particular one makes the ORM test suite fail https://github.com/doctrine/orm/blob/2.8.x/tests/Doctrine/Tests/ORM/Tools/ConvertDoctrine1SchemaTest.php because there is heavy mocking involved.

@greg0ire greg0ire marked this pull request as draft May 17, 2021 19:09
@greg0ire greg0ire marked this pull request as ready for review May 17, 2021 20:12
@greg0ire
Copy link
Member Author

@orklah @franmomu please review. More things could be done if it were not for vimeo/psalm#5788

@greg0ire greg0ire force-pushed the improve-return-type branch 2 times, most recently from 3bb0d6a to 580729e Compare May 17, 2021 20:16
@orklah
Copy link

orklah commented May 17, 2021

I think a good amount of the arrays could be described as list<class-string> if we wanted to. Otherwise, seems good!

@greg0ire greg0ire force-pushed the improve-return-type branch 3 times, most recently from c8fd4c9 to 87daf16 Compare May 17, 2021 21:41
@greg0ire greg0ire requested a review from alcaeus May 17, 2021 21:48
@@ -13,6 +13,7 @@ interface MappingDriver
* Loads the metadata for the specified class into the provided container.
*
* @param string $className
* @psalm-param class-string $className
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess here @template T of object could be used to specify class-string<T> and ClassMetadata<T>.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right, fixed, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't really understand how I can fix the resulting error, maybe I should ignore it…

Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm I guess so, what I don't know is why it didn't complain calling object::loadMetadata 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

@greg0ire greg0ire force-pushed the improve-return-type branch from 87daf16 to c655f60 Compare May 18, 2021 07:03
Downstream builds are broken because the last release of persistence
describes its inputs more accurately, but not its outputs.
@greg0ire greg0ire force-pushed the improve-return-type branch from c655f60 to c62177e Compare May 18, 2021 17:51
@greg0ire greg0ire requested a review from alcaeus May 18, 2021 20:38
@alcaeus alcaeus added this to the 2.2.1 milestone May 19, 2021
@alcaeus alcaeus added the Bug Something isn't working label May 19, 2021
@alcaeus alcaeus self-assigned this May 19, 2021
@alcaeus
Copy link
Member

alcaeus commented May 19, 2021

Thanks @greg0ire!

@alcaeus alcaeus merged commit fd17476 into doctrine:2.2.x May 19, 2021
@greg0ire greg0ire deleted the improve-return-type branch May 19, 2021 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants