Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2892083
ArcanistImplicitConstructorXHPASTLinterRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
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
Sun, Jan 19, 16:12 (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1120988
Default Alt Text
ArcanistImplicitConstructorXHPASTLinterRule.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment