Total Lines | 61 |
Code Lines | 32 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
54 | private function parseBinding(string $dependencyIndex, DependencyInterface $dependency): ?BindingInfo |
||
55 | { |
||
56 | // Parse index format: "interface-named" or just "interface" |
||
57 | $parts = explode('-', $dependencyIndex, 2); |
||
58 | $interface = $parts[0]; |
||
59 | $named = isset($parts[1]) && $parts[1] !== '+' ? $parts[1] : null; |
||
60 | |||
61 | $dependencyString = (string) $dependency; |
||
62 | |||
63 | // Determine binding type and target |
||
64 | if ($dependency instanceof Instance) { |
||
65 | $value = $dependency->value; |
||
66 | return new BindingInfo( |
||
67 | $interface, |
||
68 | $named, |
||
69 | 'toInstance', |
||
70 | is_object($value) ? get_class($value) : $value |
||
71 | ); |
||
72 | } |
||
73 | |||
74 | if ($dependency instanceof DependencyProvider) { |
||
75 | // Extract the provider class from the string representation |
||
76 | if (preg_match('/\(provider\) \(dependency\) (.+?)(,|$)/', $dependencyString, $matches)) { |
||
77 | return new BindingInfo( |
||
78 | $interface, |
||
79 | $named, |
||
80 | 'toProvider', |
||
81 | $matches[1] |
||
82 | ); |
||
83 | } |
||
84 | } |
||
85 | |||
86 | if ($dependency instanceof Dependency) { |
||
87 | // Extract target class from NewInstance |
||
88 | $target = (string) $dependency->accept(new class implements VisitorInterface { |
||
89 | public function visitDependency($newInstance, $postConstruct, $isSingleton) { |
||
90 | return (string) $newInstance; |
||
91 | } |
||
92 | public function visitInstance($instance) { return null; } |
||
93 | public function visitProvider($dependency, $context, $isSingleton) { return null; } |
||
94 | public function visitAspectBind($bind) { return null; } |
||
95 | }); |
||
96 | |||
97 | if ($target === '') { |
||
98 | return null; |
||
99 | } |
||
100 | |||
101 | // Get AOP bindings directly from VO |
||
102 | $aopInfo = $dependency->getAopInfo(); |
||
103 | $aopBindings = $aopInfo && $aopInfo->hasBindings() ? $aopInfo->methodBindings : null; |
||
104 | |||
105 | return new BindingInfo( |
||
106 | $interface, |
||
107 | $named, |
||
108 | 'to', |
||
109 | $target, |
||
110 | $aopBindings |
||
111 | ); |
||
112 | } |
||
113 | |||
114 | return null; |
||
115 | } |
||
116 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths