Showing 3,272 of 4,939 total issues
Method canCastToUnionTypeWithoutConfig
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function canCastToUnionTypeWithoutConfig(
UnionType $target
): bool {
// Fast-track most common cases first
$type_set = $this->type_set;
Method getAnalyzeFunctionCallClosuresStatic
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function getAnalyzeFunctionCallClosuresStatic(): array
{
/**
* @param list<Node|int|float|string> $args
*/
Method analyzeValueNodeOfShapedArray
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function analyzeValueNodeOfShapedArray(
UnionType $element_type,
$value_node
): void {
if (!$value_node instanceof Node) {
Method findAlternateReferencedElementDeclaration
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function findAlternateReferencedElementDeclaration(
CodeBase $code_base,
AddressableElement $element
): ?AddressableElement {
$old_fqsen = $element->getFQSEN();
Method addTypesToProperty
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function addTypesToProperty(Property $property, Node $node): void
{
if ($property->getRealUnionType()->isEmpty() && $property->getPHPDocUnionType()->isEmpty()) {
$property->setUnionType(
$this->right_type
Method mergeCatchContext
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function mergeCatchContext(Node $node): Context
{
if (\count($this->child_context_list) < 2) {
throw new AssertionError("Expected at least two contexts in " . __METHOD__);
}
Method analyzeReturnStrict
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function analyzeReturnStrict(
CodeBase $code_base,
FunctionInterface $method,
UnionType $expression_type,
UnionType $method_return_type,
Method checkUnionTypeCompatibility
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkUnionTypeCompatibility(?Node $type): void
{
if (!$type) {
return;
}
Method checkIsValidStringOffset
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkIsValidStringOffset(UnionType $union_type, Node $node, UnionType $dim_type): void
{
$max_len = -1;
foreach ($union_type->getRealTypeSet() as $type) {
if ($type instanceof StringType) {
Method visitUnaryOp
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitUnaryOp(Node $node): UnionType
{
$result = self::unionTypeFromNode(
$this->code_base,
$this->context,
Method make
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function make(
string $namespace,
string $name,
int $alternate_id = 0
) {
Method asScalarValues
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function asScalarValues(bool $strict = false): ?array
{
$result = [];
$has_null = false;
$has_false = false;
Method parseListTypeFromTemplateParameterList
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function parseListTypeFromTemplateParameterList(
array $template_parameter_type_list,
bool $is_nullable,
bool $always_has_elements
): ArrayType {
Method computeExpandedTypes
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function computeExpandedTypes(CodeBase $code_base, int $recursion_depth): UnionType
{
$union_type = $this->asPHPDocUnionType();
$class_fqsen = $this->asFQSEN();
Method phan_output_ast_installation_instructions
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function phan_output_ast_installation_instructions(): void
{
require_once __DIR__ . '/Library/StringUtil.php';
$ini_path = php_ini_loaded_file() ?: '(php.ini path could not be determined - try creating one at ' . dirname(PHP_BINARY) . '\\php.ini as a new empty file, or one based on php.ini.development or php.ini.production)';
$configured_extension_dir = ini_get('extension_dir');
Method getAnalyzeFunctionCallClosuresStatic
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function getAnalyzeFunctionCallClosuresStatic(): array
{
/**
* @param list<Node|int|string|float> $args
*/
Method emitIssueForBinaryOp
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function emitIssueForBinaryOp(
Node $node,
UnionType $left,
UnionType $right,
string $issue_name,
Method visitIsset
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitIsset(Node $node): void
{
$var_node = $node->children['var'];
try {
$type = UnionTypeVisitor::unionTypeFromNode($this->code_base, $this->context, $var_node, false);
Method calculateNarrowedUnionType
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function calculateNarrowedUnionType(CodeBase $code_base, Context $context, UnionType $old_type, UnionType $asserted_object_type): UnionType
{
$new_type_set = [];
foreach ($old_type->getTypeSet() as $type) {
if ($type instanceof MixedType) {
Method compareYieldAgainstDeclaredType
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function compareYieldAgainstDeclaredType(Node $node, FunctionInterface $method, Context $context, array $template_type_list): Context
{
$code_base = $this->code_base;
$type_list_count = \count($template_type_list);