Skip to content

Block 552 - 573 - possible problem with similar names #1

Description

@PhocaCz

Hi,

it seems like in block (lines 552 - 573) there is not correct check for the line.

On line 552 we ask the position to be sure that the use is included but if we ask for:

use Joomla\CMS\Toolbar\Toolbar

and there is even:

use Joomla\CMS\Toolbar\ToolbarHelper in code, we get positive result.

This means:

When the $line is "use Joomla\CMS\Toolbar\ToolbarHelper", we store to $usedNamespaces "use Joomla\CMS\Toolbar\Toolbar" and when the $line is "use Joomla\CMS\Toolbar\Toolbar", it is then never stored to $fileContent because it is in $usedNamespaces variable which produces $nameSpaceExists = false and in this condition:

if ($nameSpaceExists === true)
			{
				$fileContent[] = $line;
			}

we prevent it from writing to file.

So even it exists in $usedNamespaces, it is never written to file.

Jan

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