Skip to content

Commit

Permalink
Fix codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrala committed Mar 16, 2024
1 parent 21fe76f commit 14e2355
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 7 additions & 9 deletions src/Rector/Deprecation/FunctionToServiceRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use DrupalRector\Rector\AbstractDrupalCoreRector;
use DrupalRector\Rector\ValueObject\FunctionToServiceConfiguration;
use PhpParser\Node;
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

Expand Down Expand Up @@ -58,14 +56,14 @@ public function refactorWithConfiguration(Node $node, VersionedConfigurationInte
assert($configuration instanceof FunctionToServiceConfiguration);
assert($node instanceof Node\Expr\FuncCall);

if ($this->getName($node->name) === $configuration->getDeprecatedFunctionName()) {
// This creates a service call like `\Drupal::service('file_system').
$service = new Node\Expr\StaticCall(new Node\Name\FullyQualified('Drupal'), 'service', [new Node\Arg(new Node\Scalar\String_($configuration->getServiceName()))]);
if ($this->getName($node->name) === $configuration->getDeprecatedFunctionName()) {
// This creates a service call like `\Drupal::service('file_system').
$service = new Node\Expr\StaticCall(new Node\Name\FullyQualified('Drupal'), 'service', [new Node\Arg(new Node\Scalar\String_($configuration->getServiceName()))]);

$method_name = new Node\Identifier($configuration->getServiceMethodName());
$method_name = new Node\Identifier($configuration->getServiceMethodName());

return new Node\Expr\MethodCall($service, $method_name, $node->args);
}
return new Node\Expr\MethodCall($service, $method_name, $node->args);
}

return null;
}
Expand Down Expand Up @@ -268,7 +266,7 @@ public function getRuleDefinition(): RuleDefinition
CODE_AFTER
,
[
new FunctionToServiceConfiguration('8.0.0' , 'format_date', 'date.formatter', 'format'),
new FunctionToServiceConfiguration('8.0.0', 'format_date', 'date.formatter', 'format'),
]
),
new ConfiguredCodeSample(
Expand Down
4 changes: 2 additions & 2 deletions src/Rector/ValueObject/FunctionToServiceConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public function getServiceMethodName(): string
return $this->serviceMethodName;
}

public function getIntroducedVersion(): string {
public function getIntroducedVersion(): string
{
return $this->introducedVersion;
}

}

0 comments on commit 14e2355

Please sign in to comment.