Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3282171
ArcanistClassExtendsObjectXHPASTLinterRule.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
ArcanistClassExtendsObjectXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistClassExtendsObjectXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
88
;
public
function
getLintName
(
)
{
return
pht
(
'Class Not Extending `%s`'
,
'Phobject'
)
;
}
public
function
getLintSeverity
(
)
{
return
ArcanistLintSeverity
::
SEVERITY_DISABLED
;
}
public
function
process
(
XHPASTNode
$root
)
{
$classes
=
$root
->
selectDescendantsOfType
(
'n_CLASS_DECLARATION'
)
;
foreach
(
$classes
as
$class
)
{
// TODO: This doesn't quite work for namespaced classes (see T8534).
$name
=
$class
->
getChildOfType
(
1
,
'n_CLASS_NAME'
)
;
$extends
=
$class
->
getChildByIndex
(
2
)
;
if
(
$name
->
getConcreteString
(
)
==
'Phobject'
)
{
continue
;
}
if
(
$extends
->
getTypeName
(
)
==
'n_EMPTY'
)
{
$this
->
raiseLintAtNode
(
$class
,
pht
(
'Classes should extend from `%s` or from some other class. '
.
'All classes (except for `%s` itself) should have a base class.'
,
'Phobject'
,
'Phobject'
)
)
;
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Mar 24, 05:45 (4 d, 4 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1124097
Default Alt Text
ArcanistClassExtendsObjectXHPASTLinterRule.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment