@@ -3860,40 +3860,31 @@ private function processArgs(
3860
3860
3861
3861
$ byRefType = new MixedType ();
3862
3862
$ assignByReference = false ;
3863
+ $ currentParameter = null ;
3863
3864
if (isset ($ parameters [$ i ])) {
3864
- $ assignByReference = $ parameters [$ i ]->passedByReference ()->createsNewVariable ();
3865
- if ($ parameters [$ i ] instanceof ParameterReflectionWithPhpDocs && $ parameters [$ i ]->getOutType () !== null ) {
3866
- $ byRefType = $ parameters [$ i ]->getOutType ();
3867
- } elseif (
3868
- $ calleeReflection instanceof MethodReflection
3869
- && !$ calleeReflection ->getDeclaringClass ()->isBuiltin ()
3870
- && $ this ->paramOutType
3871
- ) {
3872
- $ byRefType = $ parameters [$ i ]->getType ();
3873
- } elseif (
3874
- $ calleeReflection instanceof FunctionReflection
3875
- && !$ calleeReflection ->isBuiltin ()
3876
- && $ this ->paramOutType
3877
- ) {
3878
- $ byRefType = $ parameters [$ i ]->getType ();
3879
- }
3865
+ $ currentParameter = $ parameters [$ i ];
3880
3866
} elseif (count ($ parameters ) > 0 && $ parametersAcceptor ->isVariadic ()) {
3881
- $ lastParameter = $ parameters [count ($ parameters ) - 1 ];
3882
- $ assignByReference = $ lastParameter ->passedByReference ()->createsNewVariable ();
3883
- if ($ lastParameter instanceof ParameterReflectionWithPhpDocs && $ lastParameter ->getOutType () !== null ) {
3884
- $ byRefType = $ lastParameter ->getOutType ();
3885
- } elseif (
3886
- $ calleeReflection instanceof MethodReflection
3887
- && !$ calleeReflection ->getDeclaringClass ()->isBuiltin ()
3888
- && $ this ->paramOutType
3889
- ) {
3890
- $ byRefType = $ lastParameter ->getType ();
3891
- } elseif (
3892
- $ calleeReflection instanceof FunctionReflection
3893
- && !$ calleeReflection ->isBuiltin ()
3894
- && $ this ->paramOutType
3895
- ) {
3896
- $ byRefType = $ lastParameter ->getType ();
3867
+ $ currentParameter = $ parameters [count ($ parameters ) - 1 ];
3868
+ }
3869
+
3870
+ if ($ currentParameter !== null ) {
3871
+ $ assignByReference = $ currentParameter ->passedByReference ()->createsNewVariable ();
3872
+ if ($ assignByReference ) {
3873
+ if ($ currentParameter instanceof ParameterReflectionWithPhpDocs && $ currentParameter ->getOutType () !== null ) {
3874
+ $ byRefType = $ currentParameter ->getOutType ();
3875
+ } elseif (
3876
+ $ calleeReflection instanceof MethodReflection
3877
+ && !$ calleeReflection ->getDeclaringClass ()->isBuiltin ()
3878
+ && $ this ->paramOutType
3879
+ ) {
3880
+ $ byRefType = $ currentParameter ->getType ();
3881
+ } elseif (
3882
+ $ calleeReflection instanceof FunctionReflection
3883
+ && !$ calleeReflection ->isBuiltin ()
3884
+ && $ this ->paramOutType
3885
+ ) {
3886
+ $ byRefType = $ currentParameter ->getType ();
3887
+ }
3897
3888
}
3898
3889
}
3899
3890
0 commit comments