Skip to content

Commit e761d76

Browse files
author
gron
committed
Fixed inconsistent whitespace.
# Belongs to svn rev. 318793. git-svn-id: http://svn.php.net/repository/php/php-src/trunk@318794 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent 4e95403 commit e761d76

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

Zend/zend_compile.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3617,19 +3617,19 @@ static int zend_traits_merge_functions(zend_function *fn TSRMLS_DC, int num_args
36173617
/* if it is an abstract method, there is no collision */
36183618
if (other_trait_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
36193619
/* Make sure they are compatible */
3620-
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
3621-
/* In case both are abstract, just check prototype, but need to do that in both directions */
3622-
if ( !zend_do_perform_implementation_check(fn, other_trait_fn TSRMLS_CC)
3623-
|| !zend_do_perform_implementation_check(other_trait_fn, fn TSRMLS_CC)) {
3624-
zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", //ZEND_FN_SCOPE_NAME(fn), fn->common.function_name, //::%s()
3625-
zend_get_function_declaration(fn TSRMLS_CC),
3626-
zend_get_function_declaration(other_trait_fn TSRMLS_CC));
3627-
}
3628-
}
3629-
else {
3630-
/* otherwise, do the full check */
3631-
do_inheritance_check_on_method(fn, other_trait_fn TSRMLS_CC);
3632-
}
3620+
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
3621+
/* In case both are abstract, just check prototype, but need to do that in both directions */
3622+
if ( !zend_do_perform_implementation_check(fn, other_trait_fn TSRMLS_CC)
3623+
|| !zend_do_perform_implementation_check(other_trait_fn, fn TSRMLS_CC)) {
3624+
zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", //ZEND_FN_SCOPE_NAME(fn), fn->common.function_name, //::%s()
3625+
zend_get_function_declaration(fn TSRMLS_CC),
3626+
zend_get_function_declaration(other_trait_fn TSRMLS_CC));
3627+
}
3628+
}
3629+
else {
3630+
/* otherwise, do the full check */
3631+
do_inheritance_check_on_method(fn, other_trait_fn TSRMLS_CC);
3632+
}
36333633

36343634
/* we can savely free and remove it from other table */
36353635
zend_function_dtor(other_trait_fn);
@@ -3639,7 +3639,7 @@ static int zend_traits_merge_functions(zend_function *fn TSRMLS_DC, int num_args
36393639
/* if fn is an abstract method */
36403640
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
36413641
/* Make sure they are compatible.
3642-
Here, we already know other_trait_fn cannot be abstract, full check ok. */
3642+
Here, we already know other_trait_fn cannot be abstract, full check ok. */
36433643
do_inheritance_check_on_method(other_trait_fn, fn TSRMLS_CC);
36443644

36453645
/* just mark as solved, will be added if its own trait is processed */
@@ -3856,39 +3856,39 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
38563856
zend_function* existing_fn = NULL;
38573857
zend_function fn_copy, *fn_copy_p;
38583858
zend_function* prototype = NULL; /* is used to determine the prototype according to the inheritance chain */
3859-
3859+
38603860
if (zend_hash_quick_find(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**) &existing_fn) == FAILURE) {
38613861
add = 1; /* not found */
38623862
} else if (existing_fn->common.scope != ce) {
38633863
add = 1; /* or inherited from other class or interface */
38643864
}
3865-
3865+
38663866
if (add) {
38673867
zend_function* parent_function;
38683868
if (ce->parent && zend_hash_quick_find(&ce->parent->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**) &parent_function) != FAILURE) {
38693869
prototype = parent_function; /* ->common.fn_flags |= ZEND_ACC_ABSTRACT; */
38703870

38713871
/* we got that method in the parent class, and are going to override it,
3872-
except, if the trait is just asking to have an abstract method implemented. */
3872+
except, if the trait is just asking to have an abstract method implemented. */
38733873
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
38743874
/* then we clean up an skip this method */
38753875
zend_function_dtor(fn);
38763876
return ZEND_HASH_APPLY_REMOVE;
38773877
}
38783878
}
3879-
3879+
38803880
fn->common.scope = ce;
38813881
fn->common.prototype = prototype;
3882-
3882+
38833883
if (prototype
3884-
&& (prototype->common.fn_flags & ZEND_ACC_IMPLEMENTED_ABSTRACT
3885-
|| prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) {
3886-
fn->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
3887-
} else if (fn->common.fn_flags & ZEND_ACC_IMPLEMENTED_ABSTRACT) {
3888-
/* remove ZEND_ACC_IMPLEMENTED_ABSTRACT flag, think it shouldn't be copied to class */
3889-
fn->common.fn_flags = fn->common.fn_flags - ZEND_ACC_IMPLEMENTED_ABSTRACT;
3890-
}
3891-
3884+
&& (prototype->common.fn_flags & ZEND_ACC_IMPLEMENTED_ABSTRACT
3885+
|| prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) {
3886+
fn->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
3887+
} else if (fn->common.fn_flags & ZEND_ACC_IMPLEMENTED_ABSTRACT) {
3888+
/* remove ZEND_ACC_IMPLEMENTED_ABSTRACT flag, think it shouldn't be copied to class */
3889+
fn->common.fn_flags = fn->common.fn_flags - ZEND_ACC_IMPLEMENTED_ABSTRACT;
3890+
}
3891+
38923892
/* check whether the trait method fullfills the inheritance requirements */
38933893
if (prototype) {
38943894
do_inheritance_check_on_method(fn, prototype TSRMLS_CC);
@@ -3919,18 +3919,18 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
39193919
}
39203920
fn_copy = *fn;
39213921
zend_traits_duplicate_function(&fn_copy, ce, estrdup(fn->common.function_name) TSRMLS_CC);
3922-
3922+
39233923
if (zend_hash_quick_update(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, &fn_copy, sizeof(zend_function), (void**)&fn_copy_p)==FAILURE) {
39243924
zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occured during updating class method table", hash_key->arKey);
39253925
}
3926-
3926+
39273927
zend_add_magic_methods(ce, hash_key->arKey, hash_key->nKeyLength, fn_copy_p TSRMLS_CC);
3928-
3928+
39293929
zend_function_dtor(fn);
39303930
} else {
39313931
zend_function_dtor(fn);
39323932
}
3933-
3933+
39343934
return ZEND_HASH_APPLY_REMOVE;
39353935
}
39363936
/* }}} */
@@ -3946,12 +3946,12 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
39463946
zend_function fn_copy;
39473947
void* dummy;
39483948
size_t i = 0;
3949-
3949+
39503950
target = va_arg(args, HashTable*);
39513951
target_ce = va_arg(args, zend_class_entry*);
39523952
aliases = va_arg(args, zend_trait_alias**);
39533953
exclude_table = va_arg(args, HashTable*);
3954-
3954+
39553955
fnname_len = strlen(fn->common.function_name);
39563956

39573957
/* apply aliases which are qualified with a class name, there should not be any ambiguity */

0 commit comments

Comments
 (0)