Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion rules/nette-kdyby/src/Naming/VariableNaming.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function resolveFromNode(Node $node): string

$paramName = $this->nodeNameResolver->getName($node);
if ($paramName !== null) {
return $paramName;
return StaticRectorStrings::underscoreToPascalCase($paramName);
}

if ($node instanceof String_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ private function createEventInstanceAssign(string $eventClassName, MethodCall $m
$shortEventClassName = $this->classNaming->getVariableName($eventClassName);

$new = new New_(new FullyQualified($eventClassName));

if ($methodCall->args) {
$new->args = $methodCall->args;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ final class ActionLogEventSubscriber implements Subscriber
];
}

public function onTomatoBuy(Tomato $tomato, int $adminId): void
public function onTomatoBuy(Tomato $anotherTomato, int $adminId): void
{
$tomato->unwrap();
$anotherTomato->unwrap();
}
}

Expand All @@ -42,8 +42,8 @@ final class ActionLogEventSubscriber implements Subscriber

public function onTomatoBuy(\Rector\NetteKdyby\Tests\Rector\ClassMethod\ReplaceMagicEventPropertySubscriberWithEventClassSubscriberRector\Source\Event\VegetableMarketTomatoBuyEvent $vegetableMarketTomatoBuyEvent): void
{
$tomato = $vegetableMarketTomatoBuyEvent->getTomato();
$tomato->unwrap();
$anotherTomato = $vegetableMarketTomatoBuyEvent->getTomato();
$anotherTomato->unwrap();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class SomeClass

public function __construct(EventManager $eventManager)
{
$this->eventManager = eventManager;
$this->eventManager = $eventManager;
}

public function run()
Expand All @@ -40,7 +40,7 @@ final class SomeClass

public function __construct(EventManager $eventManager)
{
$this->eventManager = eventManager;
$this->eventManager = $eventManager;
}

public function run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ final class DuplicatedEventParams
{
public $onUpload;

public function run(SomeUser $user)
public function run(SomeUser $user, string $some_underscore)
{
$this->onUpload($user['owner_id'], $user['name']);
$this->onUpload($user['owner_id'], $user['name'], $some_underscore);
}
}

Expand All @@ -32,9 +32,9 @@ final class DuplicatedEventParams
{
$this->eventDispatcher = $eventDispatcher;
}
public function run(SomeUser $user)
public function run(SomeUser $user, string $some_underscore)
{
$duplicatedEventParamsUploadEvent = new \Rector\NetteKdyby\Tests\Rector\MethodCall\ReplaceMagicPropertyEventWithEventClassRector\Fixture\Event\DuplicatedEventParamsUploadEvent($user['owner_id'], $user['name']);
$duplicatedEventParamsUploadEvent = new \Rector\NetteKdyby\Tests\Rector\MethodCall\ReplaceMagicPropertyEventWithEventClassRector\Fixture\Event\DuplicatedEventParamsUploadEvent($user['owner_id'], $user['name'], $some_underscore);
$this->eventDispatcher->dispatch($duplicatedEventParamsUploadEvent);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ final class DuplicatedEventParamsUploadEvent extends \Symfony\Contracts\EventDis
* @var mixed
*/
private $userName;
public function __construct($userOwnerId, $userName)
/**
* @var string
*/
private $someUnderscore;
public function __construct($userOwnerId, $userName, string $someUnderscore)
{
$this->userOwnerId = $userOwnerId;
$this->userName = $userName;
$this->someUnderscore = $someUnderscore;
}
public function getUserOwnerId()
{
Expand All @@ -25,4 +30,8 @@ public function getUserName()
{
return $this->userName;
}
public function getSomeUnderscore(): string
{
return $this->someUnderscore;
}
}