Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 9d99e7a

Browse files
committed
Rename constants to match PSR-2 convention, closes #34
1 parent de094ec commit 9d99e7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+159
-151
lines changed

src/php_v8_enums.cc

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ PHP_MINIT_FUNCTION (php_v8_enums) {
4141
this_ce = zend_register_internal_class(&ce);
4242

4343
zend_declare_class_constant_long(this_ce, ZEND_STRL("DEFAULT_ACCESS"), v8::AccessControl::DEFAULT);
44-
zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_READ"), v8::AccessControl::ALL_CAN_READ);
45-
zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_WRITE"), v8::AccessControl::ALL_CAN_WRITE);
44+
zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_READ"), v8::AccessControl::ALL_CAN_READ);
45+
zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_WRITE"), v8::AccessControl::ALL_CAN_WRITE);
4646
#undef this_ce
4747

4848
//v8::ConstructorBehavior
4949
#define this_ce php_v8_constructor_behavior_class_entry
5050
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "ConstructorBehavior", php_v8_enum_methods);
5151
this_ce = zend_register_internal_class(&ce);
5252

53-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kThrow"), static_cast<long>(v8::ConstructorBehavior::kThrow));
54-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kAllow"), static_cast<long>(v8::ConstructorBehavior::kAllow));
53+
zend_declare_class_constant_long(this_ce, ZEND_STRL("THROW"), static_cast<long>(v8::ConstructorBehavior::kThrow));
54+
zend_declare_class_constant_long(this_ce, ZEND_STRL("ALLOW"), static_cast<long>(v8::ConstructorBehavior::kAllow));
5555

5656
#undef this_ce
5757

@@ -60,19 +60,19 @@ PHP_MINIT_FUNCTION (php_v8_enums) {
6060
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "IntegrityLevel", php_v8_enum_methods);
6161
this_ce = zend_register_internal_class(&ce);
6262

63-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kFrozen"), static_cast<zend_long>(v8::IntegrityLevel::kFrozen));
64-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kSealed"), static_cast<zend_long>(v8::IntegrityLevel::kSealed));
63+
zend_declare_class_constant_long(this_ce, ZEND_STRL("FROZEN"), static_cast<zend_long>(v8::IntegrityLevel::kFrozen));
64+
zend_declare_class_constant_long(this_ce, ZEND_STRL("SEALED"), static_cast<zend_long>(v8::IntegrityLevel::kSealed));
6565
#undef this_ce
6666

6767
// v8::PropertyAttribute
6868
#define this_ce php_v8_property_attribute_class_entry
6969
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "PropertyAttribute", php_v8_enum_methods);
7070
this_ce = zend_register_internal_class(&ce);
7171

72-
zend_declare_class_constant_long(this_ce, ZEND_STRL("None"), v8::PropertyAttribute::None);
73-
zend_declare_class_constant_long(this_ce, ZEND_STRL("ReadOnly"), v8::PropertyAttribute::ReadOnly);
74-
zend_declare_class_constant_long(this_ce, ZEND_STRL("DontEnum"), v8::PropertyAttribute::DontEnum);
75-
zend_declare_class_constant_long(this_ce, ZEND_STRL("DontDelete"), v8::PropertyAttribute::DontDelete);
72+
zend_declare_class_constant_long(this_ce, ZEND_STRL("NONE"), v8::PropertyAttribute::None);
73+
zend_declare_class_constant_long(this_ce, ZEND_STRL("READ_ONLY"), v8::PropertyAttribute::ReadOnly);
74+
zend_declare_class_constant_long(this_ce, ZEND_STRL("DONT_ENUM"), v8::PropertyAttribute::DontEnum);
75+
zend_declare_class_constant_long(this_ce, ZEND_STRL("DONT_DELETE"), v8::PropertyAttribute::DontDelete);
7676

7777
#undef this_ce
7878

@@ -81,41 +81,41 @@ PHP_MINIT_FUNCTION (php_v8_enums) {
8181
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "PropertyHandlerFlags", php_v8_enum_methods);
8282
this_ce = zend_register_internal_class(&ce);
8383

84-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kNone"), static_cast<zend_long>(v8::PropertyHandlerFlags::kNone));
85-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kAllCanRead"), static_cast<zend_long>(v8::PropertyHandlerFlags::kAllCanRead));
86-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kNonMasking"), static_cast<zend_long>(v8::PropertyHandlerFlags::kNonMasking));
87-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kOnlyInterceptStrings"), static_cast<zend_long>(v8::PropertyHandlerFlags::kOnlyInterceptStrings));
84+
zend_declare_class_constant_long(this_ce, ZEND_STRL("NONE"), static_cast<zend_long>(v8::PropertyHandlerFlags::kNone));
85+
zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_READ"), static_cast<zend_long>(v8::PropertyHandlerFlags::kAllCanRead));
86+
zend_declare_class_constant_long(this_ce, ZEND_STRL("NON_MASKING"), static_cast<zend_long>(v8::PropertyHandlerFlags::kNonMasking));
87+
zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_INTERCEPT_STRINGS"), static_cast<zend_long>(v8::PropertyHandlerFlags::kOnlyInterceptStrings));
8888
#undef this_ce
8989

