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

Add failing test for GetParameterToConstructorInjectionRector #275

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace Rector\Tests\Symfony\Rector\MethodCall\GetParameterToConstructorInjectionRector\Fixture;

use Symfony\Bundle\FrameworkBundle\Controller\Controller as SymfonyController;

class Service {
}

abstract class Controller extends SymfonyController {
public function __construct(protected Service $service)
{
// do something else
}
}

class TestController extends Controller
{
public function test()
{
$foo = $this->getParameter('foo') . $this->getParameter('bar');
}
}

?>
-----
<?php

namespace Rector\Tests\Symfony\Rector\MethodCall\GetParameterToConstructorInjectionRector\Fixture;

use Symfony\Bundle\FrameworkBundle\Controller\Controller as SymfonyController;

class Service {
}

abstract class Controller extends SymfonyController {
public function __construct(protected Service $service)
{
// do something else
}
}

class TestController extends Controller
{
public function __construct(\Rector\Tests\Symfony\Rector\MethodCall\GetParameterToConstructorInjectionRector\Fixture\Service $service, private string $foo, private string $bar)
{
parent::__construct($service);
}
public function test()
{
$foo = $this->foo . $this->bar;
}
}

?>