DevelopTech /
AgilityBundle
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Developtech\AgilityBundle\EventSubscriber; |
||
| 4 | |||
| 5 | use Doctrine\Common\EventSubscriber; |
||
| 6 | use Doctrine\ORM\Event\LoadClassMetadataEventArgs; |
||
| 7 | use Doctrine\ORM\Events; |
||
| 8 | use Doctrine\ORM\Mapping\ClassMetadata; |
||
| 9 | |||
| 10 | class DynamicRelationSubscriber implements EventSubscriber |
||
| 11 | { |
||
| 12 | const MODEL_PROJECT = 'Developtech\AgilityBundle\Entity\Project'; |
||
| 13 | const MODEL_FEATURE = 'Developtech\AgilityBundle\Entity\Feature'; |
||
| 14 | const MODEL_FEEDBACK = 'Developtech\AgilityBundle\Entity\Feedback'; |
||
| 15 | |||
| 16 | /** @var string **/ |
||
| 17 | protected $userClass; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param string $userClass |
||
| 21 | */ |
||
| 22 | 1 | public function __construct($userClass) { |
|
| 23 | 1 | $this->userClass = $userClass; |
|
| 24 | 1 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * {@inheritDoc} |
||
| 28 | */ |
||
| 29 | 1 | public function getSubscribedEvents() |
|
| 30 | { |
||
| 31 | return array( |
||
| 32 | 1 | Events::loadClassMetadata, |
|
| 33 | 1 | ); |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param LoadClassMetadataEventArgs $eventArgs |
||
| 38 | */ |
||
| 39 | 1 | public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) |
|
| 40 | { |
||
| 41 | // the $metadata is the whole mapping info for this class |
||
| 42 | 1 | $metadata = $eventArgs->getClassMetadata(); |
|
| 43 | |||
| 44 | 1 | switch($metadata->getName()) { |
|
|
0 ignored issues
–
show
|
|||
| 45 | 1 | case self::MODEL_PROJECT: return $this->mapProject($metadata); |
|
|
0 ignored issues
–
show
$metadata is of type object<Doctrine\ORM\EntityManager>, but the function expects a object<Doctrine\ORM\Mapping\ClassMetadata>.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
The case body in a switch statement must start on the line following the statement.
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement. switch ($expr) {
case "A":
doSomething(); //right
break;
case "B":
doSomethingElse(); //wrong
break;
} To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 46 | 1 | case self::MODEL_FEATURE: return $this->mapFeature($metadata); |
|
|
0 ignored issues
–
show
$metadata is of type object<Doctrine\ORM\EntityManager>, but the function expects a object<Doctrine\ORM\Mapping\ClassMetadata>.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
The case body in a switch statement must start on the line following the statement.
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement. switch ($expr) {
case "A":
doSomething(); //right
break;
case "B":
doSomethingElse(); //wrong
break;
} To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 47 | 1 | case self::MODEL_FEEDBACK: return $this->mapFeedback($metadata); |
|
|
0 ignored issues
–
show
$metadata is of type object<Doctrine\ORM\EntityManager>, but the function expects a object<Doctrine\ORM\Mapping\ClassMetadata>.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
The case body in a switch statement must start on the line following the statement.
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement. switch ($expr) {
case "A":
doSomething(); //right
break;
case "B":
doSomethingElse(); //wrong
break;
} To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 48 | 1 | default: return; |
|
|
0 ignored issues
–
show
The default body in a switch statement must start on the line following the statement.
According to the PSR-2, the body of a default statement must start on the line immediately following the statement. switch ($expr) {
default:
doSomething(); //right
break;
}
switch ($expr) {
default:
doSomething(); //wrong
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 49 | 1 | } |
|
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param CLassMetadata $metadata |
||
| 54 | */ |
||
| 55 | 1 | public function mapProject(ClassMetadata $metadata) { |
|
| 56 | 1 | $metadata->mapManyToOne(array( |
|
| 57 | 1 | 'targetEntity' => $this->userClass, |
|
| 58 | 1 | 'fieldName' => 'productOwner', |
|
| 59 | 1 | 'cascade' => array(), |
|
| 60 | 'joinColumn' => array( |
||
| 61 | 'nullable' => false |
||
| 62 | 1 | ) |
|
| 63 | 1 | )); |
|
| 64 | 1 | } |
|
| 65 | |||
| 66 | /** |
||
| 67 | * @param CLassMetadata $metadata |
||
| 68 | */ |
||
| 69 | 1 | public function mapFeature(ClassMetadata $metadata) { |
|
| 70 | 1 | $metadata->mapManyToOne(array( |
|
| 71 | 1 | 'targetEntity' => $this->userClass, |
|
| 72 | 1 | 'fieldName' => 'responsible', |
|
| 73 | 1 | 'cascade' => array(), |
|
| 74 | 'joinColumn' => array( |
||
| 75 | 'nullable' => true |
||
| 76 | 1 | ) |
|
| 77 | 1 | )); |
|
| 78 | 1 | } |
|
| 79 | |||
| 80 | /** |
||
| 81 | * @param CLassMetadata $metadata |
||
| 82 | */ |
||
| 83 | 1 | public function mapFeedback(ClassMetadata $metadata) { |
|
| 84 | 1 | $metadata->mapManyToOne(array( |
|
| 85 | 1 | 'targetEntity' => $this->userClass, |
|
| 86 | 1 | 'fieldName' => 'author', |
|
| 87 | 1 | 'cascade' => array(), |
|
| 88 | 'joinColumn' => array( |
||
| 89 | 'nullable' => false |
||
| 90 | 1 | ) |
|
| 91 | 1 | )); |
|
| 92 | 1 | $metadata->mapManyToOne(array( |
|
| 93 | 1 | 'targetEntity' => $this->userClass, |
|
| 94 | 1 | 'fieldName' => 'responsible', |
|
| 95 | 1 | 'cascade' => array(), |
|
| 96 | 'joinColumn' => array( |
||
| 97 | 'nullable' => true |
||
| 98 | 1 | ) |
|
| 99 | 1 | )); |
|
| 100 | 1 | } |
|
| 101 | } |
||
| 102 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.