mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 07:41:43 +03:00
Compability with PHP 8.1 (class_exists calling)
This commit is contained in:
parent
66bcfd82e3
commit
c764717de4
@ -627,7 +627,7 @@ class ApiDocExtractor
|
||||
{
|
||||
if ($actualType == DataTypes::MODEL) {
|
||||
|
||||
if (class_exists($subType)) {
|
||||
if ($subType && class_exists($subType)) {
|
||||
$parts = explode('\\', $subType);
|
||||
|
||||
return sprintf('object (%s)', end($parts));
|
||||
@ -642,7 +642,7 @@ class ApiDocExtractor
|
||||
return sprintf('array of %ss', $subType);
|
||||
}
|
||||
|
||||
if (class_exists($subType)) {
|
||||
if ($subType && class_exists($subType)) {
|
||||
$parts = explode('\\', $subType);
|
||||
|
||||
return sprintf('array of objects (%s)', end($parts));
|
||||
|
@ -182,7 +182,7 @@ class FormTypeParser implements ParserInterface
|
||||
|
||||
$subType = is_object($type) ? get_class($type) : $type;
|
||||
|
||||
if (class_exists($subType)) {
|
||||
if ($subType && class_exists($subType)) {
|
||||
$parts = explode('\\', $subType);
|
||||
$dataType = sprintf('object (%s)', end($parts));
|
||||
} else {
|
||||
@ -294,7 +294,7 @@ class FormTypeParser implements ParserInterface
|
||||
$actualType = DataTypes::COLLECTION;
|
||||
$subType = is_object($embbededType) ? get_class($embbededType) : $embbededType;
|
||||
|
||||
if (class_exists($subType)) {
|
||||
if ($subType && class_exists($subType)) {
|
||||
$parts = explode('\\', $subType);
|
||||
$bestType = sprintf('array of objects (%s)', end($parts));
|
||||
} else {
|
||||
@ -441,7 +441,7 @@ class FormTypeParser implements ParserInterface
|
||||
|
||||
private function implementsType($item)
|
||||
{
|
||||
if (!class_exists($item)) {
|
||||
if (null === $item || !class_exists($item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ class JmsMetadataParser implements ParserInterface, PostParserInterface
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (class_exists($className)) {
|
||||
if ($className && class_exists($className)) {
|
||||
$parts = explode('\\', $className);
|
||||
$dataType = sprintf('object (%s)', end($parts));
|
||||
} else {
|
||||
@ -180,7 +180,7 @@ class JmsMetadataParser implements ParserInterface, PostParserInterface
|
||||
}
|
||||
|
||||
// we can use type property also for custom handlers, then we don't have here real class name
|
||||
if (!class_exists($dataType['class'])) {
|
||||
if (!$dataType['class'] || !class_exists($dataType['class'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ class JmsMetadataParser implements ParserInterface, PostParserInterface
|
||||
}
|
||||
|
||||
// we can use type property also for custom handlers, then we don't have here real class name
|
||||
if (!class_exists($type)) {
|
||||
if (!$type || !class_exists($type)) {
|
||||
return array(
|
||||
'normalized' => sprintf("custom handler result for (%s)", $type),
|
||||
'class' => $type,
|
||||
|
@ -84,7 +84,7 @@ class ValidationParser implements ParserInterface, PostParserInterface
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
if (class_exists($className)) {
|
||||
if ($className && class_exists($className)) {
|
||||
$parts = explode('\\', $className);
|
||||
$dataType = sprintf('object (%s)', end($parts));
|
||||
} else {
|
||||
@ -313,7 +313,7 @@ class ValidationParser implements ParserInterface, PostParserInterface
|
||||
if ($childConstraint instanceof Type) {
|
||||
$nestedType = $childConstraint->type;
|
||||
$exp = explode("\\", $nestedType);
|
||||
if (!class_exists($nestedType)) {
|
||||
if (!$nestedType || !class_exists($nestedType)) {
|
||||
$nestedType = substr($className, 0, strrpos($className, '\\') + 1).$nestedType;
|
||||
|
||||
if (!class_exists($nestedType)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user