2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #include "hphp/hhbbc/class-util.h"
18 #include "hphp/runtime/base/collections.h"
19 #include "hphp/hhbbc/representation.h"
20 #include "hphp/hhbbc/index.h"
21 #include "hphp/hhbbc/type-system.h"
23 namespace HPHP
{ namespace HHBBC
{
25 //////////////////////////////////////////////////////////////////////
30 s_SimpleXMLElement("SimpleXMLElement"),
34 s_MockClass("__MockClass");
37 //////////////////////////////////////////////////////////////////////
39 bool has_magic_bool_conversion(SString clsName
) {
41 collections::isTypeName(clsName
) ||
42 clsName
->isame(s_SimpleXMLElement
.get());
45 bool is_collection(res::Class cls
) {
46 auto const name
= cls
.name();
47 return collections::isTypeName(name
);
50 borrowed_ptr
<php::Func
> find_method(borrowed_ptr
<const php::Class
> cls
,
52 for (auto& m
: cls
->methods
) {
53 if (m
->name
->isame(name
)) {
60 bool is_special_method_name(SString name
) {
61 auto const p
= name
->data();
62 return p
&& p
[0] == '8' && p
[1] == '6';
65 bool is_mock_class(borrowed_ptr
<const php::Class
> cls
) {
66 return cls
->userAttributes
.count(s_MockClass
.get());
69 bool is_closure(const php::Class
& c
) {
70 return c
.parentName
&& c
.parentName
->isame(s_Closure
.get());
73 //////////////////////////////////////////////////////////////////////