Skip to content

Commit

Permalink
Revert unintended tentative return type change
Browse files Browse the repository at this point in the history
I accidentally made the return type of all Reflection*::getAttributes() methods tentative, even though they have already been declared natively.
  • Loading branch information
kocsismate committed Sep 2, 2021
1 parent 4483ecf commit 194f1f0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
4 changes: 0 additions & 4 deletions ext/reflection/php_reflection.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ public function getNamespaceName(): string {}
/** @tentative-return-type */
public function getShortName(): string {}

/** @tentative-return-type */
public function getAttributes(?string $name = null, int $flags = 0): array {}
}

Expand Down Expand Up @@ -450,7 +449,6 @@ public function hasDefaultValue(): bool {}
/** @tentative-return-type */
public function getDefaultValue(): mixed {}

/** @tentative-return-type */
public function getAttributes(?string $name = null, int $flags = 0): array {}
}

Expand Down Expand Up @@ -493,7 +491,6 @@ public function getDeclaringClass(): ReflectionClass {}
/** @tentative-return-type */
public function getDocComment(): string|false {}

/** @tentative-return-type */
public function getAttributes(?string $name = null, int $flags = 0): array {}

public function isEnumCase(): bool {}
Expand Down Expand Up @@ -577,7 +574,6 @@ public function isVariadic(): bool {}

public function isPromoted(): bool {}

/** @tentative-return-type */
public function getAttributes(?string $name = null, int $flags = 0): array {}
}

Expand Down
13 changes: 5 additions & 8 deletions ext/reflection/php_reflection_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: aae05073f9a7898d836023183809faa265cb99c3 */
* Stub hash: 2316b7245c77ca2a5dd8baef53002c890eab162e */

ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
Expand Down Expand Up @@ -313,10 +313,7 @@ ZEND_END_ARG_INFO()

#define arginfo_class_ReflectionClass_getShortName arginfo_class_ReflectionFunctionAbstract_getName

ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionClass_getAttributes, 0, 0, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
#define arginfo_class_ReflectionClass_getAttributes arginfo_class_ReflectionFunctionAbstract_getAttributes

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionObject___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)
Expand Down Expand Up @@ -377,7 +374,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionProperty_getDefaultValue, 0, 0, IS_MIXED, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_ReflectionProperty_getAttributes arginfo_class_ReflectionClass_getAttributes
#define arginfo_class_ReflectionProperty_getAttributes arginfo_class_ReflectionFunctionAbstract_getAttributes

#define arginfo_class_ReflectionClassConstant___clone arginfo_class_ReflectionFunctionAbstract___clone

Expand Down Expand Up @@ -406,7 +403,7 @@ ZEND_END_ARG_INFO()

#define arginfo_class_ReflectionClassConstant_getDocComment arginfo_class_ReflectionFunctionAbstract_getDocComment

#define arginfo_class_ReflectionClassConstant_getAttributes arginfo_class_ReflectionClass_getAttributes
#define arginfo_class_ReflectionClassConstant_getAttributes arginfo_class_ReflectionFunctionAbstract_getAttributes

#define arginfo_class_ReflectionClassConstant_isEnumCase arginfo_class_ReflectionFunctionAbstract_hasTentativeReturnType

Expand Down Expand Up @@ -458,7 +455,7 @@ ZEND_END_ARG_INFO()

#define arginfo_class_ReflectionParameter_isPromoted arginfo_class_ReflectionFunctionAbstract_hasTentativeReturnType

#define arginfo_class_ReflectionParameter_getAttributes arginfo_class_ReflectionClass_getAttributes
#define arginfo_class_ReflectionParameter_getAttributes arginfo_class_ReflectionFunctionAbstract_getAttributes

#define arginfo_class_ReflectionType___clone arginfo_class_ReflectionFunctionAbstract___clone

Expand Down
2 changes: 1 addition & 1 deletion ext/reflection/tests/ReflectionClass_toString_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector, String
Parameter #0 [ <optional> ?string $name = null ]
Parameter #1 [ <optional> int $flags = 0 ]
}
- Tentative return [ array ]
- Return [ array ]
}
}
}

0 comments on commit 194f1f0

Please sign in to comment.