phpv8 / php-v8

PHP extension for V8 JavaScript engine
https://php-v8.readthedocs.io
MIT License
217 stars 14 forks source link

Create upgrading guide from 0.1.9 to 0.2.0 #43

Closed pinepain closed 7 years ago

pinepain commented 7 years ago

It could be a list of transitions, what was before and what it become after. Stubs diff may come in handy here.

pinepain commented 7 years ago

Short list

Changes in 0.2.0:

Some changes

Drop PHP 7.0 support, #30

That's simple - see the linked issue for the reference. I really have no time support all PHP versions and what's more, I'd like to use new features from recent PHP version. Based on that 7.0 is soon to be EOL and extension is experimental, not supporting it is a wise choice in a long-term perspective.

Add Data typehint for $value param in Template::set(), #36

Internally there was Data type hint, so it was impossible to pass something different. This change is fully cosmetic.

Rename constants to match PSR-2 convention, #34

All constants now follow PSR-2 style and use no k prefix, which was a rudiment from V8 C++ API. Constant names uses UPPER_CAMEL_CASE instead of PascalCase or camelCase.

Before After
ConstructorBehavior::kThrow ConstructorBehavior::THROW
ConstructorBehavior::kAllow ConstructorBehavior::ALLOW
IntegrityLevel::kFrozen IntegrityLevel::FROZEN
IntegrityLevel::kSealed IntegrityLevel::SEALED
PropertyAttribute::None PropertyAttribute::
PropertyAttribute::ReadOnly PropertyAttribute::NONE
PropertyAttribute::DontEnum PropertyAttribute::READ_ONLY
PropertyAttribute::DontDelete PropertyAttribute::DONT_ENUM
PropertyHandlerFlags::kNone PropertyHandlerFlags::NONE
PropertyHandlerFlags::kAllCanRead PropertyHandlerFlags::ALL_CAN_READ
PropertyHandlerFlags::kNonMasking PropertyHandlerFlags::NON_MASKING
PropertyHandlerFlags::kOnlyInterceptStrings PropertyHandlerFlags::ONLY_INTERCEPT_STRINGS
KeyCollectionMode::kOwnOnly KeyCollectionMode::OWN_ONLY
KeyCollectionMode::kIncludePrototypes KeyCollectionMode::INCLUDE_PROTOTYPES
IndexFilter::kIncludeIndices IndexFilter::INCLUDE_INDICES
IndexFilter::kSkipIndices IndexFilter::SKIP_INDICES
RegExpObject\Flags::kNone RegExpObject\Flags::NONE
RegExpObject\Flags::kGlobal RegExpObject\Flags::GLOBAL
RegExpObject\Flags::kIgnoreCase RegExpObject\Flags::IGNORE_CASE
RegExpObject\Flags::kMultiline RegExpObject\Flags::MULTILINE
RegExpObject\Flags::kSticky RegExpObject\Flags::STICKY
RegExpObject\Flags::kUnicode RegExpObject\Flags::UNICODE
ScriptCompiler\CompileOptions::kNoCompileOptions ScriptCompiler\CompileOptions::NO_COMPILE_OPTIONS
ScriptCompiler\CompileOptions::kProduceParserCache ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE
ScriptCompiler\CompileOptions::kConsumeParserCache ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE
ScriptCompiler\CompileOptions::kProduceCodeCache ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE
ScriptCompiler\CompileOptions::kConsumeCodeCache ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE
StringValue::kMaxLength StringValue::MAX_LENGTH

NOTE: affected constants list is incomplete, as listing them is a

Make enum classes with constants final, #39

There is no big reason to inherit service classes that holds only constants. I don't think there is good reason to do that. If your code extends constants-only classes, please, alter it to adopt this change.

Rename HeapStatistics methods to match PSR-2, #38

Before After
HeapStatistics::total_heap_size() HeapStatistics::getTotalHeapSize()
HeapStatistics::total_heap_size_executable() HeapStatistics::getTotalHeapSizeExecutable()
HeapStatistics::total_physical_size() HeapStatistics::getTotalPhysicalSize()
HeapStatistics::total_available_size() HeapStatistics::getTotalAvailableSize()
HeapStatistics::used_heap_size() HeapStatistics::getUsedHeapSize()
HeapStatistics::heap_size_limit() HeapStatistics::getHeapSizeLimit()
HeapStatistics::malloced_memory() HeapStatistics::getMallocedMemory()
HeapStatistics::peak_malloced_memory() HeapStatistics::getPeakMallocedMemory()
HeapStatistics::does_zap_garbage() HeapStatistics::doesZapGarbage()

All other changes

All other changes could be tracked by looking into tests/001-verify_extension_entities.phpt file diff.