Skip to content

Sniff to check for undesirable usages of is_a() #4

@d4mation

Description

@d4mation

is_a() has some valid use cases, so this would need to be done carefully.

is_a( 'class_name', 'another_class_name' ) is a valid use case and should be allowed.

is_a( $object, 'class_name' ) is not allowed and we should suggest using instanceof instead.

Unfortunately, auto-fixing here may not be very feasible, since is_a() may be combined with other checks like is_object() that would no longer be necessary. We may instead just need to report it back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions