@@ -28,34 +28,34 @@ final class ProxyHelper
2828 public static function generateLazyGhost (\ReflectionClass $ class ): string
2929 {
3030 if (\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 ()) {
37- throw new LogicException (sprintf ('Cannot generate lazy ghost: "%s" is not a concrete class. ' , $ class ->name ));
37+ 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 $ propertyScopes = self ::exportPropertyScopes ($ class ->name );
@@ -86,19 +86,19 @@ class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class);
8686 public static function generateLazyProxy (?\ReflectionClass $ class , array $ interfaces = []): string
8787 {
8888 if (!class_exists ($ class ?->name ?? \stdClass::class, false )) {
89- throw new LogicException (sprintf ('Cannot generate lazy proxy: "%s" is not a class. ' , $ class ->name ));
89+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: "%s" is not a class. ' , $ class ->name ));
9090 }
9191 if ($ class ?->isFinal()) {
92- throw new LogicException (sprintf ('Cannot generate lazy proxy: class "%s" is final. ' , $ class ->name ));
92+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: class "%s" is final. ' , $ class ->name ));
9393 }
9494 if (\PHP_VERSION_ID < 80300 && $ class ?->isReadOnly()) {
95- throw new LogicException (sprintf ('Cannot generate lazy proxy with PHP < 8.3: class "%s" is readonly. ' , $ class ->name ));
95+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy with PHP < 8.3: class "%s" is readonly. ' , $ class ->name ));
9696 }
9797
9898 $ methodReflectors = [$ class ?->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED ) ?? []];
9999 foreach ($ interfaces as $ interface ) {
100100 if (!$ interface ->isInterface ()) {
101- throw new LogicException (sprintf ('Cannot generate lazy proxy: "%s" is not an interface. ' , $ interface ->name ));
101+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: "%s" is not an interface. ' , $ interface ->name ));
102102 }
103103 $ methodReflectors [] = $ interface ->getMethods ();
104104 }
@@ -134,7 +134,7 @@ public static function generateLazyProxy(?\ReflectionClass $class, array $interf
134134 }
135135 if ($ method ->isFinal ()) {
136136 if ($ extendsInternalClass || $ methodsHaveToBeProxied || method_exists (LazyProxyTrait::class, $ method ->name )) {
137- throw new LogicException (sprintf ('Cannot generate lazy proxy: method "%s::%s()" is final. ' , $ class ->name , $ method ->name ));
137+ throw new LogicException (\ sprintf ('Cannot generate lazy proxy: method "%s::%s()" is final. ' , $ class ->name , $ method ->name ));
138138 }
139139 continue ;
140140 }
@@ -239,7 +239,7 @@ public static function exportSignature(\ReflectionFunctionAbstract $function, bo
239239 $ args = substr ($ args , 0 , -2 );
240240 } else {
241241 $ args = explode (', ' , $ args , 1 + $ byRefIndex );
242- $ args [$ byRefIndex ] = sprintf ('...\array_slice(\func_get_args(), %d) ' , $ byRefIndex );
242+ $ args [$ byRefIndex ] = \ sprintf ('...\array_slice(\func_get_args(), %d) ' , $ byRefIndex );
243243 $ args = implode (', ' , $ args );
244244 }
245245
0 commit comments