@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | - * @return string |
|
65 | + * @return Name |
|
66 | 66 | * |
67 | 67 | * @api |
68 | 68 | */ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | - * @param $methodName |
|
85 | + * @param string $methodName |
|
86 | 86 | * @return bool |
87 | 87 | * |
88 | 88 | * @api |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | - * @return InitializationCallback |
|
122 | + * @return \Closure |
|
123 | 123 | * |
124 | 124 | * @api |
125 | 125 | */ |
@@ -45,12 +45,12 @@ |
||
45 | 45 | $classGenerator->addPropertyFromGenerator($initializerProperty = new Initializer()); |
46 | 46 | |
47 | 47 | array_map( |
48 | - function (MethodGenerator $generatedMethod) use ($originalClass, $classGenerator) { |
|
48 | + function(MethodGenerator $generatedMethod) use ($originalClass, $classGenerator) { |
|
49 | 49 | ClassGeneratorUtils::addMethodIfNotFinal($originalClass, $classGenerator, $generatedMethod); |
50 | 50 | }, |
51 | 51 | array_merge( |
52 | 52 | array_map( |
53 | - function (ReflectionMethod $method) use ($wrappedObjectProperty, $lazyPropertiesProperty, $initializerProperty) { |
|
53 | + function(ReflectionMethod $method) use ($wrappedObjectProperty, $lazyPropertiesProperty, $initializerProperty) { |
|
54 | 54 | return MethodProxy::generateMethod( |
55 | 55 | new MethodReflection($method->getDeclaringClass()->name, $method->name), |
56 | 56 | $wrappedObjectProperty, |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'factory' => get_class($this), |
111 | 111 | 'proxyManagerVersion' => Version::VERSION |
112 | 112 | ); |
113 | - $proxyClassName = $this |
|
113 | + $proxyClassName = $this |
|
114 | 114 | ->configuration |
115 | 115 | ->getClassNameInflector() |
116 | 116 | ->getProxyClassName($className, $proxyParameters); |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | private function generateProxyClass($proxyClassName, $className, array $proxyParameters) |
137 | 137 | { |
138 | 138 | if ($this->generationStrategy === self::GENERATE_NEVER) { |
139 | - return ; |
|
139 | + return; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | if ($this->generationStrategy === self::GENERATE_WHEN_NOT_EXISTS && class_exists($proxyClassName)) { |
143 | - return ; |
|
143 | + return; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | $className = $this->configuration->getClassNameInflector()->getUserClassName($className); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $wrappedObject = $wrappedObjectProperty->getName(); |
21 | 21 | $initializer = $initializerProperty->getName(); |
22 | 22 | $lazyProperties = $lazyPropertiesProperty->getName(); |
23 | - $methodReplacements = $methodReplacementsProperty->getName(); |
|
23 | + $methodReplacements = $methodReplacementsProperty->getName(); |
|
24 | 24 | |
25 | 25 | $this->setBody(sprintf( |
26 | 26 | "return array(\"%s\", \"%s\", \"%s\", \"%s\");", |
@@ -13,9 +13,9 @@ |
||
13 | 13 | public function __construct(PropertyGenerator $lazyPropertiesProperty) |
14 | 14 | { |
15 | 15 | parent::__construct('getLazyProperties'); |
16 | - $lazyPropertiesProperty = $lazyPropertiesProperty->getName(); |
|
16 | + $lazyPropertiesProperty = $lazyPropertiesProperty->getName(); |
|
17 | 17 | $this->setDocblock('{@inheritDoc}'); |
18 | 18 | |
19 | - $this->setBody("return \$this->" . $lazyPropertiesProperty . ";"); |
|
19 | + $this->setBody("return \$this->".$lazyPropertiesProperty.";"); |
|
20 | 20 | } |
21 | 21 | } |
@@ -26,20 +26,20 @@ |
||
26 | 26 | $params = []; |
27 | 27 | |
28 | 28 | foreach ($originalMethod->getParameters() as $parameter) { |
29 | - $paramName = '$' . $parameter->name; |
|
29 | + $paramName = '$'.$parameter->name; |
|
30 | 30 | $forwardedParams[] = $paramName; |
31 | - $params[] = var_export($parameter->name, true) . ' => ' . $paramName; |
|
31 | + $params[] = var_export($parameter->name, true).' => '.$paramName; |
|
32 | 32 | } |
33 | 33 | |
34 | - $paramsString = 'array(' . implode(', ', $params) . ')'; |
|
34 | + $paramsString = 'array('.implode(', ', $params).')'; |
|
35 | 35 | |
36 | - $methodBody = '$this->' . $initializerProperty->getName() . "->initialize(\$this->" . $lazyPropertiesProperty->getName() . ", \"" . $method->getName() . "\", \$this->" . $wrappedObjectProperty->getName() . ");\n\n" |
|
37 | - . 'if ($this->hasMethodReplacement("' . $method->getName() . '")) {' . "\n" |
|
38 | - . ' return $this->getMethodReplacement("' . $method->getName() .'")->getReplacement()->execute($this, "' . $method->getName() . '", ' . $paramsString . ');' . "\n" |
|
39 | - . '}' . "\n\n" |
|
40 | - . '$result = $this->' . $wrappedObjectProperty->getName() . '->' . $method->getName() . '(' . implode(', ', $forwardedParams) . ');' . "\n" |
|
41 | - . 'if ($result === $this->' . $wrappedObjectProperty->getName() . ') {' ."\n" |
|
42 | - . ' return $this;' . "\n" |
|
36 | + $methodBody = '$this->'.$initializerProperty->getName()."->initialize(\$this->".$lazyPropertiesProperty->getName().", \"".$method->getName()."\", \$this->".$wrappedObjectProperty->getName().");\n\n" |
|
37 | + . 'if ($this->hasMethodReplacement("'.$method->getName().'")) {'."\n" |
|
38 | + . ' return $this->getMethodReplacement("'.$method->getName().'")->getReplacement()->execute($this, "'.$method->getName().'", '.$paramsString.');'."\n" |
|
39 | + . '}'."\n\n" |
|
40 | + . '$result = $this->'.$wrappedObjectProperty->getName().'->'.$method->getName().'('.implode(', ', $forwardedParams).');'."\n" |
|
41 | + . 'if ($result === $this->'.$wrappedObjectProperty->getName().') {'."\n" |
|
42 | + . ' return $this;'."\n" |
|
43 | 43 | . "}\n\n" |
44 | 44 | . 'return $result;'; |
45 | 45 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $this->setParameter($methodReplacementsArg); |
36 | 36 | |
37 | 37 | $this->setBody( |
38 | - '$this->' . $wrappedObjectProperty->getName() . " = \$wrappedObject;\n" |
|
38 | + '$this->' . $wrappedObjectProperty->getName() . " = \$wrappedObject;\n" |
|
39 | 39 | . '$this->' . $lazyPropertiesProperty->getName() . " = \$lazyProperties;\n" |
40 | 40 | . '$this->' . $methodReplacementsProperty->getName() . " = \$methodReplacements;\n" |
41 | 41 | . '$this->' . $initializerProperty->getName() . " = new \\Isolate\\LazyObjects\\Object\\Property\\Initializer();\n" |
@@ -35,11 +35,11 @@ |
||
35 | 35 | $this->setParameter($methodReplacementsArg); |
36 | 36 | |
37 | 37 | $this->setBody( |
38 | - '$this->' . $wrappedObjectProperty->getName() . " = \$wrappedObject;\n" |
|
39 | - . '$this->' . $lazyPropertiesProperty->getName() . " = \$lazyProperties;\n" |
|
40 | - . '$this->' . $methodReplacementsProperty->getName() . " = \$methodReplacements;\n" |
|
41 | - . '$this->' . $initializerProperty->getName() . " = new \\Isolate\\LazyObjects\\Object\\Property\\Initializer();\n" |
|
42 | - . '$this->' . $initializerProperty->getName() . "->initialize(\$this->" . $lazyPropertiesProperty->getName() . ", \"__construct\", \$this->" . $wrappedObjectProperty->getName() . ");\n" |
|
38 | + '$this->'.$wrappedObjectProperty->getName()." = \$wrappedObject;\n" |
|
39 | + . '$this->'.$lazyPropertiesProperty->getName()." = \$lazyProperties;\n" |
|
40 | + . '$this->'.$methodReplacementsProperty->getName()." = \$methodReplacements;\n" |
|
41 | + . '$this->'.$initializerProperty->getName()." = new \\Isolate\\LazyObjects\\Object\\Property\\Initializer();\n" |
|
42 | + . '$this->'.$initializerProperty->getName()."->initialize(\$this->".$lazyPropertiesProperty->getName().", \"__construct\", \$this->".$wrappedObjectProperty->getName().");\n" |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $this->setParameter(new ParameterGenerator('methodName')); |
21 | 21 | |
22 | 22 | $body = |
23 | - "foreach (\$this->$methodReplacementsProperty as \$replacementDefinition) {\n" |
|
23 | + "foreach (\$this->$methodReplacementsProperty as \$replacementDefinition) {\n" |
|
24 | 24 | . " if (\$replacementDefinition->getMethod()->isEqualTo(\$methodName)) {\n" |
25 | 25 | . " return \$replacementDefinition;\n" |
26 | 26 | . " }\n" |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public function __construct(PropertyGenerator $methodReplacementsProperty) |
15 | 15 | { |
16 | 16 | parent::__construct('getMethodReplacement'); |
17 | - $methodReplacementsProperty = $methodReplacementsProperty->getName(); |
|
17 | + $methodReplacementsProperty = $methodReplacementsProperty->getName(); |
|
18 | 18 | $this->setVisibility(self::VISIBILITY_PRIVATE); |
19 | 19 | |
20 | 20 | $this->setParameter(new ParameterGenerator('methodName')); |
@@ -13,9 +13,9 @@ |
||
13 | 13 | public function __construct(PropertyGenerator $methodReplacementsProperty) |
14 | 14 | { |
15 | 15 | parent::__construct('getMethodReplacements'); |
16 | - $methodReplacementsProperty = $methodReplacementsProperty->getName(); |
|
16 | + $methodReplacementsProperty = $methodReplacementsProperty->getName(); |
|
17 | 17 | $this->setDocblock('{@inheritDoc}'); |
18 | 18 | |
19 | - $this->setBody("return \$this->" . $methodReplacementsProperty . ";"); |
|
19 | + $this->setBody("return \$this->".$methodReplacementsProperty.";"); |
|
20 | 20 | } |
21 | 21 | } |