@@ -276,7 +276,7 @@ protected function generateConstants(MockDefinitionInterface $definition)
276276 $ source .= "\n const " .
277277 $ name .
278278 ' = ' .
279- (null === $ value ? 'null ' : var_export ($ value, true )) .
279+ (null === $ value ? 'null ' : $ this -> renderValue ($ value )) .
280280 '; ' ;
281281 }
282282
@@ -293,8 +293,9 @@ protected function generateConstants(MockDefinitionInterface $definition)
293293 *
294294 * @return string The source code.
295295 */
296- protected function generateMagicCallStatic (MockDefinitionInterface $ definition )
297- {
296+ protected function generateMagicCallStatic (
297+ MockDefinitionInterface $ definition
298+ ) {
298299 $ methods = $ definition ->methods ()->publicStaticMethods ();
299300
300301 if (!isset ($ methods ['__callStatic ' ])) {
@@ -408,11 +409,11 @@ protected function generateMethods(array $methods)
408409 foreach ($ signature as $ parameter ) {
409410 $ argumentPacking .= "\n if ( \$argumentCount > " .
410411 ++$ index .
411- ' ) $arguments[] = ' .
412+ " ) { \n \ $arguments[] = " .
412413 $ parameter [1 ] .
413414 '$a ' .
414415 $ index .
415- ' ; ' ;
416+ " ; \n } " ;
416417 }
417418 } else {
418419 $ argumentPacking = '' ;
@@ -539,8 +540,9 @@ public function __call(
539540 *
540541 * @return string The source code.
541542 */
542- protected function generateCallParentMethods (MockDefinitionInterface $ definition )
543- {
543+ protected function generateCallParentMethods (
544+ MockDefinitionInterface $ definition
545+ ) {
544546 $ hasTraits = (boolean ) $ definition ->traitNames ();
545547 $ parentClassName = $ definition ->parentClassName ();
546548 $ hasParentClass = null !== $ parentClassName ;
@@ -576,7 +578,7 @@ private static function _callTraitStatic(
576578 '_callTrait_' .
577579 \str_replace('\\', "\xc2\xa6", $traitName) .
578580 "\xc2\xbb" .
579- $name
581+ $name,
580582 ),
581583 $arguments->all()
582584 );
@@ -672,7 +674,7 @@ private function _callTrait(
672674 '_callTrait_' .
673675 \str_replace('\\', "\xc2\xa6", $traitName) .
674676 "\xc2\xbb" .
675- $name
677+ $name,
676678 ),
677679 $arguments->all()
678680 );
@@ -718,7 +720,7 @@ protected function generateProperties(MockDefinitionInterface $definition)
718720 "\n public static \$" .
719721 $ name .
720722 ' = ' .
721- (null === $ value ? 'null ' : var_export ($ value, true )) .
723+ (null === $ value ? 'null ' : $ this -> renderValue ($ value )) .
722724 '; ' ;
723725 }
724726
@@ -727,7 +729,7 @@ protected function generateProperties(MockDefinitionInterface $definition)
727729 "\n public \$" .
728730 $ name .
729731 ' = ' .
730- (null === $ value ? 'null ' : var_export ($ value, true )) .
732+ (null === $ value ? 'null ' : $ this -> renderValue ($ value )) .
731733 '; ' ;
732734 }
733735
@@ -747,15 +749,15 @@ protected function generateProperties(MockDefinitionInterface $definition)
747749 $ source .= "\n private static \$_uncallableMethods = " ;
748750
749751 if ($ uncallableMethodNames ) {
750- $ source .= var_export ($ uncallableMethodNames, true );
752+ $ source .= $ this -> renderValue ($ uncallableMethodNames );
751753 } else {
752754 $ source .= 'array() ' ;
753755 }
754756
755757 $ source .= "; \n private static \$_traitMethods = " ;
756758
757759 if ($ traitMethodNames ) {
758- $ source .= var_export ($ traitMethodNames, true );
760+ $ source .= $ this -> renderValue ($ traitMethodNames );
759761 } else {
760762 $ source .= 'array() ' ;
761763 }
@@ -767,6 +769,18 @@ protected function generateProperties(MockDefinitionInterface $definition)
767769 return $ source ;
768770 }
769771
772+ /**
773+ * Render the supplied value.
774+ *
775+ * @param mixed $value The value.
776+ *
777+ * @return string The rendered value.
778+ */
779+ protected function renderValue ($ value )
780+ {
781+ return str_replace ('array ( ' , 'array( ' , var_export ($ value , true ));
782+ }
783+
770784 private static $ instance ;
771785 private $ labelSequencer ;
772786 private $ signatureInspector ;
0 commit comments