From 44669e8f418708a3107fd797892d4e4e0aca1116 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 20 Mar 2015 11:10:29 +0300 Subject: [PATCH] Fixed white spaces --- Zend/tests/typehints/scalar_basic.phpt | 6 +++--- Zend/tests/typehints/scalar_none.phpt | 6 +++--- Zend/tests/typehints/scalar_null.phpt | 6 +++--- Zend/tests/typehints/scalar_return_basic.phpt | 6 +++--- Zend/tests/typehints/scalar_strict.phpt | 6 +++--- Zend/tests/typehints/scalar_strict_basic.phpt | 6 +++--- Zend/zend_API.c | 2 +- Zend/zend_compile.c | 16 ++++++++-------- Zend/zend_execute.c | 4 ++-- Zend/zend_vm_def.h | 13 +++++++------ Zend/zend_vm_execute.h | 4 +++- 11 files changed, 39 insertions(+), 36 deletions(-) diff --git a/Zend/tests/typehints/scalar_basic.phpt b/Zend/tests/typehints/scalar_basic.phpt index ef632f0069..08a0121bbe 100644 --- a/Zend/tests/typehints/scalar_basic.phpt +++ b/Zend/tests/typehints/scalar_basic.phpt @@ -50,9 +50,9 @@ foreach ($functions as $type => $function) { echo PHP_EOL . "*** Trying "; var_dump($value); try { - var_dump($function($value)); + var_dump($function($value)); } catch (\TypeException $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo "*** Caught " . $e->getMessage() . PHP_EOL; } } } @@ -274,4 +274,4 @@ bool(false) *** Trying resource(%d) of type (stream) *** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d -Done \ No newline at end of file +Done diff --git a/Zend/tests/typehints/scalar_none.phpt b/Zend/tests/typehints/scalar_none.phpt index e450f1a16b..af6d8c8dfa 100644 --- a/Zend/tests/typehints/scalar_none.phpt +++ b/Zend/tests/typehints/scalar_none.phpt @@ -27,9 +27,9 @@ $functions = [ foreach ($functions as $type => $function) { echo "Testing $type:", PHP_EOL; try { - var_dump($function()); + var_dump($function()); } catch (TypeException $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo "*** Caught " . $e->getMessage() . PHP_EOL; } } echo PHP_EOL . "Done"; @@ -51,4 +51,4 @@ NULL Testing bool nullable: NULL -Done \ No newline at end of file +Done diff --git a/Zend/tests/typehints/scalar_null.phpt b/Zend/tests/typehints/scalar_null.phpt index ff6a3d4206..e149388ef0 100644 --- a/Zend/tests/typehints/scalar_null.phpt +++ b/Zend/tests/typehints/scalar_null.phpt @@ -27,9 +27,9 @@ $functions = [ foreach ($functions as $type => $function) { echo "Testing $type:", PHP_EOL; try { - var_dump($function(null)); + var_dump($function(null)); } catch (TypeException $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo "*** Caught " . $e->getMessage() . PHP_EOL; } } @@ -53,4 +53,4 @@ NULL Testing bool nullable: NULL -Done \ No newline at end of file +Done diff --git a/Zend/tests/typehints/scalar_return_basic.phpt b/Zend/tests/typehints/scalar_return_basic.phpt index eff1bbf066..d33fb5dff1 100644 --- a/Zend/tests/typehints/scalar_return_basic.phpt +++ b/Zend/tests/typehints/scalar_return_basic.phpt @@ -51,9 +51,9 @@ foreach ($functions as $type => $function) { echo "*** Trying "; var_dump($value); try { - var_dump($function($value)); + var_dump($function($value)); } catch (TypeException $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo "*** Caught " . $e->getMessage() . PHP_EOL; } } } @@ -211,4 +211,4 @@ bool(false) *** Trying resource(5) of type (stream) *** Caught Return value of {closure}() must be of the type boolean, resource returned in %s on line %d -Done \ No newline at end of file +Done diff --git a/Zend/tests/typehints/scalar_strict.phpt b/Zend/tests/typehints/scalar_strict.phpt index 44c83cfbb0..400c7d5cf8 100644 --- a/Zend/tests/typehints/scalar_strict.phpt +++ b/Zend/tests/typehints/scalar_strict.phpt @@ -52,9 +52,9 @@ foreach ($functions as $type => $function) { echo PHP_EOL . "*** Trying "; var_dump($value); try { - var_dump($function($value)); + var_dump($function($value)); } catch (TypeException $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo "*** Caught " . $e->getMessage() . PHP_EOL; } } } @@ -274,4 +274,4 @@ bool(false) *** Trying resource(5) of type (stream) *** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d -Done \ No newline at end of file +Done diff --git a/Zend/tests/typehints/scalar_strict_basic.phpt b/Zend/tests/typehints/scalar_strict_basic.phpt index dcbf93135d..d56af159d7 100644 --- a/Zend/tests/typehints/scalar_strict_basic.phpt +++ b/Zend/tests/typehints/scalar_strict_basic.phpt @@ -53,9 +53,9 @@ foreach ($functions as $type => $function) { $errored = false; echo PHP_EOL . "*** Trying ", type($value), " value", PHP_EOL; try { - var_dump($function($value)); + var_dump($function($value)); } catch (TypeException $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo "*** Caught " . $e->getMessage() . PHP_EOL; } } } @@ -178,4 +178,4 @@ bool(false) *** Trying resource value *** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d -Done \ No newline at end of file +Done diff --git a/Zend/zend_API.c b/Zend/zend_API.c index dac6f16754..1ef695dd4e 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -677,7 +677,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, if (!quiet) { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : ""; - + zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted", class_name, class_name[0] ? "::" : "", diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 341e2326d7..d0c7264eec 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -170,9 +170,9 @@ static zend_always_inline const scalar_typehint_info* zend_find_scalar_typehint( /* }}} */ ZEND_API void zend_assert_valid_class_name(const zend_string *const_name) /* {{{ */ -{ +{ const scalar_typehint_info *info = zend_find_scalar_typehint(const_name); - + if (info) { zend_error_noreturn(E_COMPILE_ERROR, "\"%s\" cannot be used as a class name", info->name); } @@ -180,9 +180,9 @@ ZEND_API void zend_assert_valid_class_name(const zend_string *const_name) /* {{{ /* }}} */ static zend_always_inline zend_uchar zend_lookup_scalar_typehint_by_name(const zend_string *const_name) /* {{{ */ -{ +{ const scalar_typehint_info *info = zend_find_scalar_typehint(const_name); - + if (info) { if (const_name->len != info->name_len) { zend_error_noreturn(E_COMPILE_ERROR, "\"%s\" cannot be used as a type declaration", const_name->val); @@ -4031,7 +4031,7 @@ void zend_compile_declare(zend_ast *ast) /* {{{ */ ZVAL_COPY_VALUE(&CG(declarables).ticks, &value_zv); zval_dtor(&value_zv); } else if (zend_string_equals_literal_ci(name, "encoding")) { - + if (FAILURE == zend_declare_is_first_statement(ast)) { zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration pragma must be " "the very first statement in the script"); @@ -4046,7 +4046,7 @@ void zend_compile_declare(zend_ast *ast) /* {{{ */ if (ast->child[1] != NULL) { zend_error_noreturn(E_COMPILE_ERROR, "strict_types declaration must not " - "use block mode"); + "use block mode"); } zend_const_expr_to_zval(&value_zv, value_ast); @@ -4058,7 +4058,7 @@ void zend_compile_declare(zend_ast *ast) /* {{{ */ if (Z_LVAL(value_zv) == 1) { CG(active_op_array)->fn_flags |= ZEND_ACC_STRICT_TYPES; } - + } else { zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", name->val); } @@ -4236,7 +4236,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, zend_bool is_ if (type != 0) { arg_info->type_hint = type; } else { - + if (zend_is_const_default_class_ref(type_ast)) { class_name = zend_resolve_class_name_ast(type_ast); } else { diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 6bc9df624b..699c1ca3de 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -621,8 +621,8 @@ ZEND_API void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, c } if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) { - zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d", - arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, + zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d", + arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->func->op_array.filename->val, ptr->opline->lineno); } else { zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 015d6cbc14..2cc3588606 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3600,12 +3600,12 @@ ZEND_VM_HANDLER(124, ZEND_VERIFY_RETURN_TYPE, CONST|TMP|VAR|UNUSED|CV, UNUSED) zend_arg_info *ret_info = EX(func)->common.arg_info - 1; retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); - - if (UNEXPECTED(!ret_info->class_name - && ret_info->type_hint != IS_CALLABLE + + if (UNEXPECTED(!ret_info->class_name + && ret_info->type_hint != IS_CALLABLE && !ZEND_SAME_FAKE_TYPE(ret_info->type_hint, Z_TYPE_P(retval_ptr)))) { /* A cast or an error will happen, so separate the zval to prevent overwriting it */ - + if (EXPECTED((opline->extended_value & ZEND_RETURN_REF) == 0)) { /* Does not return by reference */ SEPARATE_ZVAL(retval_ptr); @@ -4441,7 +4441,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY) ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) { param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T); if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) { - do { + do { zend_verify_arg_type(EX(func), arg_num, param, NULL, EX_USES_STRICT_TYPES()); if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param); ZEND_HASH_FILL_ADD(param); @@ -7394,4 +7394,5 @@ ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, ANY, ANY) ZVAL_EMPTY_STRING(EX_VAR(opline->result.var)); } ZEND_VM_NEXT_OPCODE(); -} \ No newline at end of file +} + diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 390d829b0d..2ee2cf4d53 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1789,7 +1789,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_HANDLER( ZVAL_EMPTY_STRING(EX_VAR(opline->result.var)); } ZEND_VM_NEXT_OPCODE(); -}static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +} + +static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE -- 2.40.0