Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Typehinted properties on missing class with preloading #44364

@jderusse

Description

@jderusse

Symfony version(s) affected

6.0

Description

I'm using Symfony\Bridge\Twig\Mime\BodyRenderer without League\HTMLToMarkdown\HtmlConverter.
The code in the constructor allows me to do that.

But in production, with preloading, I'm facing an issue:

Failed to load class League\HTMLToMarkdown\HtmlConverter used by typed property Symfony\Bridge\Twig\Mime\BodyRenderer::$converter during preloading

I believe that typehinted property HAVE to be loadable when preloaded

edit: same for Predis\ClientInterface in Symfony\Component\Cache\Traits\RedisClusterProxy

How to reproduce

  • enable preloading
  • composer require symfony/twig-bridge:^6.0
  • assert League\HTMLToMarkdown is NOT installed

Possible Solution

  • remove type hinted property for optional dependencies

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions