com php-src: Fixed white-spaces: Zend/tests/type_declarations /typed_properties_001.phpt Zend/tests/type_decl arations/typed_properties_004.phpt
Zend/tests/typ e_declarations/typed_properties_005.phpt Zend/t ests/type_declarations/typed_properties_034.phpt Zend/zend_API.c Zend/zend_ast.c
Zend/zend_comp ile.c Zend/zend_execute.c Zend/zend_execute.h Z end/zend_execute_API.c Zend/zend_inheritance.c Ze nd/zend_language_parser.y
Zend/zend_vm_def.h ex t/reflec
| From: | Bob Weinand | Date: | Tue, 24 May 2016 09:59:54 +0000 |
| Subject: | com php-src: Fixed white-spaces: Zend/tests/type_declarations /typed_properties_001.phpt Zend/tests/type_decl arations/typed_properties_004.phpt Zend/tests/typ e_declarations/typed_properties_005.phpt Zend/t ests/type_declarations/typed_properties_034.phpt Zend/zend_API.c Zend/zend_ast.c Zend/zend_comp ile.c Zend/zend_execute.c Zend/zend_execute.h Z end/zend_execute_API.c Zend/zend_inheritance.c Ze nd/zend_language_parser.y Zend/zend_vm_def.h ex t/reflec |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95550@lists.php.net to get a copy of this message | ||
Commit: ce442f988220157e263b5d126aa8d3003afa8690
Author: Dmitry Stogov <dmitry@zend.com> Tue, 24 May 2016 12:59:54 +0300
Parents: c2712a595b003a834bf7869e05c1a1b5330de6b6
Branches: typed_ref_properties
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ce442f988220157e263b5d126aa8d3003afa8690
Log:
Fixed white-spaces
Changed paths:
M Zend/tests/type_declarations/typed_properties_001.phpt
M Zend/tests/type_declarations/typed_properties_004.phpt
M Zend/tests/type_declarations/typed_properties_005.phpt
M Zend/tests/type_declarations/typed_properties_034.phpt
M Zend/zend_API.c
M Zend/zend_ast.c
M Zend/zend_compile.c
M Zend/zend_execute.c
M Zend/zend_execute.h
M Zend/zend_execute_API.c
M Zend/zend_inheritance.c
M Zend/zend_language_parser.y
M Zend/zend_vm_def.h
M ext/reflection/php_reflection.c
M ext/reflection/tests/ReflectionType_001.phpt
M ext/standard/tests/serialize/typed_property_refs.phpt
M ext/standard/var.c
diff --git a/Zend/tests/type_declarations/typed_properties_001.phpt b/Zend/tests/type_declarations/typed_properties_001.phpt index 054fc4d..5a346a4 100644 --- a/Zend/tests/type_declarations/typed_properties_001.phpt +++ b/Zend/tests/type_declarations/typed_properties_001.phpt @@ -8,7 +8,7 @@ var_dump(new class(1, 2.2, true, ["four"], new stdClass) { public bool $bool; public array $array; public stdClass $std; - + public function __construct(int $int, float $float, bool $bool, array $array, stdClass $std) { $this->int = $int; $this->float = $float; diff --git a/Zend/tests/type_declarations/typed_properties_004.phpt b/Zend/tests/type_declarations/typed_properties_004.phpt index 59314ab..1d9e640 100644 --- a/Zend/tests/type_declarations/typed_properties_004.phpt +++ b/Zend/tests/type_declarations/typed_properties_004.phpt @@ -4,7 +4,7 @@ Test typed properties error condition (type mismatch) <?php new class("PHP 7 is better than you, and it knows it ...") { public int $int; - + public function __construct(string $string) { $this->int = $string; } diff --git a/Zend/tests/type_declarations/typed_properties_005.phpt b/Zend/tests/type_declarations/typed_properties_005.phpt index 05de225..b521963 100644 --- a/Zend/tests/type_declarations/typed_properties_005.phpt +++ b/Zend/tests/type_declarations/typed_properties_005.phpt @@ -6,7 +6,7 @@ class Dummy {} new class(new Dummy) { public stdClass $std; - + public function __construct(Dummy $dummy) { $this->std = $dummy; } diff --git a/Zend/tests/type_declarations/typed_properties_034.phpt b/Zend/tests/type_declarations/typed_properties_034.phpt index 64a6c5d..dc6d581 100644 --- a/Zend/tests/type_declarations/typed_properties_034.phpt +++ b/Zend/tests/type_declarations/typed_properties_034.phpt @@ -5,12 +5,12 @@ Test typed properties add array element guard $foo = new class { public int $bar = 42; - + public function getIterator() { foreach(['1', &$this->bar] as $item) { - yield $item; + yield $item; } } }; diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 4ac3f8b..43cfd4b 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3693,7 +3693,7 @@ ZEND_API int zend_declare_typed_property(zend_class_entry *ce, zend_string *name property_info->doc_comment = doc_comment; property_info->ce = ce; property_info->type = optional_type; - property_info->type_name = optional_type_name ? + property_info->type_name = optional_type_name ? zend_new_interned_string(optional_type_name) : NULL; property_info->type_ce = NULL; diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 1c4f619..fb40acd 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1150,7 +1150,7 @@ simple_list: str, type_ast, 0, indent); smart_str_appendc(str, ' '); } - + goto simple_list; } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index c5116ed..2101668 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5508,7 +5508,7 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast) /* {{{ */ "Typed property %s::$%s must not be static", ZSTR_VAL(ce->name), ZSTR_VAL(name)); - } + } if (type_ast->kind == ZEND_AST_TYPE) { optional_type = type_ast->attr; @@ -5547,7 +5547,7 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast) /* {{{ */ } } } - + /* Doc comment has been appended as last element in ZEND_AST_PROP_ELEM ast */ if (doc_comment_ast) { doc_comment = zend_string_copy(zend_ast_get_str(doc_comment_ast)); @@ -5570,7 +5570,7 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast) /* {{{ */ if (optional_type && !Z_CONSTANT(value_zv)) { if (optional_type == IS_ARRAY) { if (Z_TYPE(value_zv) != IS_ARRAY) { - zend_error_noreturn(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "Default value for properties with array type can only be an array"); } } else if (optional_type == IS_CALLABLE) { diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 402104b..454d297 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -187,7 +187,7 @@ _zend_vm_is_fetching_reference: case ZEND_TICKS: case ZEND_EXT_STMT: case ZEND_FETCH_DIM_W: - case ZEND_FETCH_W: + case ZEND_FETCH_W: case ZEND_FETCH_OBJ_W: { next++; } goto _zend_vm_is_fetching_reference; @@ -197,8 +197,8 @@ _zend_vm_is_fetching_reference: case ZEND_SEND_REF: case ZEND_RETURN_BY_REF: case ZEND_ASSIGN_REF: - case ZEND_INIT_ARRAY: - case ZEND_ADD_ARRAY_ELEMENT: + case ZEND_INIT_ARRAY: + case ZEND_ADD_ARRAY_ELEMENT: case ZEND_YIELD: { return 1; } break; @@ -826,7 +826,7 @@ ZEND_COLD zend_never_inline void zend_verify_property_type_error(zend_property_i } if (info->type == IS_OBJECT) { - zend_throw_exception_ex(zend_ce_type_error, info->type, + zend_throw_exception_ex(zend_ce_type_error, info->type, "Typed property %s::$%s must be an instance of %s, %s used", ZSTR_VAL(info->ce->name), ZSTR_VAL(name), @@ -835,7 +835,7 @@ ZEND_COLD zend_never_inline void zend_verify_property_type_error(zend_property_i ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property))); } else { - zend_throw_exception_ex(zend_ce_type_error, info->type, + zend_throw_exception_ex(zend_ce_type_error, info->type, "Typed property %s::$%s must be %s, %s used", ZSTR_VAL(info->ce->name), ZSTR_VAL(name), @@ -854,7 +854,7 @@ zend_bool zend_verify_property_type(zend_property_info *info, zval *property, ze switch (info->type) { case IS_OBJECT: { zend_string *resolved = zend_resolve_property_type(info->type_name, info->ce); - + if (!info->type_ce) { info->type_ce = zend_lookup_class(resolved); } diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index e54e0aa..ffd3c93 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -374,7 +374,7 @@ static zend_always_inline zend_bool _zend_object_has_type_hints(zval *object) { if (Z_TYPE_P(object) != IS_OBJECT) break; } else { - break; + break; } } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 1403e19..a70ae05 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -126,11 +126,11 @@ static int clean_non_persistent_type_info(zval *zv) /* {{{ */ prop_info->type_ce = NULL; } } ZEND_HASH_FOREACH_END(); - } + } return ZEND_HASH_APPLY_KEEP; } - return ZEND_HASH_APPLY_STOP; + return ZEND_HASH_APPLY_STOP; } /* }}} */ static int clean_non_persistent_class(zval *zv) /* {{{ */ diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 0ff4814..d14d190 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -657,7 +657,7 @@ zend_string* zend_resolve_property_type(zend_string *name, zend_class_entry *sco if (!type) { return NULL; } - + if (zend_string_equals_literal_ci(type, "parent")) { if (scope && scope->parent) { return scope->parent->name; @@ -680,7 +680,6 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke if (UNEXPECTED(child)) { child_info = Z_PTR_P(child); - if (UNEXPECTED(parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW))) { child_info->flags |= ZEND_ACC_CHANGED; } else { @@ -711,8 +710,8 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke if (!(child_info->flags & ZEND_ACC_CHANGED)) { if (UNEXPECTED(parent_info->type && !(parent_info->flags & ZEND_ACC_PRIVATE))) { if (parent_info->type == IS_OBJECT) { - if (child_info->type != IS_OBJECT || - !zend_string_equals_ci(zend_resolve_property_type(parent_info->type_name, parent_info->ce), + if (child_info->type != IS_OBJECT || + !zend_string_equals_ci(zend_resolve_property_type(parent_info->type_name, parent_info->ce), zend_resolve_property_type(child_info->type_name, child_info->ce))) { zend_error_noreturn(E_COMPILE_ERROR, "Type of %s::$%s must be %s (as in class %s)", diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index d57e488..4939051 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -712,7 +712,7 @@ class_statement_list: class_statement: variable_modifiers optional_type property_list ';' - { $3->attr = $1; + { $3->attr = $1; $$ = zend_ast_create(ZEND_AST_PROP_GROUP, $2, $3); } | method_modifiers T_CONST class_const_list ';' { $$ = $3; $$->attr = $1; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 77d17cc..f7b5f35 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5925,7 +5925,7 @@ ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR) ZSTR_VAL(Z_OBJCE_P(array_ptr)->name)); HANDLE_EXCEPTION(); } - + if (!Z_OBJCE_P(array_ptr)->get_iterator) { if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { if (array_ptr == array_ref) { diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 0f2c3fe..3150c7d 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1287,17 +1287,17 @@ static void reflection_type_factory(void *scope, zval *closure_object, void *inf reference->type = type; intern->ptr = reference; intern->ref_type = REF_TYPE_TYPE; - + switch (type) { case REF_INFO_ARG: { zend_function *fptr = (zend_function*) scope; - + reference->scope.fptr = fptr; intern->ce = fptr->common.scope; reference->info.arg = info; } break; - + case REF_INFO_PROP: reference->scope.ce = scope; intern->ce = scope; @@ -3002,14 +3002,12 @@ ZEND_METHOD(reflection_type, allowsNull) GET_REFLECTION_OBJECT_PTR(param); switch (param->type) { - case REF_INFO_ARG: { + case REF_INFO_ARG: RETVAL_BOOL(param->info.arg->allow_null); - } break; - - + break; case REF_INFO_PROP: RETVAL_FALSE; - break; + break; } } /* }}} */ @@ -3045,7 +3043,7 @@ ZEND_METHOD(reflection_type, __toString) reflection_object *intern; type_reference *param; zend_uchar type = IS_UNDEF; - + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -3058,7 +3056,7 @@ ZEND_METHOD(reflection_type, __toString) if (type == IS_OBJECT) { zend_function *fptr = param->scope.fptr; - if (fptr->type == ZEND_INTERNAL_FUNCTION && + if (fptr->type == ZEND_INTERNAL_FUNCTION && !(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) { RETURN_STRING(((zend_internal_arg_info*) param->info.arg)->class_name); } else RETURN_STR_COPY(param->info.arg->class_name); @@ -5883,7 +5881,7 @@ ZEND_METHOD(reflection_property, getType) if (!ref->prop.type) { RETURN_NULL(); } - + reflection_type_factory(ref->prop.ce, Z_ISUNDEF(intern->obj) ? NULL : &intern->obj, &ref->prop, REF_INFO_PROP, return_value); } /* }}} */ diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt index 01fdd94..158ecb6 100644 --- a/ext/reflection/tests/ReflectionType_001.phpt +++ b/ext/reflection/tests/ReflectionType_001.phpt @@ -90,7 +90,7 @@ $reflector = new ReflectionClass(PropTypeTest::class); foreach ($reflector->getProperties() as $name => $property) { if ($property->hasType()) { - printf("public %s $%s;\n", + printf("public %s $%s;\n", $property->getType(), $property->getName()); } else printf("public $%s;\n", $property->getName()); } diff --git a/ext/standard/tests/serialize/typed_property_refs.phpt b/ext/standard/tests/serialize/typed_property_refs.phpt index e6b0921..a05a8e5 100644 --- a/ext/standard/tests/serialize/typed_property_refs.phpt +++ b/ext/standard/tests/serialize/typed_property_refs.phpt @@ -13,8 +13,8 @@ class B { public int $b; } -var_dump(unserialize('O:1:"A":2:{s:1:"a";i:1;s:1:"b";R:2;}')); -var_dump(unserialize('O:1:"B":2:{s:1:"a";i:1;s:1:"b";R:2;}')); +var_dump(unserialize('O:1:"A":2:{s:1:"a";i:1;s:1:"b";R:2;}')); +var_dump(unserialize('O:1:"B":2:{s:1:"a";i:1;s:1:"b";R:2;}')); ?> --EXPECTF-- diff --git a/ext/standard/var.c b/ext/standard/var.c index 5c40f118..f5b5786 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -74,13 +74,13 @@ static void php_object_property_dump(zend_property_info *prop_info, zval *zv, ze if (Z_TYPE_P(zv) == IS_UNDEF) { if (prop_info->type) { - php_printf("%*cuninitialized(%s)\n", + php_printf("%*cuninitialized(%s)\n", level + 1, ' ', (prop_info->type == IS_OBJECT) ? - ZSTR_VAL(prop_info->type_name) : + ZSTR_VAL(prop_info->type_name) : zend_get_type_by_const(prop_info->type)); } else { - php_printf("%*cuninitialized\n", + php_printf("%*cuninitialized\n", level + 1, ' '); } } else { @@ -269,13 +269,13 @@ static void zval_object_property_dump(zend_property_info *prop_info, zval *zv, z } if (prop_info && Z_TYPE_P(zv) == IS_UNDEF) { if (prop_info->type) { - php_printf("%*cuninitialized(%s)\n", + php_printf("%*cuninitialized(%s)\n", level + 1, ' ', (prop_info->type == IS_OBJECT) ? - ZSTR_VAL(prop_info->type_name) : + ZSTR_VAL(prop_info->type_name) : zend_get_type_by_const(prop_info->type)); } else { - php_printf("%*cuninitialized\n", + php_printf("%*cuninitialized\n", level + 1, ' '); } } else {
diff --git a/Zend/tests/type_declarations/typed_properties_001.phpt b/Zend/tests/type_declarations/typed_properties_001.phpt index 054fc4d..5a346a4 100644 --- a/Zend/tests/type_declarations/typed_properties_001.phpt +++ b/Zend/tests/type_declarations/typed_properties_001.phpt @@ -8,7 +8,7 @@ var_dump(new class(1, 2.2, true, ["four"], new stdClass) { public bool $bool; public array $array; public stdClass $std; - + public function __construct(int $int, float $float, bool $bool, array $array, stdClass $std) { $this->int = $int; $this->float = $float; diff --git a/Zend/tests/type_declarations/typed_properties_004.phpt b/Zend/tests/type_declarations/typed_properties_004.phpt index 59314ab..1d9e640 100644 --- a/Zend/tests/type_declarations/typed_properties_004.phpt +++ b/Zend/tests/type_declarations/typed_properties_004.phpt @@ -4,7 +4,7 @@ Test typed properties error condition (type mismatch) <?php new class("PHP 7 is better than you, and it knows it ...") { public int $int; - + public function __construct(string $string) { $this->int = $string; } diff --git a/Zend/tests/type_declarations/typed_properties_005.phpt b/Zend/tests/type_declarations/typed_properties_005.phpt index 05de225..b521963 100644 --- a/Zend/tests/type_declarations/typed_properties_005.phpt +++ b/Zend/tests/type_declarations/typed_properties_005.phpt @@ -6,7 +6,7 @@ class Dummy {} new class(new Dummy) { public stdClass $std; - + public function __construct(Dummy $dummy) { $this->std = $dummy; } diff --git a/Zend/tests/type_declarations/typed_properties_034.phpt b/Zend/tests/type_declarations/typed_properties_034.phpt index 64a6c5d..dc6d581 100644 --- a/Zend/tests/type_declarations/typed_properties_034.phpt +++ b/Zend/tests/type_declarations/typed_properties_034.phpt @@ -5,12 +5,12 @@ Test typed properties add array element guard $foo = new class { public int $bar = 42; - + public function getIterator() { foreach(['1', &$this->bar] as $item) { - yield $item; + yield $item; } } }; diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 4ac3f8b..43cfd4b 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3693,7 +3693,7 @@ ZEND_API int zend_declare_typed_property(zend_class_entry *ce, zend_string *name property_info->doc_comment = doc_comment; property_info->ce = ce; property_info->type = optional_type; - property_info->type_name = optional_type_name ? + property_info->type_name = optional_type_name ? zend_new_interned_string(optional_type_name) : NULL; property_info->type_ce = NULL; diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 1c4f619..fb40acd 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1150,7 +1150,7 @@ simple_list: str, type_ast, 0, indent); smart_str_appendc(str, ' '); } - + goto simple_list; } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index c5116ed..2101668 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5508,7 +5508,7 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast) /* {{{ */ "Typed property %s::$%s must not be static", ZSTR_VAL(ce->name), ZSTR_VAL(name)); - } + } if (type_ast->kind == ZEND_AST_TYPE) { optional_type = type_ast->attr; @@ -5547,7 +5547,7 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast) /* {{{ */ } } } - + /* Doc comment has been appended as last element in ZEND_AST_PROP_ELEM ast */ if (doc_comment_ast) { doc_comment = zend_string_copy(zend_ast_get_str(doc_comment_ast)); @@ -5570,7 +5570,7 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast) /* {{{ */ if (optional_type && !Z_CONSTANT(value_zv)) { if (optional_type == IS_ARRAY) { if (Z_TYPE(value_zv) != IS_ARRAY) { - zend_error_noreturn(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "Default value for properties with array type can only be an array"); } } else if (optional_type == IS_CALLABLE) { diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 402104b..454d297 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -187,7 +187,7 @@ _zend_vm_is_fetching_reference: case ZEND_TICKS: case ZEND_EXT_STMT: case ZEND_FETCH_DIM_W: - case ZEND_FETCH_W: + case ZEND_FETCH_W: case ZEND_FETCH_OBJ_W: { next++; } goto _zend_vm_is_fetching_reference; @@ -197,8 +197,8 @@ _zend_vm_is_fetching_reference: case ZEND_SEND_REF: case ZEND_RETURN_BY_REF: case ZEND_ASSIGN_REF: - case ZEND_INIT_ARRAY: - case ZEND_ADD_ARRAY_ELEMENT: + case ZEND_INIT_ARRAY: + case ZEND_ADD_ARRAY_ELEMENT: case ZEND_YIELD: { return 1; } break; @@ -826,7 +826,7 @@ ZEND_COLD zend_never_inline void zend_verify_property_type_error(zend_property_i } if (info->type == IS_OBJECT) { - zend_throw_exception_ex(zend_ce_type_error, info->type, + zend_throw_exception_ex(zend_ce_type_error, info->type, "Typed property %s::$%s must be an instance of %s, %s used", ZSTR_VAL(info->ce->name), ZSTR_VAL(name), @@ -835,7 +835,7 @@ ZEND_COLD zend_never_inline void zend_verify_property_type_error(zend_property_i ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property))); } else { - zend_throw_exception_ex(zend_ce_type_error, info->type, + zend_throw_exception_ex(zend_ce_type_error, info->type, "Typed property %s::$%s must be %s, %s used", ZSTR_VAL(info->ce->name), ZSTR_VAL(name), @@ -854,7 +854,7 @@ zend_bool zend_verify_property_type(zend_property_info *info, zval *property, ze switch (info->type) { case IS_OBJECT: { zend_string *resolved = zend_resolve_property_type(info->type_name, info->ce); - + if (!info->type_ce) { info->type_ce = zend_lookup_class(resolved); } diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index e54e0aa..ffd3c93 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -374,7 +374,7 @@ static zend_always_inline zend_bool _zend_object_has_type_hints(zval *object) { if (Z_TYPE_P(object) != IS_OBJECT) break; } else { - break; + break; } } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 1403e19..a70ae05 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -126,11 +126,11 @@ static int clean_non_persistent_type_info(zval *zv) /* {{{ */ prop_info->type_ce = NULL; } } ZEND_HASH_FOREACH_END(); - } + } return ZEND_HASH_APPLY_KEEP; } - return ZEND_HASH_APPLY_STOP; + return ZEND_HASH_APPLY_STOP; } /* }}} */ static int clean_non_persistent_class(zval *zv) /* {{{ */ diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 0ff4814..d14d190 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -657,7 +657,7 @@ zend_string* zend_resolve_property_type(zend_string *name, zend_class_entry *sco if (!type) { return NULL; } - + if (zend_string_equals_literal_ci(type, "parent")) { if (scope && scope->parent) { return scope->parent->name; @@ -680,7 +680,6 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke if (UNEXPECTED(child)) { child_info = Z_PTR_P(child); - if (UNEXPECTED(parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW))) { child_info->flags |= ZEND_ACC_CHANGED; } else { @@ -711,8 +710,8 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke if (!(child_info->flags & ZEND_ACC_CHANGED)) { if (UNEXPECTED(parent_info->type && !(parent_info->flags & ZEND_ACC_PRIVATE))) { if (parent_info->type == IS_OBJECT) { - if (child_info->type != IS_OBJECT || - !zend_string_equals_ci(zend_resolve_property_type(parent_info->type_name, parent_info->ce), + if (child_info->type != IS_OBJECT || + !zend_string_equals_ci(zend_resolve_property_type(parent_info->type_name, parent_info->ce), zend_resolve_property_type(child_info->type_name, child_info->ce))) { zend_error_noreturn(E_COMPILE_ERROR, "Type of %s::$%s must be %s (as in class %s)", diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index d57e488..4939051 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -712,7 +712,7 @@ class_statement_list: class_statement: variable_modifiers optional_type property_list ';' - { $3->attr = $1; + { $3->attr = $1; $$ = zend_ast_create(ZEND_AST_PROP_GROUP, $2, $3); } | method_modifiers T_CONST class_const_list ';' { $$ = $3; $$->attr = $1; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 77d17cc..f7b5f35 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5925,7 +5925,7 @@ ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR) ZSTR_VAL(Z_OBJCE_P(array_ptr)->name)); HANDLE_EXCEPTION(); } - + if (!Z_OBJCE_P(array_ptr)->get_iterator) { if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { if (array_ptr == array_ref) { diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 0f2c3fe..3150c7d 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1287,17 +1287,17 @@ static void reflection_type_factory(void *scope, zval *closure_object, void *inf reference->type = type; intern->ptr = reference; intern->ref_type = REF_TYPE_TYPE; - + switch (type) { case REF_INFO_ARG: { zend_function *fptr = (zend_function*) scope; - + reference->scope.fptr = fptr; intern->ce = fptr->common.scope; reference->info.arg = info; } break; - + case REF_INFO_PROP: reference->scope.ce = scope; intern->ce = scope; @@ -3002,14 +3002,12 @@ ZEND_METHOD(reflection_type, allowsNull) GET_REFLECTION_OBJECT_PTR(param); switch (param->type) { - case REF_INFO_ARG: { + case REF_INFO_ARG: RETVAL_BOOL(param->info.arg->allow_null); - } break; - - + break; case REF_INFO_PROP: RETVAL_FALSE; - break; + break; } } /* }}} */ @@ -3045,7 +3043,7 @@ ZEND_METHOD(reflection_type, __toString) reflection_object *intern; type_reference *param; zend_uchar type = IS_UNDEF; - + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -3058,7 +3056,7 @@ ZEND_METHOD(reflection_type, __toString) if (type == IS_OBJECT) { zend_function *fptr = param->scope.fptr; - if (fptr->type == ZEND_INTERNAL_FUNCTION && + if (fptr->type == ZEND_INTERNAL_FUNCTION && !(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) { RETURN_STRING(((zend_internal_arg_info*) param->info.arg)->class_name); } else RETURN_STR_COPY(param->info.arg->class_name); @@ -5883,7 +5881,7 @@ ZEND_METHOD(reflection_property, getType) if (!ref->prop.type) { RETURN_NULL(); } - + reflection_type_factory(ref->prop.ce, Z_ISUNDEF(intern->obj) ? NULL : &intern->obj, &ref->prop, REF_INFO_PROP, return_value); } /* }}} */ diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt index 01fdd94..158ecb6 100644 --- a/ext/reflection/tests/ReflectionType_001.phpt +++ b/ext/reflection/tests/ReflectionType_001.phpt @@ -90,7 +90,7 @@ $reflector = new ReflectionClass(PropTypeTest::class); foreach ($reflector->getProperties() as $name => $property) { if ($property->hasType()) { - printf("public %s $%s;\n", + printf("public %s $%s;\n", $property->getType(), $property->getName()); } else printf("public $%s;\n", $property->getName()); } diff --git a/ext/standard/tests/serialize/typed_property_refs.phpt b/ext/standard/tests/serialize/typed_property_refs.phpt index e6b0921..a05a8e5 100644 --- a/ext/standard/tests/serialize/typed_property_refs.phpt +++ b/ext/standard/tests/serialize/typed_property_refs.phpt @@ -13,8 +13,8 @@ class B { public int $b; } -var_dump(unserialize('O:1:"A":2:{s:1:"a";i:1;s:1:"b";R:2;}')); -var_dump(unserialize('O:1:"B":2:{s:1:"a";i:1;s:1:"b";R:2;}')); +var_dump(unserialize('O:1:"A":2:{s:1:"a";i:1;s:1:"b";R:2;}')); +var_dump(unserialize('O:1:"B":2:{s:1:"a";i:1;s:1:"b";R:2;}')); ?> --EXPECTF-- diff --git a/ext/standard/var.c b/ext/standard/var.c index 5c40f118..f5b5786 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -74,13 +74,13 @@ static void php_object_property_dump(zend_property_info *prop_info, zval *zv, ze if (Z_TYPE_P(zv) == IS_UNDEF) { if (prop_info->type) { - php_printf("%*cuninitialized(%s)\n", + php_printf("%*cuninitialized(%s)\n", level + 1, ' ', (prop_info->type == IS_OBJECT) ? - ZSTR_VAL(prop_info->type_name) : + ZSTR_VAL(prop_info->type_name) : zend_get_type_by_const(prop_info->type)); } else { - php_printf("%*cuninitialized\n", + php_printf("%*cuninitialized\n", level + 1, ' '); } } else { @@ -269,13 +269,13 @@ static void zval_object_property_dump(zend_property_info *prop_info, zval *zv, z } if (prop_info && Z_TYPE_P(zv) == IS_UNDEF) { if (prop_info->type) { - php_printf("%*cuninitialized(%s)\n", + php_printf("%*cuninitialized(%s)\n", level + 1, ' ', (prop_info->type == IS_OBJECT) ? - ZSTR_VAL(prop_info->type_name) : + ZSTR_VAL(prop_info->type_name) : zend_get_type_by_const(prop_info->type)); } else { - php_printf("%*cuninitialized\n", + php_printf("%*cuninitialized\n", level + 1, ' '); } } else {