open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Validator/Constraints/UniqueMainAliasValidator.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused local variables such as '$siteAlias'.
Open

            foreach ($mainAliases as $name => $siteAlias) {

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Parameter $constraint has undeclared type \Symfony\Component\Validator\Constraint
Open

    public function validate($value, Constraint $constraint)

Parameter $value has undeclared type \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

    public function validate($value, Constraint $constraint)

Reference to instance property message from undeclared class \Symfony\Component\Validator\Constraint
Open

                $this->context->buildViolation($constraint->message)

Parameter $alias has undeclared type \OpenOrchestra\ModelInterface\Model\SiteAliasInterface
Open

        $mainAliases = $value->getAliases()->filter(function(SiteAliasInterface $alias) {

Call to method isMain from undeclared class \OpenOrchestra\ModelInterface\Model\SiteAliasInterface
Open

            return $alias->isMain();

Class extends undeclared class \Symfony\Component\Validator\ConstraintValidator
Open

class UniqueMainAliasValidator extends ConstraintValidator

Call to method getAliases from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

        $mainAliases = $value->getAliases()->filter(function(SiteAliasInterface $alias) {

Reference to undeclared property \OpenOrchestra\Backoffice\Validator\Constraints\UniqueMainAliasValidator->context
Open

                $this->context->buildViolation($constraint->message)

Expected 1 space after FUNCTION keyword; 0 found
Open

        $mainAliases = $value->getAliases()->filter(function(SiteAliasInterface $alias) {

The closing brace for the class must go on the next line after the body
Open

}

There are no issues that match your filters.

Category
Status