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

Basic implementation of psr6 compatibility pass #690

Merged
merged 13 commits into from
Oct 16, 2021

Conversation

Ahummeling
Copy link
Contributor

After meeting with @alcaeus we came to the conclusion that it would be best to first implement psr6 compatibility, before moving forward with removing the metadata cache configuration. This pull request is aimed at implementing this compatibility, through means of a compiler pass.

Wanted to get a tiny bit of feedback as I am continuing to figure out which tests cause deprecation triggers, figure out what happens when I install this version in 1 of my projects and all that stuff.

Will be leaving some comments on my first commit to explain certain choices or things that might appear odd

Copy link
Contributor Author

@Ahummeling Ahummeling left a comment

Choose a reason for hiding this comment

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

When reviewing this PR, please make sure to have a look over my comments as well, as I'm sure they all raise some potential points for (beneficial) discussion / constructive criticism.

DependencyInjection/Compiler/CacheCompatibilityPass.php Outdated Show resolved Hide resolved
Tests/FixtureIntegrationTest.php Outdated Show resolved Hide resolved
@franmomu
Copy link
Contributor

franmomu commented Aug 9, 2021

Thanks @Ahummeling! In order to fix the build, can you please execute vendor/bin/phpcbf to fix the coding standard issues (you can check with vendor/bin/phpcs if it is fine).

The failing test should be fixed if you rebase with 4.4.x.

Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

Left an initial review, great work so far!

{
private const CACHE_SETTER_METHODS_PSR6_SUPPORT = [
'setMetadataCache' => true,
'setMetadataCacheImpl' => true,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'setMetadataCacheImpl' => true,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

++

DependencyInjection/Compiler/CacheCompatibilityPass.php Outdated Show resolved Hide resolved
Comment on lines 80 to 81
'doctrine/doctrine-bundle',
'2.4',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'doctrine/doctrine-bundle',
'2.4',
'doctrine/mongodb-odm-bundle',
'4.4',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, fixed that

Tests/FixtureIntegrationTest.php Outdated Show resolved Hide resolved
@Ahummeling
Copy link
Contributor Author

just need to have a testcase added for the compiler pass now and this should be complete

@Ahummeling Ahummeling marked this pull request as ready for review August 10, 2021 19:04
Comment on lines 95 to 96
$compatibilityLayerId = $definitionId . '.compatibility_layer';
$container->setAlias($compatibilityLayerId, $aliasId);

$container->setDefinition($compatibilityLayerId, $compatibilityLayer);
Copy link
Contributor

@franmomu franmomu Sep 1, 2021

Choose a reason for hiding this comment

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

Not sure about this, but if I had understood correctly, if $compatibilityLayer is not null, it is a definition implementing PSR-6 to replace the current definition, so should we replace the current alias with the compatibilityLayer one (flip arguments)?:

$container->setAlias($aliasId, $compatibilityLayerId);

@franmomu
Copy link
Contributor

franmomu commented Sep 1, 2021

@Ahummeling I've rebased, tried to add tests for the compiler pass (based on the ORM) and fixed some psalm issues, finally I've flipped the alias arguments to make tests pass, but not sure if I was right about that last one 🤔 cc @alcaeus

@IonBazan IonBazan added this to the 4.4.0 milestone Sep 20, 2021
@IonBazan
Copy link
Member

IonBazan commented Oct 1, 2021

I've rebased, resolved conflicts and added a dummy assertion to make PHPUnit report the coverage for that CompilerPass test.
@franmomu can you help to fix the static analysis issues? Maybe we can just revert these phpdoc changes for now?

@IonBazan IonBazan requested a review from franmomu October 1, 2021 11:59
@franmomu
Copy link
Contributor

franmomu commented Oct 1, 2021

Not sure why doesn't infer correctly that class string type 😕, maybe because of generics.

@IonBazan
Copy link
Member

IonBazan commented Oct 1, 2021

Thanks, it looks good now!

@alcaeus this is ready for review now.

@IonBazan IonBazan requested a review from malarzm October 14, 2021 05:11
@IonBazan IonBazan merged commit 658aa70 into doctrine:4.4.x Oct 16, 2021
@IonBazan
Copy link
Member

Thank you @Ahummeling! 🚀

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

Successfully merging this pull request may close these issues.

4 participants