Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CacheWarmer parse class as from use Enum as B #885

Open
miroslavhajek opened this issue Dec 29, 2021 · 0 comments
Open

CacheWarmer parse class as from use Enum as B #885

miroslavhajek opened this issue Dec 29, 2021 · 0 comments

Comments

@miroslavhajek
Copy link

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

Steps required to reproduce the problem

  1. Create custom class extends some Enum class
  2. ConsistenceEnum is defined with alias - important line is \Enum as ConsistenceEnum
  3. Method JMS\SerializerBundle\Cache::findClasses make as public
  4. Run test...

There is some problem in regex parts...

This has been copied from https://github.com/composer/composer/blob/bfed974ae969635e622c4844e5e69526d8459baf/src/Composer/Autoload/ClassMapGenerator.php#L120-L214

<?php

namespace Jms;

use Consistence\Enum\Enum as ConsistenceEnum;

class MyEnum extends ConsistenceEnum
{

}

Expected Result

<?php

declare(strict_types = 1);

namespace Jms;

use JMS\SerializerBundle\Cache\CacheWarmer;
use PHPUnit\Framework\TestCase;

class CacheWarmerTest extends TestCase
{

    public function testFindClasses(): void
    {
        $classes = CacheWarmer::findClasses(__DIR__ . '/MyEnum.php');

        self::assertSame(['Jms\MyEnum'], $classes);
    }

}

Actual Result

<?php

declare(strict_types = 1);

namespace Jms;

use JMS\SerializerBundle\Cache\CacheWarmer;
use PHPUnit\Framework\TestCase;

class CacheWarmerTest extends TestCase
{

    public function testFindClasses(): void
    {
        $classes = CacheWarmer::findClasses(__DIR__ . '/MyEnum.php');

        self::assertSame(['Jms\as', 'Jms\MyEnum'], $classes);
    }

}
@miroslavhajek miroslavhajek changed the title CacheWarmer parse class from use Enum as B CacheWarmer parse class as from use Enum as B Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant