Skip to content

Content after "var" and "return" is not prefixed #210

@TomasVotruba

Description

@TomasVotruba

Bug report

Question Answer
Box version 0.6.1.0
PHP version 7.2.5
Platform with version Ubuntu

Probably some regexp issue?

Reported here: rectorphp/rector#465 (comment)

# scoper.inc.php

<?php declare(strict_types=1);

require_once __DIR__ . '/vendor/autoload.php';

use Isolated\Symfony\Component\Finder\Finder;

return [
    'finders' => [
        Finder::create()
            ->files()
            ->in(__DIR__ .'/test-me')
    ]
];

With a run:

php php-scoper.phar add-prefix --no-interaction

Turns this:

<?php

$tagHandlerMappings = [
    'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param',
    'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_',
    'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_',
];

to

<?php

namespace _PhpScoper5b0c2a3e20ef8;

$tagHandlerMappings = [
    'param' => '_PhpScoper5b0c2a3e20ef8\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Param',
    'return' => '\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Return_',
    'var' => '\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Var_'
];

Expected Prefixed

<?php

namespace _PhpScoper5b0c2a3e20ef8;

$tagHandlerMappings = [
    'param' => '_PhpScoper5b0c2a3e20ef8\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Param',
-    'return' => '\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Return_',
+    'return' => '_PhpScoper5b0c2a3e20ef8\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Return_',
-    'var' => '\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Var_'
+    'var' => '_PhpScoper5b0c2a3e20ef8\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Var_'
];

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions