mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-15 01:20:59 +00:00
bug #13709 Fix fatal error when OPCache preloading is used (mmenozzi)
This PR was merged into the 1.12-dev branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | 1.11 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | none | License | MIT While in Symfony 5 the `Symfony\Bundle\FrameworkBundle\Templating\EngineInterface` was removed, in Sylius there were still references to that interface in docblock comments. With Sylius 1.11 ([with this commit](ced91b9bd6)) the type hint has been promoted to a PHP type hint. This normally does not cause any problem because apparently the class loading is lazy and does not try to load the non-existent interface. But if PHP OPCache preload is used, like suggested [here](https://symfony.com/doc/current/performance.html#use-the-opcache-class-preloading), it appears that PHP switches to eager class loading and you get the following fatal error: ``` NOTICE: PHP message: PHP Fatal error: Failed to load class Symfony\Bundle\FrameworkBundle\Templating\EngineInterface used by typed property Sylius\Bundle\ShopBundle\Controller\SecurityWidgetController::$templatingEngine during preloading in Unknown on line 0 ``` With this PR we propose to remove all references to the old interface as Symfony 4 is not supported anymore by Sylius. Commits -------1b555f948dRemove references to old Symfony FrameworkBundle EngineInterface
This commit is contained in:
commit
ad93c745ff
12 changed files with 10 additions and 58 deletions
|
|
@ -142,7 +142,7 @@ We've introduced promoted properties all over the code where it was possible. Pl
|
|||
- `Sylius\Bundle\ShopBundle\Controller\SecurityWidgetController`
|
||||
- `Sylius\Bundle\UiBundle\Controller\SecurityController`
|
||||
|
||||
In all of them constructor argument `$templatingEngine`, previously typed as `object` was changed to `EngineInterface|Environment`.
|
||||
In all of them constructor argument `$templatingEngine`, previously typed as `object` was changed to `Environment`.
|
||||
It should not cause any problems (only such services would work in these controllers), but is theoretically making the type
|
||||
requirement stricter.
|
||||
|
||||
|
|
|
|||
|
|
@ -31,21 +31,3 @@ parameters:
|
|||
|
||||
ignoreErrors:
|
||||
- '/Access to an undefined property Doctrine\\Common\\Collections\\ArrayCollection/'
|
||||
- '/Parameter \$templatingEngine of method Sylius\\Bundle\\AdminBundle\\Controller\\CustomerStatisticsController\:\:\_\_construct\(\) has invalid typehint type Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface\./'
|
||||
- '/Parameter \$templatingEngine of method Sylius\\Bundle\\AdminBundle\\Controller\\Dashboard\\StatisticsController\:\:\_\_construct\(\) has invalid typehint type Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface\./'
|
||||
- '/Parameter \$templatingEngine of method Sylius\\Bundle\\AdminBundle\\Controller\\DashboardController\:\:\_\_construct\(\) has invalid typehint type Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface\./'
|
||||
- '/Parameter \$templatingEngine of method Sylius\\Bundle\\ShopBundle\\Controller\\ContactController\:\:\_\_construct\(\) has invalid typehint type Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface\./'
|
||||
- '/Parameter \$templatingEngine of method Sylius\\Bundle\\ShopBundle\\Controller\\CurrencySwitchController\:\:\_\_construct\(\) has invalid typehint type Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface\./'
|
||||
- '/Parameter \$templatingEngine of method Sylius\\Bundle\\ShopBundle\\Controller\\HomepageController\:\:\_\_construct\(\) has invalid typehint type Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface\./'
|
||||
- '/Parameter \$templatingEngine of method Sylius\\Bundle\\ShopBundle\\Controller\\LocaleSwitchController\:\:\_\_construct\(\) has invalid typehint type Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface\./'
|
||||
- '/Parameter \$templatingEngine of method Sylius\\Bundle\\ShopBundle\\Controller\\SecurityWidgetController\:\:\_\_construct\(\) has invalid typehint type Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface\./'
|
||||
- '/Parameter \$templatingEngine of method Sylius\\Bundle\\UiBundle\\Controller\\SecurityController\:\:\_\_construct\(\) has invalid typehint type Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface\./'
|
||||
- '/Property Sylius\\Bundle\\AdminBundle\\Controller\\CustomerStatisticsController\:\:\$templatingEngine has unknown class Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface as its type\./'
|
||||
- '/Property Sylius\\Bundle\\AdminBundle\\Controller\\Dashboard\\StatisticsController\:\:\$templatingEngine has unknown class Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface as its type\./'
|
||||
- '/Property Sylius\\Bundle\\AdminBundle\\Controller\\DashboardController\:\:\$templatingEngine has unknown class Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface as its type\./'
|
||||
- '/Property Sylius\\Bundle\\ShopBundle\\Controller\\ContactController\:\:\$templatingEngine has unknown class Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface as its type\./'
|
||||
- '/Property Sylius\\Bundle\\ShopBundle\\Controller\\CurrencySwitchController\:\:\$templatingEngine has unknown class Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface as its type\./'
|
||||
- '/Property Sylius\\Bundle\\ShopBundle\\Controller\\HomepageController\:\:\$templatingEngine has unknown class Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface as its type\./'
|
||||
- '/Property Sylius\\Bundle\\ShopBundle\\Controller\\LocaleSwitchController\:\:\$templatingEngine has unknown class Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface as its type\./'
|
||||
- '/Property Sylius\\Bundle\\ShopBundle\\Controller\\SecurityWidgetController\:\:\$templatingEngine has unknown class Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface as its type\./'
|
||||
- '/Property Sylius\\Bundle\\UiBundle\\Controller\\SecurityController\:\:\$templatingEngine has unknown class Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface as its type\./'
|
||||
|
|
|
|||
21
psalm.xml
21
psalm.xml
|
|
@ -89,7 +89,6 @@
|
|||
<referencedClass name="Payum\Core\Action\GatewayAwareAction" />
|
||||
<referencedClass name="Payum\Core\Security\GenericTokenFactoryInterface" />
|
||||
<referencedClass name="Sylius\Component\Core\Calculator\ProductVariantPriceCalculatorInterface" />
|
||||
<referencedClass name="Symfony\Bundle\FrameworkBundle\Templating\EngineInterface" /> <!-- deprecated in Symfony 4.3 -->
|
||||
<referencedClass name="Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent" /> <!-- deprected in Symfony 4.4 -->
|
||||
<referencedClass name="Symfony\Component\HttpKernel\EventListener\ExceptionListener" /> <!-- deprected in Symfony 4.4 -->
|
||||
<referencedClass name="Symfony\Component\Routing\RouteCollectionBuilder" /> <!-- deprecated in Symfony 5.1 -->
|
||||
|
|
@ -145,12 +144,6 @@
|
|||
</errorLevel>
|
||||
</InvalidDocblock>
|
||||
|
||||
<UndefinedDocblockClass>
|
||||
<errorLevel type="info">
|
||||
<referencedClass name="Symfony\Bundle\FrameworkBundle\Templating\EngineInterface" /> <!-- for backwards compatibility with symfony/templating ^4.4 -->
|
||||
</errorLevel>
|
||||
</UndefinedDocblockClass>
|
||||
|
||||
<MissingReturnType errorLevel="info" />
|
||||
|
||||
<PropertyNotSetInConstructor errorLevel="info" />
|
||||
|
|
@ -163,20 +156,6 @@
|
|||
|
||||
<RedundantConditionGivenDocblockType errorLevel="info" />
|
||||
|
||||
<UndefinedClass>
|
||||
<errorLevel type="info">
|
||||
<file name="src/Sylius/Bundle/AdminBundle/Controller/CustomerStatisticsController.php" />
|
||||
<file name="src/Sylius/Bundle/AdminBundle/Controller/Dashboard/StatisticsController.php" />
|
||||
<file name="src/Sylius/Bundle/AdminBundle/Controller/DashboardController.php" />
|
||||
<file name="src/Sylius/Bundle/ShopBundle/Controller/ContactController.php" />
|
||||
<file name="src/Sylius/Bundle/ShopBundle/Controller/CurrencySwitchController.php" />
|
||||
<file name="src/Sylius/Bundle/ShopBundle/Controller/HomepageController.php" />
|
||||
<file name="src/Sylius/Bundle/ShopBundle/Controller/LocaleSwitchController.php" />
|
||||
<file name="src/Sylius/Bundle/ShopBundle/Controller/SecurityWidgetController.php" />
|
||||
<file name="src/Sylius/Bundle/UiBundle/Controller/SecurityController.php" />
|
||||
</errorLevel>
|
||||
</UndefinedClass>
|
||||
|
||||
<!-- level 4 issues - points to possible deficiencies in logic, higher false-positives -->
|
||||
|
||||
<MoreSpecificReturnType errorLevel="info" />
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace Sylius\Bundle\AdminBundle\Controller;
|
|||
use Sylius\Component\Core\Customer\Statistics\CustomerStatisticsProviderInterface;
|
||||
use Sylius\Component\Core\Model\CustomerInterface;
|
||||
use Sylius\Component\Resource\Repository\RepositoryInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
|
@ -27,7 +26,7 @@ final class CustomerStatisticsController
|
|||
public function __construct(
|
||||
private CustomerStatisticsProviderInterface $statisticsProvider,
|
||||
private RepositoryInterface $customerRepository,
|
||||
private EngineInterface|Environment $templatingEngine
|
||||
private Environment $templatingEngine
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,14 +15,13 @@ namespace Sylius\Bundle\AdminBundle\Controller\Dashboard;
|
|||
|
||||
use Sylius\Bundle\AdminBundle\Provider\StatisticsDataProviderInterface;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Twig\Environment;
|
||||
|
||||
final class StatisticsController
|
||||
{
|
||||
public function __construct(
|
||||
private EngineInterface|Environment $templatingEngine,
|
||||
private Environment $templatingEngine,
|
||||
private StatisticsDataProviderInterface $statisticsDataProvider
|
||||
) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ use Sylius\Bundle\AdminBundle\Provider\StatisticsDataProviderInterface;
|
|||
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
|
||||
use Sylius\Component\Core\Dashboard\SalesDataProviderInterface;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
|
@ -29,7 +28,7 @@ final class DashboardController
|
|||
{
|
||||
public function __construct(
|
||||
private ChannelRepositoryInterface $channelRepository,
|
||||
private EngineInterface|Environment $templatingEngine,
|
||||
private Environment $templatingEngine,
|
||||
private RouterInterface $router,
|
||||
private ?SalesDataProviderInterface $salesDataProvider = null,
|
||||
private ?StatisticsDataProviderInterface $statisticsDataProvider = null
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ use Sylius\Component\Channel\Context\ChannelContextInterface;
|
|||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Sylius\Component\Customer\Context\CustomerContextInterface;
|
||||
use Sylius\Component\Locale\Context\LocaleContextInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
|
@ -34,7 +33,7 @@ final class ContactController
|
|||
public function __construct(
|
||||
private RouterInterface $router,
|
||||
private FormFactoryInterface $formFactory,
|
||||
private EngineInterface|Environment $templatingEngine,
|
||||
private Environment $templatingEngine,
|
||||
private ChannelContextInterface $channelContext,
|
||||
private CustomerContextInterface $customerContext,
|
||||
private LocaleContextInterface $localeContext,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ use Sylius\Component\Core\Currency\CurrencyStorageInterface;
|
|||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Sylius\Component\Currency\Context\CurrencyContextInterface;
|
||||
use Sylius\Component\Currency\Model\CurrencyInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
|
@ -27,7 +26,7 @@ use Twig\Environment;
|
|||
final class CurrencySwitchController
|
||||
{
|
||||
public function __construct(
|
||||
private EngineInterface|Environment $templatingEngine,
|
||||
private Environment $templatingEngine,
|
||||
private CurrencyContextInterface $currencyContext,
|
||||
private CurrencyStorageInterface $currencyStorage,
|
||||
private ChannelContextInterface $channelContext
|
||||
|
|
|
|||
|
|
@ -13,14 +13,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Bundle\ShopBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Twig\Environment;
|
||||
|
||||
final class HomepageController
|
||||
{
|
||||
public function __construct(private EngineInterface|Environment $templatingEngine)
|
||||
public function __construct(private Environment $templatingEngine)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace Sylius\Bundle\ShopBundle\Controller;
|
|||
use Sylius\Bundle\ShopBundle\Locale\LocaleSwitcherInterface;
|
||||
use Sylius\Component\Locale\Context\LocaleContextInterface;
|
||||
use Sylius\Component\Locale\Provider\LocaleProviderInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
|
@ -25,7 +24,7 @@ use Twig\Environment;
|
|||
final class LocaleSwitchController
|
||||
{
|
||||
public function __construct(
|
||||
private EngineInterface|Environment $templatingEngine,
|
||||
private Environment $templatingEngine,
|
||||
private LocaleContextInterface $localeContext,
|
||||
private LocaleProviderInterface $localeProvider,
|
||||
private LocaleSwitcherInterface $localeSwitcher
|
||||
|
|
|
|||
|
|
@ -13,13 +13,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Bundle\ShopBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Twig\Environment;
|
||||
|
||||
final class SecurityWidgetController
|
||||
{
|
||||
public function __construct(private EngineInterface|Environment $templatingEngine)
|
||||
public function __construct(private Environment $templatingEngine)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
namespace Sylius\Bundle\UiBundle\Controller;
|
||||
|
||||
use Sylius\Bundle\UiBundle\Form\Type\SecurityLoginType;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
|
@ -29,7 +28,7 @@ final class SecurityController
|
|||
public function __construct(
|
||||
private AuthenticationUtils $authenticationUtils,
|
||||
private FormFactoryInterface $formFactory,
|
||||
private EngineInterface|Environment $templatingEngine,
|
||||
private Environment $templatingEngine,
|
||||
private AuthorizationCheckerInterface $authorizationChecker,
|
||||
private RouterInterface $router
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue