A wrapper for the v8js
extension.
graph LR
PHP-->|Typed|V8js-->|Untyped|JS
JS-->|Typed|V8js-->|Rarely typed|PHP
graph LR
PHP-->|Typed|V8World-->|Typed|V8js-->|Untyped|JS
JS-->|Typed|V8js-->|Untyped|V8World-->|Fully Typed*|PHP
*: The real instance of objects is still an V8Object but the type hints will help you to reduce possible bugs.
- The wrapper takes an instance of
\V8Js
+ an$initialState
1 class. - The phpdoc tells your IDE that the wrapper is an instance of
\V8Js&InitialState
. - Your IDE provides autocomplete features and your static analyzer should detect common typing problems.
See _docs/example.md.
This package is just a "band-aid for a bullet hole".
- Since
V8World::modify()
will not create a new instance of theV8Js
object, the oldV8World
is also affected- The IDE will not provide autocompletion for the old
V8World
object but for the new one.
- The IDE will not provide autocompletion for the old
- Keep in mind that changing the stubs will not affect the underlying JS code - not even vice versa.
- Don't trust the stubs if you're working with objects and functions.
- If a method returns an object or a property holds an instance of an object, V8Js always return an
\V8Object
- If a method returns an function or a property holds an instance of an function, V8Js always return an
\V8Function
- If a method returns an object or a property holds an instance of an object, V8Js always return an
Footnotes
-
Usually this should be a stub interface ↩