@@ -48,17 +48,17 @@ public function __construct()
4848 */
4949 public function build ($ functionName = null )
5050 {
51+ $ functionNameOrEmptyString = $ functionName === null ? '' : $ functionName ;
52+
5153 $ parameterBuilder = new ParameterBuilder ();
52- $ parameterBuilder ->build ($ functionName === null ? '' : $ functionName );
54+ $ parameterBuilder ->build ($ functionNameOrEmptyString );
5355 $ signatureParameters = $ parameterBuilder ->getSignatureParameters ();
5456
55- $ populatedFunctionName = $ functionName === null ? '_dummy ' : $ functionName ;
56-
5757 /**
5858 * If a class with the same signature exists, it is considered equivalent
5959 * to the generated class.
6060 */
61- $ hash = md5 ($ populatedFunctionName . $ signatureParameters );
61+ $ hash = md5 ($ functionNameOrEmptyString . $ signatureParameters );
6262 $ this ->namespace = __NAMESPACE__ . $ hash ;
6363 if (class_exists ($ this ->getFullyQualifiedClassName ())) {
6464 return ;
@@ -67,7 +67,7 @@ public function build($functionName = null)
6767 $ data = [
6868 "namespace " => $ this ->namespace ,
6969 "signatureParameters " => $ signatureParameters ,
70- "functionName " => $ populatedFunctionName ,
70+ "function " => $ functionName === null ? '' : ' public function ' . $ functionName . ' () {} ' ,
7171 ];
7272 $ this ->template ->setVar ($ data , false );
7373 $ definition = $ this ->template ->render ();
0 commit comments