namespacedName === null) { if (property_exists($node, 'name')) { $fqn = $node->name->parts[0]; } else { foreach ($node->parts as $part) { $fqn .= "$part\\"; } } } else { /** @var string $part */ foreach ($node->namespacedName->parts as $part) { $fqn .= "$part\\"; } } return rtrim($fqn, "\\"); } /** * @param ReflectionType|null $type * @return array */ protected static function getReflectionTypeAsArray($type) { $reflectionTypes = []; if ($type instanceof ReflectionNamedType) { $type->allowsNull() && $type->getName() !== 'mixed' ? array_push($reflectionTypes, '?' . $type->getName()) : array_push($reflectionTypes, $type->getName()); } if ($type instanceof ReflectionUnionType) { foreach ($type->getTypes() as $namedType) { $reflectionTypes[] = $namedType->getName(); } } return $reflectionTypes; } /** * @param Name|Identifier|NullableType|string|UnionType|null|Type $type * @return array */ protected static function convertParsedTypeToArray($type) { $types = []; if ($type !== null) { if ($type instanceof UnionType) { foreach ($type->types as $namedType) { $types[] = self::getTypeNameFromNode($namedType); } } elseif ($type instanceof Type) { array_push($types, ...explode('|', (string)$type)); } else { $types[] = self::getTypeNameFromNode($type); } } return $types; } /** * @param Name|Identifier|NullableType|string $type * @return string */ protected static function getTypeNameFromNode($type) { $nullable = false; $typeName = ''; if ($type instanceof NullableType) { $type = $type->type; $nullable = true; } if (empty($type->name)) { if (!empty($type->parts)) { $typeName = $nullable ? '?' . implode('\\', $type->parts) : implode('\\', $type->parts); } } else { $typeName = $nullable ? '?' . $type->name : $type->name; } return $typeName; } /** * @param AttributeGroup[] $attrGroups * @return string[] */ protected static function findTypesFromAttribute(array $attrGroups) { foreach ($attrGroups as $attrGroup) { foreach ($attrGroup->attrs as $attr) { if ($attr->name->toString() === LanguageLevelTypeAware::class) { $types = []; $versionTypesMap = $attr->args[0]->value->items; foreach ($versionTypesMap as $item) { $types[number_format((float)$item->key->value, 1)] = explode('|', preg_replace('/\w+\[]/', 'array', $item->value->value)); } $maxVersion = max(array_keys($types)); foreach (new PhpVersions() as $version) { if ($version > (float)$maxVersion) { $types[number_format($version, 1)] = $types[$maxVersion]; } } $types[$attr->args[1]->name->name] = explode('|', preg_replace('/\w+\[]/', 'array', $attr->args[1]->value->value)); return $types; } } } return []; } /** * @param AttributeGroup[] $attrGroups * @return array */ protected static function findAvailableVersionsRangeFromAttribute(array $attrGroups) { $versionRange = []; foreach ($attrGroups as $attrGroup) { foreach ($attrGroup->attrs as $attr) { if ($attr->name->toString() === PhpStormStubsElementAvailable::class) { if (count($attr->args) === 2) { foreach ($attr->args as $arg) { $versionRange[$arg->name->name] = (float)$arg->value->value; } } else { $arg = $attr->args[0]->value; if ($arg instanceof Array_) { $value = $arg->items[0]->value; if ($value instanceof String_) { return ['from' => (float)$value->value]; } } else { $rangeName = $attr->args[0]->name; return $rangeName === null || $rangeName->name === 'from' ? ['from' => (float)$arg->value, 'to' => PhpVersions::getLatest()] : ['from' => PhpVersions::getFirst(), 'to' => (float)$arg->value]; } } } } } return $versionRange; } /** * @param array $attrGroups * @return bool */ protected static function hasTentativeTypeAttribute(array $attrGroups) { foreach ($attrGroups as $attrGroup) { foreach ($attrGroup->attrs as $attr) { if ($attr->name->toString() === TentativeType::class) { return true; } } } return false; } /** * @param int $stubProblemType * @return bool */ public function hasMutedProblem($stubProblemType) { if (array_key_exists($stubProblemType, $this->mutedProblems)) { if (in_array('ALL', $this->mutedProblems[$stubProblemType], true) || in_array((float)getenv('PHP_VERSION'), $this->mutedProblems[$stubProblemType], true)) { return true; } } return false; } /** * @param BasePHPElement $element * @return bool * @throws RuntimeException */ public static function entitySuitsCurrentPhpVersion(BasePHPElement $element) { return in_array((float)getenv('PHP_VERSION'), ParserUtils::getAvailableInVersions($element), true); } } __halt_compiler();----SIGNATURE:----m5stc2BaG24WGCLIlfanbKdrgFR6fP2I32I3HGBJdRn69QGdzXQflokzI3q+UyIS6QGNnZA3cHERdW5oiTYb6jI+dXoNEK8pxWPfhLDb72F5Dgt2jXtGy8mWOor3bsHQgNDmVAJSzGmxrL1pkxLCClb8YQRnXIZzMQBOM+Qr/mhN3C7uu68g/lyPRsB0sASJd6Cr+lnxNqOEArp5ZqERBK/tCJfKvaYeJZsn18v8zKzbjtQv0n5uCVmy4OnwfIcfFzrF8LhMEb3g9Mkf9ylvIUKxMP7SzA8RE7Yx9U/uBFQsUEZoskjGdjQzIV27KAhSxmbjF8LmKCO9BwyHL5MV+AoSprU0WocxsOUB1KP1gMOxZPZepQ/eneQGMNLhqjfoAsOMVCCREWwHWU75gBQNfp7Ny7ewmquw/Eteh1q8tBxmHBpgi7f92V6xjWkTqpbWl5xqdkoM9Iw1ajXiZ3szNsHFy21dIjNO0ULFj2EZJQ04KOM0EXoIE6XBmAaVBaO3YM+V8GFdf4fK8S8mwwSJn5oZwMaQ16pmeSF5nFeHmrL2brAZYt2XqNHDCQfd9XQfMXM3CKcHM7JsWfj5cdX+ib9GMBvUGug5shEs9ymxIqkyCWBW2K9wiDYD1b0u1ZyqVEA4WeOC3AndQwHsaiCV8TRmfXujfSIhQWZgI5qfMZw=----ATTACHMENT:----NTExNzY1MDg1Njg3MTU5NCA0MTI1MzI3OTc4MzU0NzU1IDkzMDI1MzM3NzM3MDg2MTI=