9090
// v8::PropertyFilter
9191
#define this_ce php_v8_property_filter_class_entry
9292
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "PropertyFilter", php_v8_enum_methods);
9393
this_ce = zend_register_internal_class(&ce);
9494

95-
zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_PROPERTIES"), v8::PropertyFilter::ALL_PROPERTIES);
96-
zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_WRITABLE"), v8::PropertyFilter::ONLY_WRITABLE);
97-
zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_ENUMERABLE"), v8::PropertyFilter::ONLY_ENUMERABLE);
95+
zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_PROPERTIES"), v8::PropertyFilter::ALL_PROPERTIES);
96+
zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_WRITABLE"), v8::PropertyFilter::ONLY_WRITABLE);
97+
zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_ENUMERABLE"), v8::PropertyFilter::ONLY_ENUMERABLE);
9898
zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_CONFIGURABLE"), v8::PropertyFilter::ONLY_CONFIGURABLE);
99-
zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_STRINGS"), v8::PropertyFilter::SKIP_STRINGS);
100-
zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_SYMBOLS"), v8::PropertyFilter::SKIP_SYMBOLS);
99+
zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_STRINGS"), v8::PropertyFilter::SKIP_STRINGS);
100+
zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_SYMBOLS"), v8::PropertyFilter::SKIP_SYMBOLS);
101101
#undef this_ce
102102

103103
// v8::KeyCollectionMode
104104
#define this_ce php_v8_key_collection_mode_class_entry
105105
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "KeyCollectionMode", php_v8_enum_methods);
106106
this_ce = zend_register_internal_class(&ce);
107107

108-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kOwnOnly"), static_cast<zend_long>(v8::KeyCollectionMode::kOwnOnly));
109-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kIncludePrototypes"), static_cast<zend_long>(v8::KeyCollectionMode::kIncludePrototypes));
108+
zend_declare_class_constant_long(this_ce, ZEND_STRL("OWN_ONLY"), static_cast<zend_long>(v8::KeyCollectionMode::kOwnOnly));
109+
zend_declare_class_constant_long(this_ce, ZEND_STRL("INCLUDE_PROTOTYPES"), static_cast<zend_long>(v8::KeyCollectionMode::kIncludePrototypes));
110110
#undef this_ce
111111

112112
// v8::IndexFilter
113113
#define this_ce php_v8_index_filter_class_entry
114114
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "IndexFilter", php_v8_enum_methods);
115115
this_ce = zend_register_internal_class(&ce);
116116

117-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kIncludeIndices"), static_cast<zend_long>(v8::IndexFilter::kIncludeIndices));
118-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kSkipIndices"), static_cast<zend_long>(v8::IndexFilter::kSkipIndices));
117+
zend_declare_class_constant_long(this_ce, ZEND_STRL("INCLUDE_INDICES"), static_cast<zend_long>(v8::IndexFilter::kIncludeIndices));
118+
zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_INDICES"), static_cast<zend_long>(v8::IndexFilter::kSkipIndices));
119119
#undef this_ce
120120

121121
return SUCCESS;

src/php_v8_regexp.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ PHP_MINIT_FUNCTION(php_v8_regexp) {
116116
INIT_NS_CLASS_ENTRY(ce, "V8\\RegExpObject", "Flags", php_v8_regexp_flags_methods);
117117
php_v8_regexp_flags_class_entry = zend_register_internal_class(&ce);
118118

119-
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kNone"), v8::RegExp::Flags::kNone);
120-
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kGlobal"), v8::RegExp::Flags::kGlobal);
121-
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kIgnoreCase"), v8::RegExp::Flags::kIgnoreCase);
122-
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kMultiline"), v8::RegExp::Flags::kMultiline);
123-
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kSticky"), v8::RegExp::Flags::kSticky);
124-
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kUnicode"), v8::RegExp::Flags::kUnicode);
119+
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("NONE"), v8::RegExp::Flags::kNone);
120+
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("GLOBAL"), v8::RegExp::Flags::kGlobal);
121+
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("IGNORE_CASE"), v8::RegExp::Flags::kIgnoreCase);
122+
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("MULTILINE"), v8::RegExp::Flags::kMultiline);
123+
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("STICKY"), v8::RegExp::Flags::kSticky);
124+
zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("UNICODE"), v8::RegExp::Flags::kUnicode);
125125

