Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
91b6e294
Commit
91b6e294
authored
Sep 12, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the support for calling anonymous function returned as a property value.
parent
a2b946e4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
23 deletions
+2
-23
Component.php
framework/yii/base/Component.php
+2
-10
Object.php
framework/yii/base/Object.php
+0
-8
ObjectTest.php
tests/unit/framework/base/ObjectTest.php
+0
-5
No files found.
framework/yii/base/Component.php
View file @
91b6e294
...
...
@@ -179,9 +179,8 @@ class Component extends Object
/**
* Calls the named method which is not a class method.
* If the name refers to a component property whose value is
* an anonymous function, the method will execute the function.
* Otherwise, it will check if any attached behavior has
*
* This method will check if any attached behavior has
* the named method and will execute it if available.
*
* Do not call this method directly as it is a PHP magic method that
...
...
@@ -193,13 +192,6 @@ class Component extends Object
*/
public
function
__call
(
$name
,
$params
)
{
if
(
$this
->
canGetProperty
(
$name
))
{
$func
=
$this
->
$name
;
if
(
$func
instanceof
\Closure
)
{
return
call_user_func_array
(
$func
,
$params
);
}
}
$this
->
ensureBehaviors
();
foreach
(
$this
->
_behaviors
as
$object
)
{
if
(
$object
->
hasMethod
(
$name
))
{
...
...
framework/yii/base/Object.php
View file @
91b6e294
...
...
@@ -143,8 +143,6 @@ class Object implements Arrayable
/**
* Calls the named method which is not a class method.
* If the name refers to a component property whose value is
* an anonymous function, the method will execute the function.
*
* Do not call this method directly as it is a PHP magic method that
* will be implicitly called when an unknown method is being invoked.
...
...
@@ -155,12 +153,6 @@ class Object implements Arrayable
*/
public
function
__call
(
$name
,
$params
)
{
if
(
$this
->
canGetProperty
(
$name
))
{
$func
=
$this
->
$name
;
if
(
$func
instanceof
\Closure
)
{
return
call_user_func_array
(
$func
,
$params
);
}
}
throw
new
UnknownMethodException
(
'Unknown method: '
.
get_class
(
$this
)
.
"::
$name
()"
);
}
...
...
tests/unit/framework/base/ObjectTest.php
View file @
91b6e294
...
...
@@ -134,11 +134,6 @@ class ObjectTest extends TestCase
$this
->
assertEquals
(
'new text'
,
$this
->
object
->
object
->
text
);
}
public
function
testAnonymousFunctionProperty
()
{
$this
->
assertEquals
(
2
,
$this
->
object
->
execute
(
1
));
}
public
function
testConstruct
()
{
$object
=
new
NewObject
(
array
(
'text'
=>
'test text'
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment