不要安装Symfony Flex

时间:2018-06-14 12:58:55

标签: php symfony composer-php

每次我运行composer install时都会创建控制器目录并添加kernel.php 我不确定发生了什么,我怀疑交响乐flex正在做些什么。 这个kernel.php对我没用,由于这个文件,我的app破解了

my composer.json

{
    "name": "My App",
    "description": "my app",
    "keywords": ["app"],
    "license": "MIT",
    "type": "project",
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": ">=7.2.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.0",
        "mockery/mockery": "~1.0",
        "phpunit/phpunit": "~7.0",
        "squizlabs/php_codesniffer": "~3.0",
        "phpmd/phpmd": "~2.0",
        "phing/phing": "~2.0",
        "phpdocumentor/phpdocumentor": "~3.0",
        "sebastian/phpcpd": "~4.0",
        "phploc/phploc": "~4.0",
        "vektah/bugfree-dangerzone": "~0.4",
        "amnuts/opcache-gui": "~2.0",
        "rlerdorf/opcache-status": "dev-master",
        "peehaa/opcachegui": "master",
        "friendsofphp/php-cs-fixer": "~2.0",
        "johnkary/phpunit-speedtrap": "~3.0"
    },
    "autoload": {
        "exclude-from-classmap": ["/tests/"],
        "psr-4": {
            "Entities\\": "src/Entities/",
            "Helpers\\": "src/Helpers/",
            "Factories\\": "src/Factories/",
            "Repositories\\": "src/Repositories",
            "Requests\\": "src/Requests/",
            "Responses\\": "src/Responses/",
            "UseCases\\": "src/UseCases/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "TestHelpers\\": "tests/Helpers",
            "UnitTest\\": "tests/Unit/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}

kernel.php内容

<?php

namespace App;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;

class Kernel extends BaseKernel

当我运行composer update

时,我也会在终端上看到这个
-  WARNING  jms/serializer-bundle (>=2.0): From github.com/symfony/recipes-contrib:master
    The recipe for this package comes from the "contrib" repository, which is open to community contributions.
    Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/jms/serializer-bundle/2.0

    Do you want to execute this recipe?
    [y] Yes
    [n] No
    [a] Yes for all packages, only for the current installation session
    [p] Yes permanently, never ask again for this project
    (defaults to n): 

我的测试中断了

PHPUnit 7.2.4 by Sebastian Bergmann and contributors.


Fatal error: Cannot declare class App\Kernel, because the name is already in use in /www/base_site/src/Kernel.php on line 12

Call Stack:
    0.0003     393112   1. {main}() /www/base_site/vendor/phpunit/phpunit/phpunit:0
    0.0488    2886864   2. PHPUnit\TextUI\Command::main() /www/base_site/vendor/phpunit/phpunit/phpunit:53
    0.0488    2886976   3. PHPUnit\TextUI\Command->run() /www/base_site/vendor/phpunit/phpunit/src/TextUI/Command.php:156
    0.2294    7201648   4. PHPUnit\TextUI\TestRunner->doRun() /www/base_site/vendor/phpunit/phpunit/src/TextUI/Command.php:203
    0.2886    7750008   5. PHPUnit\Framework\TestSuite->run() /www/base_site/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:566
    0.2959    7759160   6. PHPUnit\Framework\TestSuite->run() /www/base_site/vendor/phpunit/phpunit/src/Framework/TestSuite.php:776
    0.3043    7759760   7. UnitTest\Entity\AccountTest->run() /www/base_site/vendor/phpunit/phpunit/src/Framework/TestSuite.php:776
    0.3044    7759760   8. PHPUnit\Framework\TestResult->run() /www/base_site/vendor/phpunit/phpunit/src/Framework/TestCase.php:805
    0.3053    7773536   9. SebastianBergmann\CodeCoverage\CodeCoverage->start() /www/base_site/vendor/phpunit/phpunit/src/Framework/TestResult.php:606
    0.3053    7773536  10. SebastianBergmann\CodeCoverage\CodeCoverage->initializeData() /www/base_site/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:243
    0.3287    8329976  11. include_once('/www/base_site/src/Kernel.php') /www/base_site/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:948


Process finished with exit code 255

无论如何都有解决这个问题的方法吗?

0 个答案:

没有答案