| Conditions | 5 |
| Paths | 6 |
| Total Lines | 36 |
| Code Lines | 19 |
| Lines | 10 |
| Ratio | 27.78 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | private function loadDelegates($entity) |
||
| 21 | { |
||
| 22 | if (!$this instanceof LazyLoaderInterface) { |
||
| 23 | return $entity; |
||
| 24 | } |
||
| 25 | if (!$entity instanceof LazyPropertiesInterface) { |
||
| 26 | throw new \InvalidArgumentException(sprintf('%s objects cannot be hydrated with properties loading delegates without implementing %s.', |
||
| 27 | get_class($entity), |
||
| 28 | LazyPropertiesInterface::class |
||
| 29 | )); |
||
| 30 | } |
||
| 31 | |||
| 32 | // global handler (deprecated) |
||
| 33 | View Code Duplication | if (isset($proxies[$loaderClass = static::class])) { |
|
| 34 | @trigger_error( |
||
| 35 | sprintf('Global loader delegate is deprecated and will be removed in 1.6. Make "%s" loader invokable instead, entity to handle is given at first parameter.', |
||
| 36 | static::class |
||
| 37 | ), |
||
| 38 | E_USER_DEPRECATED |
||
| 39 | ); |
||
| 40 | $proxies[$loaderClass]($entity); |
||
| 41 | unset($proxies[$loaderClass]); |
||
| 42 | } |
||
| 43 | |||
| 44 | // define delegates into object |
||
| 45 | $entity->registerLoaders( |
||
| 46 | $this->getLoadingDelegates() |
||
| 47 | ); |
||
| 48 | |||
| 49 | // global handler |
||
| 50 | if (is_callable($this)) { |
||
| 51 | $this($entity); |
||
| 52 | } |
||
| 53 | |||
| 54 | return $entity; |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.