Description
Bug Report
Q | A |
---|---|
Version(s) | 4.13.0 |
Summary
The issue is reproduced when calling detectType() with PHP8.3. The function is mentioned as Deprecated in codebase.
File: src/Reflection/ParameterReflection.php
Line:81

Error:

Current behavior
How to reproduce
Calling this function detectType() on PHP8.3 throw this error.
Expected behavior
There should be added one check if the function is not available on a particular version, the error should not be thrown.
Proposed Fix (which is working):
1-
Instead of
if (null !== ($type = $this->parameterReflection->getType()) && $type->isBuiltin()) {
we can fix by adding one check
if (null !== ($type = $this->parameterReflection->getType()) && method_exists($type, 'isBuiltin') && $type->isBuiltin()) {
2-
And instead of
if (null !== $type && $type->getName() === 'self') {
we can fix by adding one check
if (null !== $type && method_exists($type, 'getName') && $type->getName() === 'self') {