diff --git a/README.md b/README.md index 1289efb..d9ba23f 100644 --- a/README.md +++ b/README.md @@ -88,8 +88,8 @@ $ php --ri v8 $ brew tap homebrew/dupes $ brew tap homebrew/php $ brew install php70 -$ brew install https://raw.githubusercontent.com/pinepain/php-v8/master/scripts/homebrew/v8.rb -$ brew install https://raw.githubusercontent.com/pinepain/php-v8/master/scripts/homebrew/php70-v8.rb +$ brew install https://raw.githubusercontent.com/pinepain/packaging/master/homebrew/v8.rb +$ brew install https://raw.githubusercontent.com/pinepain/packaging/master/homebrew/php70-v8.rb $ php --ri v8 ``` @@ -106,11 +106,11 @@ You will need a recent v8 Google JavaScript engine version installed. At this ti $ sudo apt-get update -y $ sudo apt-get install -y libv8-5.4-dev ``` - - For OS X there is the [v8.rb](https://github.com/pinepain/php-v8/blob/master/scripts/homebrew/v8.rb) homebrew formula. + - For OS X there is the [v8.rb][v8.rb] homebrew formula. To install libv8: ``` - $ brew install https://raw.githubusercontent.com/pinepain/php-v8/master/scripts/homebrew/v8.rb + $ brew install https://raw.githubusercontent.com/pinepain/packaging/master/homebrew/v8.rb ``` #### PHP 7 @@ -151,7 +151,7 @@ You will need a recent v8 Google JavaScript engine version installed. At this ti To install `php70-v8` do: ``` - $ brew install https://raw.githubusercontent.com/pinepain/php-v8/master/scripts/homebrew/php70-v8.rb + $ brew install https://raw.githubusercontent.com/pinepain/packaging/master/homebrew/php70-v8.rb ``` ### Building php-v8 from sources @@ -186,6 +186,7 @@ Copyright (c) 2015-2016 Bogdan Padalko <pinepain@gmail.com> [v8-hello-world]: https://chromium.googlesource.com/v8/v8/+/master/samples/hello-world.cc [v8-intro]: https://developers.google.com/v8/intro -[php70-v8.rb]: https://github.com/pinepain/php-v8/blob/master/scripts/homebrew/php70-v8.rb -[php71-v8.rb]: https://github.com/pinepain/php-v8/blob/master/scripts/homebrew/php71-v8.rb +[v8.rb]: https://github.com/pinepain/packaging/blob/master/homebrew/v8.rb +[php70-v8.rb]: https://github.com/pinepain/packaging/blob/master/homebrew/php70-v8.rb +[php71-v8.rb]: https://github.com/pinepain/packaging/blob/master/homebrew/php71-v8.rb [php-v8-stubs]: https://github.com/pinepain/php-v8-stubs diff --git a/src/php_v8_object.cc b/src/php_v8_object.cc index 12629ad..4f66dd2 100644 --- a/src/php_v8_object.cc +++ b/src/php_v8_object.cc @@ -1540,8 +1540,8 @@ ZEND_END_ARG_INFO() //void method ZEND_BEGIN_ARG_INFO_EX(arginfo_php_v8_object_SetAccessorProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) - ZEND_ARG_OBJ_INFO(0, getter, V8\\Function, 0) - ZEND_ARG_OBJ_INFO(0, setter, V8\\Function, 0) + ZEND_ARG_OBJ_INFO(0, getter, V8\\FunctionObject, 0) + ZEND_ARG_OBJ_INFO(0, setter, V8\\FunctionObject, 0) ZEND_ARG_TYPE_INFO(0, attributes, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, settings, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/stubs/src/ObjectValue.php b/stubs/src/ObjectValue.php index 20e2715..f2f8ddd 100644 --- a/stubs/src/ObjectValue.php +++ b/stubs/src/ObjectValue.php @@ -221,19 +221,20 @@ public function SetAccessor( } /** - * @param NameValue $name - * @param callable $getter - * @param callable|null $setter - * @param int $attributes - * @param int $settings + * @param NameValue $name + * @param FunctionObject $getter + * @param FunctionObject|null $setter + * @param int $attributes + * @param int $settings */ public function SetAccessorProperty( NameValue $name, - callable $getter, - callable $setter = null, + FunctionObject $getter, + FunctionObject $setter = null, int $attributes = PropertyAttribute::None, int $settings = AccessControl::DEFAULT_ACCESS - ) { + ) + { } /** diff --git a/tests/001-verify-method-parameters-type.phpt b/tests/001-verify-method-parameters-type.phpt new file mode 100644 index 0000000..9d1b682 --- /dev/null +++ b/tests/001-verify-method-parameters-type.phpt @@ -0,0 +1,73 @@ +--TEST-- +Check whether all method parameters have valid type +--SKIPIF-- + +--FILE-- +getClasses(); + + +class Verifier +{ + private $invalid = []; + + public function verifyClass(ReflectionClass $class) + { + foreach ($class->getMethods() as $m) { + $this->verifyMethod($m); + } + } + + public function verifyMethod(ReflectionMethod $method) + { + foreach ($method->getParameters() as $p) { + $this->verifyParameter($p); + } + } + + public function verifyParameter(ReflectionParameter $parameter) + { + $type = $parameter->getType(); + + if (!$type || $type->isBuiltin()) { + return; + } + + if (!(class_exists($type))) { + $method_name = $parameter->getDeclaringClass()->getName() . '::' . $parameter->getDeclaringFunction()->getName(); + $param_name = $parameter->getName(); + + $shortcut = $method_name . '/' . $param_name; + + if (isset($this->invalid[$shortcut])) { + return; + } + + $this->invalid[$shortcut] = true; + + echo "{$method_name}() method's parameter {$parameter->getName()} has invalid type ($type)", PHP_EOL; + } + } + + public function isValid() + { + return empty($this->invalid); + } +} + +$v = new Verifier(); + + +foreach ($classes as $c) { + $v->verifyClass($c); +} + +if ($v->isValid()) { + echo 'All method parameters are valid', PHP_EOL; +} + +?> +--EXPECT-- +All method parameters are valid diff --git a/tests/V8Script_Run.phpt b/tests/V8Script_Run.phpt index faab303..8ea0b2c 100644 --- a/tests/V8Script_Run.phpt +++ b/tests/V8Script_Run.phpt @@ -27,7 +27,7 @@ $file_name = 'test.js'; $script = new V8\Script($context, new \V8\StringValue($isolate, $source), new \V8\ScriptOrigin($file_name)); $res = $script->Run($context); -$v8_helper->run_checks($value); +$v8_helper->run_checks($res); $helper->dump($res->Value());