【问题标题】:How to resolve deprecation calls如何解决弃用电话
【发布时间】:2017-08-16 06:19:21
【问题描述】:

我的项目是使用 Symfony 3.1.0 和 PHP 7.0 开发的,我使用了很多包

这几天我有很多弃用,有时工具栏返回 JS 错误ERR_CONNECTION_RESET

您能否帮助我解决弃用问题的方法?

如何理解日志?我应该更正我的代码吗?更新一些捆绑包?女巫?

谢谢!

我的作曲家文件:

{
    "name": "xxx",
    "license": "proprietary",
    "description": "xxx",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "require": {
        "php": ">=5.5.9",
        "symfony/symfony": "3.1.0",
        "doctrine/orm": "^2.5",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-cache-bundle": "^1.2",
        "symfony/swiftmailer-bundle": "^2.3",
        "symfony/monolog-bundle": "^2.8",
        "sensio/distribution-bundle": "^5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "^2.0",
        "doctrine/doctrine-fixtures-bundle": "~2.3",
        "friendsofsymfony/user-bundle": "dev-master",
        "friendsofsymfony/jsrouting-bundle": "2.0.0-alpha1",
        "jms/serializer-bundle": "1.1.0",
        "symfony/form": "3.1.0",
        "javiereguiluz/easyadmin-bundle": "~1.14",
        "cmen/google-charts-bundle": "1.*",
        "blackknight467/star-rating-bundle": "^2.0",
        "hwi/oauth-bundle": "0.5.x-dev",
        "suncat/mobile-detect-bundle": "1.0.*",
        "cspoo/swiftmailer-mailgun-bundle": "^0.3.1",
        "php-http/guzzle5-adapter": "^1.0",
        "symfony/finder": "^3.2",
        "nategood/httpful": "^0.2.20",
        "monolog/monolog": "^1.22",
        "algolia/algolia-search-bundle": "^2.1",
        "beberlei/DoctrineExtensions": "^1.0",
        "coresphere/console-bundle": "^0.5.0",
        "robertotru/to-inline-style-email-bundle": "^1.2"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0",
        "phpunit/phpunit": "5.4.4",
        "symfony/browser-kit": "3.1.0",
        "symfony/css-selector": "3.1.0"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}

我的反对意见:

Referencing the "core" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead. (2 times)

Referencing the "form" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead. (70 times)

Calling "renderblock" on template "@WebProfiler/Collector/request.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@WebProfiler/Collector/time.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead).

Calling "renderblock" on template "@WebProfiler/Collector/memory.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@WebProfiler/Collector/ajax.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@WebProfiler/Collector/form.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Silent display of undefined block "toolbar" in template "@WebProfiler/Profiler/base.html.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('toolbar') is defined" expression to test for block existence

Calling "renderblock" on template "@WebProfiler/Collector/exception.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@WebProfiler/Collector/logger.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Silent display of undefined block "toolbar" in template "@WebProfiler/Profiler/base.html.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('toolbar') is defined" expression to test for block existence.

Calling "renderblock" on template "@WebProfiler/Collector/events.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@WebProfiler/Collector/router.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

 Calling "renderblock" on template "@WebProfiler/Collector/translation.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@Security/Collector/security.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@WebProfiler/Collector/twig.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@Doctrine/Collector/db.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@Swiftmailer/Collector/swiftmailer.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@Debug/Profiler/dump.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@EasyAdmin/data_collector/easyadmin.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "MobileDetectBundle:Collector:device.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "CoreSphereConsoleBundle:Toolbar:toolbar.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

Calling "renderblock" on template "@WebProfiler/Collector/config.html.twig" from template "@WebProfiler/Profiler/toolbar.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("toolbar", template) instead)

... etc...

【问题讨论】:

    标签: deprecation-warning symfony-3.1


    【解决方案1】:

    对于这些通知:

    模板“@WebProfiler/Profiler/base.html.twig”中未定义块“工具栏”的静默显示自版本 1.29 起已弃用,并将在 2.0 中引发异常。使用“block('toolbar') is defined”表达式来测试block是否存在

    您必须更正您的 base.html.twig 文件:

    {% include('Bundle::file.html.twig') with {stylesheets: block('stylesheets')} %}
    

    喜欢:

    {% set sheets = null %}
    {% if block('stylesheets') is defined %}
       {% set sheets = block('stylesheets') %}
    {% endif %}
    
    {% include('Bundle::file.html.twig') with {stylesheets: sheets} %}
    

    【讨论】:

      猜你喜欢
      • 2022-08-04
      • 2014-08-27
      • 1970-01-01
      • 1970-01-01
      • 2020-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多