File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -493,7 +493,7 @@ public function addMethod($name)
493
493
{
494
494
$ method = (new Method ($ name ))->setNamespace ($ this ->namespace );
495
495
if ($ this ->type === 'interface ' ) {
496
- $ method ->setBody (FALSE );
496
+ $ method ->setBody (NULL );
497
497
} else {
498
498
$ method ->setVisibility ('public ' );
499
499
}
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public function fromMethodReflection(\ReflectionMethod $from)
65
65
$ method ->setVisibility ($ from ->isPrivate () ? 'private ' : ($ from ->isProtected () ? 'protected ' : ($ isInterface ? NULL : 'public ' )));
66
66
$ method ->setFinal ($ from ->isFinal ());
67
67
$ method ->setAbstract ($ from ->isAbstract () && !$ isInterface );
68
- $ method ->setBody ($ from ->isAbstract () ? FALSE : '' );
68
+ $ method ->setBody ($ from ->isAbstract () ? NULL : '' );
69
69
$ method ->setReturnReference ($ from ->returnsReference ());
70
70
$ method ->setVariadic ($ from ->isVariadic ());
71
71
$ method ->setComment (Helpers::unformatDocComment ((string ) $ from ->getDocComment ()));
Original file line number Diff line number Diff line change 15
15
/**
16
16
* Class method.
17
17
*
18
- * @property string|FALSE $body
18
+ * @property string|NULL $body
19
19
*/
20
20
class Method
21
21
{
@@ -25,6 +25,9 @@ class Method
25
25
use Traits \VisibilityAware;
26
26
use Traits \CommentAware;
27
27
28
+ /** @var string|NULL */
29
+ private $ body = '' ;
30
+
28
31
/** @var bool */
29
32
private $ static = FALSE ;
30
33
@@ -77,25 +80,29 @@ public function __toString()
77
80
. $ this ->name
78
81
. $ this ->parametersToString ()
79
82
. $ this ->returnTypeToString ()
80
- . ($ this ->abstract || $ this ->body === FALSE
83
+ . ($ this ->abstract || $ this ->body === NULL
81
84
? '; '
82
85
: "\n{ \n" . Nette \Utils \Strings::indent (ltrim (rtrim ($ this ->body ) . "\n" ), 1 ) . '} ' );
83
86
}
84
87
85
88
86
89
/**
87
- * @param string|FALSE
90
+ * @param string|NULL
88
91
* @return static
89
92
*/
90
93
public function setBody ($ code , array $ args = NULL )
91
94
{
95
+ if ($ code === FALSE ) {
96
+ $ code = NULL ;
97
+ trigger_error (__METHOD__ . '() use NULL instead of FALSE ' , E_USER_DEPRECATED );
98
+ }
92
99
$ this ->body = $ args === NULL ? $ code : Helpers::formatArgs ($ code , $ args );
93
100
return $ this ;
94
101
}
95
102
96
103
97
104
/**
98
- * @return string|FALSE
105
+ * @return string|NULL
99
106
*/
100
107
public function getBody ()
101
108
{
You can’t perform that action at this time.
0 commit comments