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

Add return types on public classes and interfaces #459

Merged
merged 2 commits into from
Mar 12, 2024

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Dec 15, 2023

Add return types to methods from the public API.

Follow-up #455 (review)

@GromNaN
Copy link
Member Author

GromNaN commented Dec 15, 2023

I'll check why ObjectManager::getClassMetadata() return null for Doctrine\Tests\Common\DataFixtures\TestEntity\Role.

@GromNaN GromNaN changed the base branch from 1.8.x to 2.0.x December 15, 2023 15:20
@GromNaN
Copy link
Member Author

GromNaN commented Dec 15, 2023

Psalm baseline updated. I was confused by the fact that both psalm and phpstan are used.

@greg0ire greg0ire added this to the 2.0.0 milestone Dec 15, 2023
src/ReferenceRepository.php Outdated Show resolved Hide resolved
tests/Common/DataFixtures/Executor/ORMExecutorTest.php Outdated Show resolved Hide resolved
tests/Common/DataFixtures/ReferenceRepositoryTest.php Outdated Show resolved Hide resolved
@derrabus
Copy link
Member

Rebase needed.

@GromNaN GromNaN force-pushed the return-type branch 2 times, most recently from 16e6238 to ba3d6ab Compare March 12, 2024 10:27
@@ -14,5 +14,5 @@ interface FixtureInterface
/**
* Load data fixtures with the passed EntityManager
*/
public function load(ObjectManager $manager);
public function load(ObjectManager $manager): void;
Copy link
Member Author

@GromNaN GromNaN Mar 12, 2024

Choose a reason for hiding this comment

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

This change can impact every project using data-fixtures. Adding the @return type annotation in the previous version will ease migration: #472

@derrabus
Copy link
Member

Can we enable this rule now?

<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
<!-- Adding return types is a BC break in most cases. -->
<exclude-pattern>src/*</exclude-pattern>
</rule>

@@ -56,11 +56,6 @@
<exclude-pattern>src/*</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
Copy link
Member Author

Choose a reason for hiding this comment

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

Response to #459 (comment): This rule is applied by default. This config was to exclude src dir.

Copy link
Member

Choose a reason for hiding this comment

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

Right. I missed that you've changed the config already. 🙈

@derrabus derrabus changed the title [v2] Add return types on public classes and interfaces Add return types on public classes and interfaces Mar 12, 2024
@derrabus derrabus merged commit 68894b4 into doctrine:2.0.x Mar 12, 2024
11 checks passed
@GromNaN GromNaN deleted the return-type branch March 12, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants