Skip to content

Commit

Permalink
I am trying to solve the issue, but I am troubled with a different er…
Browse files Browse the repository at this point in the history
…ror...

Symfony\Component\DependencyInjection\Exception\RuntimeException : Cannot autowire service "Symplify\TokenRunner\DocBlock\DescriptionAnalyzer": argument "$typeNodeAnalyzer" of method "__construct()" references class "Symplify\BetterPhpDocParser\PhpDocParser\TypeNodeAnalyzer" but no such service exists.
 /Volumes/dev/php/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:54
 /Volumes/dev/php/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:82
 /Volumes/dev/php/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:32
 /Volumes/dev/php/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:46
 /Volumes/dev/php/vendor/symfony/dependency-injection/Compiler/Compiler.php:95
 /Volumes/dev/php/vendor/symfony/dependency-injection/ContainerBuilder.php:750
 /Volumes/dev/php/vendor/symfony/http-kernel/Kernel.php:544
 /Volumes/dev/php/vendor/symfony/http-kernel/Kernel.php:133
 /Volumes/dev/php/packages/symplify-cs-fixer/src/Container/Container.php:46
 /Volumes/dev/php/packages/symplify-cs-fixer/src/Container/Container.php:62
 /Volumes/dev/php/packages/symplify-cs-fixer/src/Container/Container.php:56
 /Volumes/dev/php/packages/symplify-cs-fixer/tests/ContainerTest.php:15
  • Loading branch information
suin committed May 22, 2019
1 parent ed1a8ac commit 4b6802e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
34 changes: 30 additions & 4 deletions packages/symplify-cs-fixer/src/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@
use PhpCsFixer\Fixer\DefinedFixerInterface;
use Psr\Container\ContainerInterface;
use Symplify\EasyCodingStandard\DependencyInjection\ContainerFactory;
use Symplify\EasyCodingStandard\HttpKernel\EasyCodingStandardKernel;
use Symplify\PackageBuilder\Console\Input\InputDetector;

/**
* @param string[] $configs
*/
function computeConfigHash(array $configs): string
{
$hash = '';
foreach ($configs as $config) {
$hash .= md5_file($config);
}

return $hash;
}

final class Container
{
Expand All @@ -19,10 +34,21 @@ final class Container

private function __construct()
{
$containerFactory = new ContainerFactory();
$this->container = $containerFactory->createWithConfigs(
[self::CONFIG_FILE]
);

$configs = [self::CONFIG_FILE];


$environment = 'prod' . computeConfigHash($configs) . random_int(1, 100000);
$easyCodingStandardKernel = new EasyCodingStandardKernel($environment, InputDetector::isDebug());


$easyCodingStandardKernel->setConfigs($configs);
$easyCodingStandardKernel->boot();
// $containerFactory = new ContainerFactory();
// $this->container = $containerFactory->createWithConfigs(
// [self::CONFIG_FILE]
// );
$this->container = $easyCodingStandardKernel->getContainer();
}

public static function get(string $fixerClass): DefinedFixerInterface
Expand Down
17 changes: 17 additions & 0 deletions packages/symplify-cs-fixer/tests/ContainerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace SymplifyCsFixer;

use PHPUnit\Framework\TestCase;
use Symplify\EasyCodingStandard\Console\EasyCodingStandardApplication;
use SymplifyCsFixer\Container\Container;

final class ContainerTest extends TestCase
{
public function testName(): void
{
$a = Container::get(EasyCodingStandardApplication::class);
}
}
2 changes: 1 addition & 1 deletion packages/symplify-cs-fixer/tests/FixersListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use PHPUnit\Framework\TestCase;

/** @noinspection EfferentObjectCouplingInspection */
class FixersListTest extends TestCase
final class FixersListTest extends TestCase
{
public function test_list_fixers(): void
{
Expand Down

0 comments on commit 4b6802e

Please sign in to comment.