pixelfederation/swoole-bundle

View on GitHub

Showing 252 of 252 total issues

Avoid using undefined variables such as '$runtimeConfiguration' which will lead to PHP notices.
Open

        return $runtimeConfiguration;

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$this' which will lead to PHP notices.
Open

        $this->$propertyName = $newValue;
Severity: Minor
Found in src/functions.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$runtimeConfiguration' which will lead to PHP notices.
Open

        $runtimeConfiguration['trustedHosts'] = $this->decodeSet($trustedHosts);

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$runtimeConfiguration' which will lead to PHP notices.
Open

        Assertion::isArray($runtimeConfiguration['trustedProxies']);

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$runtimeConfiguration' which will lead to PHP notices.
Open

            $runtimeConfiguration['trustedProxies'] = \array_filter($runtimeConfiguration['trustedProxies'], fn (string $trustedProxy): bool => '*' !== $trustedProxy);

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Method process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(ContainerBuilder $container, Proxifier $proxifier): void
    {
        /** @var array<string,string> $bundles */
        $bundles = $container->getParameter('kernel.bundles');

Severity: Minor
Found in src/Bridge/Doctrine/DoctrineProcessor.php - About 1 hr to fix

    Method ensureXdebugDisabled has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function ensureXdebugDisabled(SymfonyStyle $io): void
        {
            $xdebugHandler = new XdebugHandler();
            if (!$xdebugHandler->shouldRestart()) {
                return;
    Severity: Minor
    Found in src/Bridge/Symfony/Bundle/Command/AbstractServerStartCommand.php - About 1 hr to fix

      A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 18 and the first side effect is on line 14.
      Open

      <?php

      Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              private string $wrappedServiceId,
              private Container $container,
              Mutex $mutex,
              int $instancesLimit = 50,
              ?Resetter $resetter = null,
      Severity: Minor
      Found in src/Bridge/Symfony/Container/ServicePool/DiServicePool.php - About 45 mins to fix

        The class ContextualAccessForwarderGenerator has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13.
        Open

        class ContextualAccessForwarderGenerator implements ProxyGeneratorInterface
        {
            public function __construct(private MethodForwarderBuilder $forwarderBuilder)
            {
            }

        CouplingBetweenObjects

        Since: 1.1.0

        A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

        Example

        class Foo {
            /**
             * @var \foo\bar\X
             */
            private $x = null;
        
            /**
             * @var \foo\bar\Y
             */
            private $y = null;
        
            /**
             * @var \foo\bar\Z
             */
            private $z = null;
        
            public function setFoo(\Foo $foo) {}
            public function setBar(\Bar $bar) {}
            public function setBaz(\Baz $baz) {}
        
            /**
             * @return \SplObjectStorage
             * @throws \OutOfRangeException
             * @throws \InvalidArgumentException
             * @throws \ErrorException
             */
            public function process(\Iterator $it) {}
        
            // ...
        }

        Source https://phpmd.org/rules/design.html#couplingbetweenobjects

        The class AbstractServerStartCommand has a coupling between objects value of 20. Consider to reduce the number of dependencies under 13.
        Open

        abstract class AbstractServerStartCommand extends Command
        {
            use ParametersHelperTrait;
        
            private bool $testing = false;

        CouplingBetweenObjects

        Since: 1.1.0

        A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

        Example

        class Foo {
            /**
             * @var \foo\bar\X
             */
            private $x = null;
        
            /**
             * @var \foo\bar\Y
             */
            private $y = null;
        
            /**
             * @var \foo\bar\Z
             */
            private $z = null;
        
            public function setFoo(\Foo $foo) {}
            public function setBar(\Bar $bar) {}
            public function setBaz(\Baz $baz) {}
        
            /**
             * @return \SplObjectStorage
             * @throws \OutOfRangeException
             * @throws \InvalidArgumentException
             * @throws \ErrorException
             */
            public function process(\Iterator $it) {}
        
            // ...
        }

        Source https://phpmd.org/rules/design.html#couplingbetweenobjects

        The class ServerStatusCommand has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
        Open

        final class ServerStatusCommand extends Command
        {
            public function __construct(
                private Sockets $sockets,
                private ApiServerClientFactory $apiServerClientFactory,

        CouplingBetweenObjects

        Since: 1.1.0

        A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

        Example

        class Foo {
            /**
             * @var \foo\bar\X
             */
            private $x = null;
        
            /**
             * @var \foo\bar\Y
             */
            private $y = null;
        
            /**
             * @var \foo\bar\Z
             */
            private $z = null;
        
            public function setFoo(\Foo $foo) {}
            public function setBar(\Bar $bar) {}
            public function setBaz(\Baz $baz) {}
        
            /**
             * @return \SplObjectStorage
             * @throws \OutOfRangeException
             * @throws \InvalidArgumentException
             * @throws \ErrorException
             */
            public function process(\Iterator $it) {}
        
            // ...
        }

        Source https://phpmd.org/rules/design.html#couplingbetweenobjects

        Method generateOverriddenDoInExtension has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                Filesystem $fs,
                string $containerDir,
                string $fileToLoad,
                string $class,
                string $namespace
        Severity: Minor
        Found in src/Bridge/Symfony/Container/ContainerModifier.php - About 35 mins to fix

          Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  private AccessInterceptorValueHolderFactory $proxyFactory,
                  private Instantiator $instantiator,
                  private ServicePoolContainer $servicePoolContainer,
                  private MutexFactory $limitLocking,
                  private MutexFactory $newInstanceLocking
          Severity: Minor
          Found in src/Bridge/Symfony/Container/Proxy/UnmanagedFactoryInstantiator.php - About 35 mins to fix

            Method overrideCachedEntrypoint has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private static function overrideCachedEntrypoint(Filesystem $fs, string $cacheDir, string $containerClass, string $overriddenFqcn, bool $isDebug): void
            Severity: Minor
            Found in src/Bridge/Symfony/Container/ContainerModifier.php - About 35 mins to fix

              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      private HttpServer $server,
                      private HttpServerConfiguration $serverConfiguration,
                      private ConfiguratorInterface $serverConfigurator,
                      protected ParameterBagInterface $parameterBag,
                      private BootableInterface $bootManager
              Severity: Minor
              Found in src/Bridge/Symfony/Bundle/Command/AbstractServerStartCommand.php - About 35 mins to fix

                Multi-line use declarations must define one parameter per line
                Open

                            ) use ($servicePoolContainer, $instantiator, $factoryConfig, $mutex, $globalInstancesLimit) {

                Function overrideGeneratedContainer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function overrideGeneratedContainer(ReflectionClass $reflContainer, string $cacheDir, bool $isDebug): void
                    {
                        $fs = new Filesystem();
                        $containerFqcn = $reflContainer->getName();
                        $overriddenFqcn = $containerFqcn.'_Overridden';
                Severity: Minor
                Found in src/Bridge/Symfony/Container/ContainerModifier.php - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Possible parse error: class missing opening or closing brace
                Open

                class MethodForwarderGenerator

                Function mergeLoadedConfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function mergeLoadedConfig(array $loadedConfig, array $iniConfig): string
                    {
                        $content = '';
                
                        foreach ($loadedConfig as $name => $value) {
                Severity: Minor
                Found in src/Common/XdebugHandler/XdebugHandler.php - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Severity
                Category
                Status
                Source
                Language