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 1515 ],
1616 "require" : {
1717 "php" : " >=5.6.0" ,
18- "nette/utils" : " ~ 2.4"
18+ "nette/utils" : " ^ 2.4.2 "
1919 },
2020 "require-dev" : {
2121 "nette/tester" : " ~2.0" ,
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ public function isAbstract()
226226 */
227227 public function setExtends ($ types )
228228 {
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 ' ))) {
230230 throw new Nette \InvalidArgumentException ('Argument must be string or string[]. ' );
231231 }
232232 $ this ->extends = $ types ;
@@ -535,7 +535,7 @@ public function addMethod($name)
535535 {
536536 $ method = (new Method ($ name ))->setNamespace ($ this ->namespace );
537537 if ($ this ->type === 'interface ' ) {
538- $ method ->setVisibility ( NULL )-> setBody (FALSE );
538+ $ method ->setBody (FALSE );
539539 } else {
540540 $ method ->setVisibility ('public ' );
541541 }
Original file line number Diff line number Diff line change @@ -39,13 +39,13 @@ public function fromClassReflection(\ReflectionClass $from)
3939 $ props = $ methods = [];
4040 foreach ($ from ->getProperties () as $ prop ) {
4141 if ($ prop ->isDefault () && $ prop ->getDeclaringClass ()->getName () === $ from ->getName ()) {
42- $ props [$ prop -> getName () ] = $ this ->fromPropertyReflection ($ prop );
42+ $ props [] = $ this ->fromPropertyReflection ($ prop );
4343 }
4444 }
4545 $ class ->setProperties ($ props );
4646 foreach ($ from ->getMethods () as $ method ) {
4747 if ($ method ->getDeclaringClass ()->getName () === $ from ->getName ()) {
48- $ methods [$ method -> getName () ] = $ this ->fromFunctionReflection ($ method )->setNamespace ($ class ->getNamespace ());
48+ $ methods [] = $ this ->fromFunctionReflection ($ method )->setNamespace ($ class ->getNamespace ());
4949 }
5050 }
5151 $ class ->setMethods ($ methods );
@@ -59,11 +59,7 @@ public function fromClassReflection(\ReflectionClass $from)
5959 public function fromFunctionReflection (\ReflectionFunctionAbstract $ from )
6060 {
6161 $ 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 ()));
6763 if ($ from instanceof \ReflectionMethod) {
6864 $ isInterface = $ from ->getDeclaringClass ()->isInterface ();
6965 $ method ->setStatic ($ from ->isStatic ());
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class Method extends Member
2020 /** @var array of name => Parameter */
2121 private $ parameters = [];
2222
23- /** @var array of name => bool */
23+ /** @var Parameter[] */
2424 private $ uses = [];
2525
2626 /** @var string|FALSE */
You can’t perform that action at this time.
0 commit comments