Skip to content

Adding node information to DeprecatedScopeResolver::isScopeDeprecated? #106

@bbrala

Description

@bbrala

I wonder, sometimes I need more context while determining if a node in a scope is deprecated. Mostly to 'undeprecate' sometime. Would you mind if node was added as context/information to DeprecatedScopeResolver::isScopeDeprecated?

I'm trying to target the deprecated_function() in the following code:

        \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.1.0', fn() => deprecated_function_call(), fn() => count([]));

        DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.1.0', fn() => deprecated_function_call(), fn() => count([]));

        DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.1.0', function() {
            deprecated_function_call();
        }, function() {
            count([]);
        });

I also tried other avenues, like, trying to pragmaticly add lines to ignore through a visitor. I could also use NodeVisitor and then NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN, but that means no code checks in all of the children.

I'm kinda stumped right now, but would love to be able to only exclude deprecations from those node (be it anonimous functions, or whatever).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions