Skip to content

Commit a11e9c9

Browse files
authored
Simplify php_reflection.c, class name cannot start with backslash (php#10536)
* fix comment typo * (normalized) class name never start with backslash
1 parent 1cb38e4 commit a11e9c9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

ext/reflection/php_reflection.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -3496,7 +3496,7 @@ ZEND_METHOD(ReflectionFunctionAbstract, inNamespace)
34963496

34973497
zend_string *name = fptr->common.function_name;
34983498
const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
3499-
RETURN_BOOL(backslash && backslash > ZSTR_VAL(name));
3499+
RETURN_BOOL(backslash);
35003500
}
35013501
/* }}} */
35023502

@@ -3514,7 +3514,7 @@ ZEND_METHOD(ReflectionFunctionAbstract, getNamespaceName)
35143514

35153515
zend_string *name = fptr->common.function_name;
35163516
const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
3517-
if (backslash && backslash > ZSTR_VAL(name)) {
3517+
if (backslash) {
35183518
RETURN_STRINGL(ZSTR_VAL(name), backslash - ZSTR_VAL(name));
35193519
}
35203520
RETURN_EMPTY_STRING();
@@ -3535,7 +3535,7 @@ ZEND_METHOD(ReflectionFunctionAbstract, getShortName)
35353535

35363536
zend_string *name = fptr->common.function_name;
35373537
const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
3538-
if (backslash && backslash > ZSTR_VAL(name)) {
3538+
if (backslash) {
35393539
RETURN_STRINGL(backslash + 1, ZSTR_LEN(name) - (backslash - ZSTR_VAL(name) + 1));
35403540
}
35413541
RETURN_STR_COPY(name);
@@ -5363,7 +5363,7 @@ ZEND_METHOD(ReflectionClass, inNamespace)
53635363

53645364
zend_string *name = ce->name;
53655365
const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
5366-
RETURN_BOOL(backslash && backslash > ZSTR_VAL(name));
5366+
RETURN_BOOL(backslash);
53675367
}
53685368
/* }}} */
53695369

@@ -5381,7 +5381,7 @@ ZEND_METHOD(ReflectionClass, getNamespaceName)
53815381

53825382
zend_string *name = ce->name;
53835383
const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
5384-
if (backslash && backslash > ZSTR_VAL(name)) {
5384+
if (backslash) {
53855385
RETURN_STRINGL(ZSTR_VAL(name), backslash - ZSTR_VAL(name));
53865386
}
53875387
RETURN_EMPTY_STRING();
@@ -5402,7 +5402,7 @@ ZEND_METHOD(ReflectionClass, getShortName)
54025402

54035403
zend_string *name = ce->name;
54045404
const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
5405-
if (backslash && backslash > ZSTR_VAL(name)) {
5405+
if (backslash) {
54065406
RETURN_STRINGL(backslash + 1, ZSTR_LEN(name) - (backslash - ZSTR_VAL(name) + 1));
54075407
}
54085408
RETURN_STR_COPY(name);
@@ -5667,7 +5667,7 @@ ZEND_METHOD(ReflectionProperty, setValue)
56675667
}
56685668
/* }}} */
56695669

5670-
/* {{{ Returns this property's value */
5670+
/* {{{ Returns true if property was initialized */
56715671
ZEND_METHOD(ReflectionProperty, isInitialized)
56725672
{
56735673
reflection_object *intern;
@@ -6499,7 +6499,7 @@ ZEND_METHOD(ReflectionAttribute, __toString)
64996499
}
65006500
/* }}} */
65016501

6502-
/* {{{ * Returns the name of the attribute */
6502+
/* {{{ Returns the name of the attribute */
65036503
ZEND_METHOD(ReflectionAttribute, getName)
65046504
{
65056505
reflection_object *intern;
@@ -6514,7 +6514,7 @@ ZEND_METHOD(ReflectionAttribute, getName)
65146514
}
65156515
/* }}} */
65166516

6517-
/* {{{ * Returns the target of the attribute */
6517+
/* {{{ Returns the target of the attribute */
65186518
ZEND_METHOD(ReflectionAttribute, getTarget)
65196519
{
65206520
reflection_object *intern;
@@ -6529,7 +6529,7 @@ ZEND_METHOD(ReflectionAttribute, getTarget)
65296529
}
65306530
/* }}} */
65316531

6532-
/* {{{ * Returns true if the attribute is repeated */
6532+
/* {{{ Returns true if the attribute is repeated */
65336533
ZEND_METHOD(ReflectionAttribute, isRepeated)
65346534
{
65356535
reflection_object *intern;
@@ -6544,7 +6544,7 @@ ZEND_METHOD(ReflectionAttribute, isRepeated)
65446544
}
65456545
/* }}} */
65466546

6547-
/* {{{ * Returns the arguments passed to the attribute */
6547+
/* {{{ Returns the arguments passed to the attribute */
65486548
ZEND_METHOD(ReflectionAttribute, getArguments)
65496549
{
65506550
reflection_object *intern;
@@ -6661,7 +6661,7 @@ static void attribute_ctor_cleanup(
66616661
}
66626662
/* }}} */
66636663

6664-
/* {{{ * Returns the attribute as an object */
6664+
/* {{{ Returns the attribute as an object */
66656665
ZEND_METHOD(ReflectionAttribute, newInstance)
66666666
{
66676667
reflection_object *intern;

0 commit comments

Comments
 (0)