@@ -28,34 +28,34 @@ final class ProxyHelper
2828 public static function generateLazyGhost (\ReflectionClass $ class ): string
2929 {
3030 if (\PHP_VERSION_ID >= 80200 && \PHP_VERSION_ID < 80300 && $ class ->isReadOnly ()) {
31- throw new LogicException (sprintf ('Cannot generate lazy ghost with PHP < 8.3: class "%s" is readonly. ' , $ class ->name ));
31+ throw new LogicException (\ sprintf ('Cannot generate lazy ghost with PHP < 8.3: class "%s" is readonly. ' , $ class ->name ));
3232 }
3333 if ($ class ->isFinal ()) {
34- throw new LogicException (sprintf ('Cannot generate lazy ghost: class "%s" is final. ' , $ class ->name ));
34+ throw new LogicException (\ sprintf ('Cannot generate lazy ghost: class "%s" is final. ' , $ class ->name ));
3535 }
3636 if ($ class ->isInterface () || $ class ->isAbstract () || $ class ->isTrait ()) {
3737 throw new LogicException (\sprintf ('Cannot generate lazy ghost: "%s" is not a concrete class. ' , $ class ->name ));
3838 }
3939 if (\stdClass::class !== $ class ->name && $ class ->isInternal ()) {
40- throw new LogicException (sprintf ('Cannot generate lazy ghost: class "%s" is internal. ' , $ class ->name ));
40+ throw new LogicException (\ sprintf ('Cannot generate lazy ghost: class "%s" is internal. ' , $ class ->name ));
4141 }
4242 if ($ class ->hasMethod ('__get ' ) && 'mixed ' !== (self ::exportType ($ class ->getMethod ('__get ' )) ?? 'mixed ' )) {
43- throw new LogicException (sprintf ('Cannot generate lazy ghost: return type of method "%s::__get()" should be "mixed". ' , $ class ->name ));
43+ throw new LogicException (\ sprintf ('Cannot generate lazy ghost: return type of method "%s::__get()" should be "mixed". ' , $ class ->name ));
4444 }
4545
4646 static $ traitMethods ;
4747 $ traitMethods ??= (new \ReflectionClass (LazyGhostTrait::class))->getMethods ();
4848
4949 foreach ($ traitMethods as $ method ) {
5050 if ($ class ->hasMethod ($ method ->name ) && $ class ->getMethod ($ method ->name )->isFinal ()) {
51- throw new LogicException (sprintf ('Cannot generate lazy ghost: method "%s::%s()" is final. ' , $ class ->name , $ method ->name ));
51+ throw new LogicException (\ sprintf ('Cannot generate lazy ghost: method "%s::%s()" is final. ' , $ class ->name , $ method ->name ));
5252 }
5353 }
5454
5555 $ parent = $ class ;
5656 while ($ parent = $ parent ->getParentClass ()) {
5757 if (\stdClass::class !== $ parent ->name && $ parent ->isInternal ()) {
58- throw new LogicException (sprintf ('Cannot generate lazy ghost: class "%s" extends "%s" which is internal. ' , $ class ->name , $ parent ->name ));
58+ throw new LogicException (\ sprintf ('Cannot generate lazy ghost: class "%s" extends "%s" which is internal. ' , $ class ->name , $ parent ->name ));
5959 }
6060 }
6161
@@ -70,7 +70,7 @@ public static function generateLazyGhost(\ReflectionClass $class): string
7070 }
7171
7272 if ($ flags & (\ReflectionProperty::IS_FINAL | \ReflectionProperty::IS_PRIVATE )) {
73- throw new LogicException (sprintf ('Cannot generate lazy ghost: property "%s::$%s" is final or private(set). ' , $ class ->name , $ name ));
73+ throw new LogicException (\ sprintf ('Cannot generate lazy ghost: property "%s::$%s" is final or private(set). ' , $ class ->name , $ name ));
7474 }
7575
7676 $ p = $ propertyScopes [$ k ][4 ] ?? Hydrator::$ propertyScopes [$ class ->name ][$ k ][4 ] = new \ReflectionProperty ($ scope , $ name );
@@ -92,7 +92,7 @@ public static function generateLazyGhost(\ReflectionClass $class): string
9292 $ arg = '$ ' .$ method ->getParameters ()[0 ]->name ;
9393 $ hooks .= " set( {$ parameters }) { \$this->initializeLazyObject(); parent:: \${$ name }::set( {$ arg }); } \n" ;
9494 } else {
95- throw new LogicException (sprintf ('Cannot generate lazy ghost: hook "%s::%s()" is not supported. ' , $ class ->name , $ method ->name ));
95+ throw new LogicException (\ sprintf ('Cannot generate lazy ghost: hook "%s::%s()" is not supported. ' , $ class ->name , $ method ->name ));
9696 }
9797 }
9898
@@ -127,13 +127,13 @@ class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class);
127127 public static function generateLazyProxy (?\ReflectionClass $ class , array $ interfaces = []): string
128128 {
129129 if (!class_exists ($ class ?->name ?? \stdClass::class, false )) {
130- throw new LogicException (sprintf ('Cannot generate lazy proxy: "%s" is not a class. ' , $ class ->name ));
130+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: "%s" is not a class. ' , $ class ->name ));
131131 }
132132 if ($ class ?->isFinal()) {
133- throw new LogicException (sprintf ('Cannot generate lazy proxy: class "%s" is final. ' , $ class ->name ));
133+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: class "%s" is final. ' , $ class ->name ));
134134 }
135135 if (\PHP_VERSION_ID >= 80200 && \PHP_VERSION_ID < 80300 && $ class ?->isReadOnly()) {
136- throw new LogicException (sprintf ('Cannot generate lazy proxy with PHP < 8.3: class "%s" is readonly. ' , $ class ->name ));
136+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy with PHP < 8.3: class "%s" is readonly. ' , $ class ->name ));
137137 }
138138
139139 $ propertyScopes = $ class ? Hydrator::$ propertyScopes [$ class ->name ] ??= Hydrator::getPropertyScopes ($ class ->name ) : [];
@@ -159,7 +159,7 @@ public static function generateLazyProxy(?\ReflectionClass $class, array $interf
159159 }
160160
161161 if ($ flags & (\ReflectionProperty::IS_FINAL | \ReflectionProperty::IS_PRIVATE )) {
162- throw new LogicException (sprintf ('Cannot generate lazy proxy: property "%s::$%s" is final or private(set). ' , $ class ->name , $ name ));
162+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: property "%s::$%s" is final or private(set). ' , $ class ->name , $ name ));
163163 }
164164
165165 $ p = $ propertyScopes [$ k ][4 ] ?? Hydrator::$ propertyScopes [$ class ->name ][$ k ][4 ] = new \ReflectionProperty ($ scope , $ name );
@@ -170,7 +170,7 @@ public static function generateLazyProxy(?\ReflectionClass $class, array $interf
170170 $ methodReflectors = [$ class ?->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED ) ?? []];
171171 foreach ($ interfaces as $ interface ) {
172172 if (!$ interface ->isInterface ()) {
173- throw new LogicException (sprintf ('Cannot generate lazy proxy: "%s" is not an interface. ' , $ interface ->name ));
173+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: "%s" is not an interface. ' , $ interface ->name ));
174174 }
175175 $ methodReflectors [] = $ interface ->getMethods ();
176176
@@ -228,7 +228,7 @@ public static function generateLazyProxy(?\ReflectionClass $class, array $interf
228228
229229 EOPHP ;
230230 } else {
231- throw new LogicException (sprintf ('Cannot generate lazy proxy: hook "%s::%s()" is not supported. ' , $ class ->name , $ method ->name ));
231+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: hook "%s::%s()" is not supported. ' , $ class ->name , $ method ->name ));
232232 }
233233 }
234234
@@ -266,7 +266,7 @@ public static function generateLazyProxy(?\ReflectionClass $class, array $interf
266266 }
267267 if ($ method ->isFinal ()) {
268268 if ($ extendsInternalClass || $ methodsHaveToBeProxied || method_exists (LazyProxyTrait::class, $ method ->name )) {
269- throw new LogicException (sprintf ('Cannot generate lazy proxy: method "%s::%s()" is final. ' , $ class ->name , $ method ->name ));
269+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: method "%s::%s()" is final. ' , $ class ->name , $ method ->name ));
270270 }
271271 continue ;
272272 }
@@ -396,7 +396,7 @@ public static function exportParameters(\ReflectionFunctionAbstract $function, b
396396 $ args = substr ($ args , 0 , -2 );
397397 } else {
398398 $ args = explode (', ' , $ args , 1 + $ byRefIndex );
399- $ args [$ byRefIndex ] = sprintf ('...\array_slice(\func_get_args(), %d) ' , $ byRefIndex );
399+ $ args [$ byRefIndex ] = \ sprintf ('...\array_slice(\func_get_args(), %d) ' , $ byRefIndex );
400400 $ args = implode (', ' , $ args );
401401 }
402402
0 commit comments