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

fix doWarmUp $buildDir deprecation #1710

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

dmaicher
Copy link
Contributor

Remaining self deprecation notices (1)

  1x: The "Doctrine\Bundle\DoctrineBundle\CacheWarmer\DoctrineMetadataCacheWarmer::doWarmUp()" method will require a new "string|null $buildDir" argument in the next major version of its parent class "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer", not defining it is deprecated.
    1x in CacheCompatibilityPassTest::testCacheConfigUsingServiceDefinedByApplication from Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\Compiler

Also see https://github.com/doctrine/DoctrineBundle/actions/runs/6600459221/job/17930490923#step:7:44

@dmaicher dmaicher added this to the 2.10.3 milestone Oct 22, 2023
@dmaicher dmaicher marked this pull request as ready for review October 22, 2023 09:30
@dmaicher dmaicher merged commit 96fe0ff into doctrine:2.10.x Oct 22, 2023
13 checks passed
@dmaicher dmaicher deleted the fix_deprecations branch October 22, 2023 12:02
@derrabus
Copy link
Member

derrabus commented Oct 22, 2023

Note that this change is a breaking one if we don't consider DoctrineMetadataCacheWarmer as final. Not sure if targeting a bugfix release for that was the best move.

@dmaicher
Copy link
Contributor Author

Note that this change is a breaking one if we don't consider DoctrineMetadataCacheWarmer as final. Not sure if targeting a bugfix release for that was the best move.

Yeah I don't see DoctrineMetadataCacheWarmer as an extension point really but technically its a BC break.

How about adding @final annotation and moving the change to 2.11.x?

@ostrolucky
Copy link
Member

I don't see how is this a BC breaking change, care to clarify?

@dmaicher
Copy link
Contributor Author

I don't see how is this a BC breaking change, care to clarify?

Well if someone extended the class like this

class MyCustomCacheWarmer extends DoctrineMetadataCacheWarmer
{
    protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter): bool
    {
        return parent::doWarmUp($cacheDir, $arrayAdapter);
    }
}

Then it would fail with my change

PHP Fatal error:  Declaration of MyCustomCacheWarmer::doWarmUp($cacheDir, Symfony\Component\Cache\Adapter\ArrayAdapter $arrayAdapter): bool must be compatible with Doctrine\Bundle\DoctrineBundle\CacheWarmer\DoctrineMetadataCacheWarmer::doWarmUp(string $cacheDir, Symfony\Component\Cache\Adapter\ArrayAdapter $arrayAdapter, ?string $buildDir = null): bool in /var/www/DoctrineBundle/CacheWarmer/MyCustomCacheWarmer.php on line 9

@ostrolucky
Copy link
Member

That's because $buildDir has not been specified, not related to this PR. This would work https://3v4l.org/2fLp1

@dmaicher
Copy link
Contributor Author

That's because $buildDir has not been specified, not related to this PR. This would work https://3v4l.org/2fLp1

hm... but my PR added the $buildDir argument? 😄 so its related to this PR?

@ostrolucky
Copy link
Member

Man, somehow I missed that... Proceed according your preference. In my opinion it doesn't matter much if we do it in 2.10.x or 2.11.x, only major is allowed by semver, so we break the rule anyways, but it needs to ship.

@derrabus
Copy link
Member

Yeah I don't see DoctrineMetadataCacheWarmer as an extension point really but technically its a BC break.

Neither do I. Classes like this one should be considered final, but we haven't documented it as such.

How about adding @final annotation and moving the change to 2.11.x?

Yes, let's do that.

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.

3 participants