Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22418634
ArcanistImplicitConstructorXHPASTLinterRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
ArcanistImplicitConstructorXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistImplicitConstructorXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
10
;
public
function
getLintName
()
{
return
pht
(
'Implicit Constructor'
);
}
public
function
process
(
XHPASTNode
$root
)
{
$classes
=
$root
->
selectDescendantsOfType
(
'n_CLASS_DECLARATION'
);
foreach
(
$classes
as
$class
)
{
$class_name
=
$class
->
getChildByIndex
(
1
)->
getConcreteString
();
$methods
=
$class
->
selectDescendantsOfType
(
'n_METHOD_DECLARATION'
);
foreach
(
$methods
as
$method
)
{
$method_name_token
=
$method
->
getChildByIndex
(
2
);
$method_name
=
$method_name_token
->
getConcreteString
();
if
(
strtolower
(
$class_name
)
===
strtolower
(
$method_name
))
{
$this
->
raiseLintAtNode
(
$method_name_token
,
pht
(
'Name constructors `%s` explicitly. This method is a '
.
'constructor because it has the same name as the class '
.
'it is defined in.'
,
'__construct'
));
}
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 28, 02:15 (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1206080
Default Alt Text
ArcanistImplicitConstructorXHPASTLinterRule.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline