Skip to content

[PSR-4] PseudoNamespaceToNamespaceRector generates invalid php-code #1732

@shyim

Description

@shyim
Subject Details
PHP version PHP 7.3.7
Full Command ~/Code/rector/bin/rector process --config rector.yaml tests/Functional/

Current Behaviour

image

Minimal PHP Code Causing Issue

It's this class https://github.com/shopware/shopware/blob/03d3bcb33be7d39a7790124078baab3a0d83ecea/tests/Functional/Controllers/Backend/CategoryTest.php#L38

Following rector config used:

services:
    Rector\Rector\Namespace_\PseudoNamespaceToNamespaceRector:
        $namespacePrefixesWithExcludedClasses:
            Shopware_: {  }

parameters:
    php_version_features: '7.2'
    exclude_paths:
        - 'tests/Functional/bootstrap.php'
    autoload_paths:
        - 'vendor/autoload.php'
        - 'engine/Library/Enlight'
        - 'tests'

Expected Behaviour

Added namespace to be above all uses

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions