File tree Expand file tree Collapse file tree 4 files changed +7
-11
lines changed Expand file tree Collapse file tree 4 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 15
15
],
16
16
"require" : {
17
17
"php" : " >=5.6.0" ,
18
- "nette/utils" : " ~ 2.4"
18
+ "nette/utils" : " ^ 2.4.2 "
19
19
},
20
20
"require-dev" : {
21
21
"nette/tester" : " ~2.0" ,
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ public function isAbstract()
226
226
*/
227
227
public function setExtends ($ types )
228
228
{
229
- if (!is_string ($ types ) && !(is_array ($ types ) && array_filter ($ types , 'is_string ' ) === $ types )) {
229
+ if (!is_string ($ types ) && !(is_array ($ types ) && Nette \ Utils \Arrays:: every ($ types , 'is_string ' ))) {
230
230
throw new Nette \InvalidArgumentException ('Argument must be string or string[]. ' );
231
231
}
232
232
$ this ->extends = $ types ;
@@ -535,7 +535,7 @@ public function addMethod($name)
535
535
{
536
536
$ method = (new Method ($ name ))->setNamespace ($ this ->namespace );
537
537
if ($ this ->type === 'interface ' ) {
538
- $ method ->setVisibility ( NULL )-> setBody (FALSE );
538
+ $ method ->setBody (FALSE );
539
539
} else {
540
540
$ method ->setVisibility ('public ' );
541
541
}
Original file line number Diff line number Diff line change @@ -39,13 +39,13 @@ public function fromClassReflection(\ReflectionClass $from)
39
39
$ props = $ methods = [];
40
40
foreach ($ from ->getProperties () as $ prop ) {
41
41
if ($ prop ->isDefault () && $ prop ->getDeclaringClass ()->getName () === $ from ->getName ()) {
42
- $ props [$ prop -> getName () ] = $ this ->fromPropertyReflection ($ prop );
42
+ $ props [] = $ this ->fromPropertyReflection ($ prop );
43
43
}
44
44
}
45
45
$ class ->setProperties ($ props );
46
46
foreach ($ from ->getMethods () as $ method ) {
47
47
if ($ method ->getDeclaringClass ()->getName () === $ from ->getName ()) {
48
- $ methods [$ method -> getName () ] = $ this ->fromFunctionReflection ($ method )->setNamespace ($ class ->getNamespace ());
48
+ $ methods [] = $ this ->fromFunctionReflection ($ method )->setNamespace ($ class ->getNamespace ());
49
49
}
50
50
}
51
51
$ class ->setMethods ($ methods );
@@ -59,11 +59,7 @@ public function fromClassReflection(\ReflectionClass $from)
59
59
public function fromFunctionReflection (\ReflectionFunctionAbstract $ from )
60
60
{
61
61
$ method = new Method ($ from ->isClosure () ? NULL : $ from ->getName ());
62
- $ params = [];
63
- foreach ($ from ->getParameters () as $ param ) {
64
- $ params [$ param ->getName ()] = $ this ->fromParameterReflection ($ param );
65
- }
66
- $ method ->setParameters ($ params );
62
+ $ method ->setParameters (array_map ([$ this , 'fromParameterReflection ' ], $ from ->getParameters ()));
67
63
if ($ from instanceof \ReflectionMethod) {
68
64
$ isInterface = $ from ->getDeclaringClass ()->isInterface ();
69
65
$ method ->setStatic ($ from ->isStatic ());
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class Method extends Member
20
20
/** @var array of name => Parameter */
21
21
private $ parameters = [];
22
22
23
- /** @var array of name => bool */
23
+ /** @var Parameter[] */
24
24
private $ uses = [];
25
25
26
26
/** @var string|FALSE */
You can’t perform that action at this time.
0 commit comments