126126
return SUCCESS;
127127
}

src/php_v8_script_compiler.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,11 @@ PHP_MINIT_FUNCTION(php_v8_script_compiler)
303303
INIT_NS_CLASS_ENTRY(ce, "V8\\ScriptCompiler", "CompileOptions", php_v8_compile_options_methods);
304304
php_v8_compile_options_class_entry = zend_register_internal_class(&ce);
305305

306-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kNoCompileOptions"), v8::ScriptCompiler::CompileOptions::kNoCompileOptions);
307-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kProduceParserCache"), v8::ScriptCompiler::CompileOptions::kProduceParserCache);
308-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kConsumeParserCache"), v8::ScriptCompiler::CompileOptions::kConsumeParserCache);
309-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kProduceCodeCache"), v8::ScriptCompiler::CompileOptions::kProduceCodeCache);
310-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kConsumeCodeCache"), v8::ScriptCompiler::CompileOptions::kConsumeCodeCache);
306+
zend_declare_class_constant_long(this_ce, ZEND_STRL("NO_COMPILE_OPTIONS"), v8::ScriptCompiler::CompileOptions::kNoCompileOptions);
307+
zend_declare_class_constant_long(this_ce, ZEND_STRL("PRODUCE_PARSER_CACHE"), v8::ScriptCompiler::CompileOptions::kProduceParserCache);
308+
zend_declare_class_constant_long(this_ce, ZEND_STRL("CONSUME_PARSER_CACHE"), v8::ScriptCompiler::CompileOptions::kConsumeParserCache);
309+
zend_declare_class_constant_long(this_ce, ZEND_STRL("PRODUCE_CODE_CACHE"), v8::ScriptCompiler::CompileOptions::kProduceCodeCache);
310+
zend_declare_class_constant_long(this_ce, ZEND_STRL("CONSUME_CODE_CACHE"), v8::ScriptCompiler::CompileOptions::kConsumeCodeCache);
311311

312312
return SUCCESS;
313313
}

src/php_v8_string.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ PHP_MINIT_FUNCTION(php_v8_string)
166166
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "StringValue", php_v8_string_methods);
167167
this_ce = zend_register_internal_class_ex(&ce, php_v8_name_class_entry);
168168

169-
zend_declare_class_constant_long(this_ce, ZEND_STRL("kMaxLength"), v8::String::kMaxLength);
169+
zend_declare_class_constant_long(this_ce, ZEND_STRL("MAX_LENGTH"), v8::String::kMaxLength);
170170

171171
return SUCCESS;
172172
}

stubs/src/AccessControl.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ class AccessControl
2020
const DEFAULT_ACCESS = 0; // do not allow cross-context access
2121
const ALL_CAN_READ = 1; // all cross-context reads are allowed
2222
const ALL_CAN_WRITE = 2; // all cross-context writes are allowed
23-
// ALL_CAN_READ | ALL_CAN_WRITE could be use allow all cross-context access
2423
}

stubs/src/ConstructorBehavior.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818

1919
class ConstructorBehavior
2020
{
21-
const kThrow = 0;
22-
const kAllow = 1;
21+
const THROW = 0;
22+
const ALLOW = 1;
2323
}

stubs/src/FunctionObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FunctionObject extends ObjectValue
3030
* @param int $length
3131
* @param int $behavior
3232
*/
33-
public function __construct(Context $context, callable $callback, int $length = 0, int $behavior = ConstructorBehavior::kAllow)
33+
public function __construct(Context $context, callable $callback, int $length = 0, int $behavior = ConstructorBehavior::ALLOW)
3434
{
3535
parent::__construct($context);
3636
}

stubs/src/FunctionTemplate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function __construct(
129129
callable $callback = null,
130130
FunctionTemplate $receiver = null,
131131
int $length = 0,
132-
int $behavior = ConstructorBehavior::kAllow
132+
int $behavior = ConstructorBehavior::ALLOW
133133
) {
134134
parent::__construct($isolate);
135135
}

stubs/src/IndexedPropertyHandlerConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(
3232
callable $query = null,
3333
callable $deleter = null,
3434
callable $enumerator = null,
35-
$flags = PropertyHandlerFlags::kNone
35+
$flags = PropertyHandlerFlags::NONE
3636
) {
3737
}
3838
}

stubs/src/IntegrityLevel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
*/
2121
class IntegrityLevel
2222
{
23-
const kFrozen = 0;
24-
const kSealed = 1;
23+
const FROZEN = 0;
24+
const SEALED = 1;
2525
}

0 commit comments

Comments
 (0)