| Conditions | 3 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 7.0245 |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 2 | public function register(Container $app) |
|
| 23 | { |
||
| 24 | |||
| 25 | 2 | if ($app->offsetExists('form.factory')) { |
|
| 26 | $app['form.types'] = $app->extend('form.types', function($types) use ($app) { |
||
| 27 | $types[] = new Form\Type\MediaType($app); |
||
|
|
|||
| 28 | return $types; |
||
| 29 | }); |
||
| 30 | } |
||
| 31 | |||
| 32 | 2 | if ($app->offsetExists('twig')) { |
|
| 33 | $app['twig'] = $app->extend('twig', function(\Twig_Environment $twig) use ($app) { |
||
| 34 | $twig->addExtension(new Twig\MediaExtension($app)); |
||
| 35 | return $twig; |
||
| 36 | }); |
||
| 37 | |||
| 38 | $app['twig.path'] = array_merge($app['twig.path'], array( |
||
| 39 | __DIR__ . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'views' |
||
| 40 | )); |
||
| 41 | |||
| 42 | $app['twig.form.templates'] = array_merge($app['twig.form.templates'], array("media.type.html.twig")); |
||
| 43 | } |
||
| 44 | 2 | } |
|
| 45 | |||
| 47 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.