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

[PHP 8.0 ] No space annotatation and attributes #235

Merged
merged 2 commits into from
Jun 16, 2021
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
4 changes: 3 additions & 1 deletion packages/NodeCollector/NodeCollector/NodeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,9 @@ private function collectArray(Array_ $array): void
return;
}

$this->arrayCallablesByTypeAndMethod[$arrayCallable->getClass()][strtolower($arrayCallable->getMethod())][] = $arrayCallable;
$this->arrayCallablesByTypeAndMethod[$arrayCallable->getClass()][strtolower(
$arrayCallable->getMethod()
)][] = $arrayCallable;
}

private function addMethod(ClassMethod $classMethod): void
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture;

final class AnnotationConvertedAndKeepDocblock
{
/**
* @inject
* @AlternativeApproach
* @var SomeType
*/
public $someDependency;
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture;

final class AnnotationConvertedAndKeepDocblock
{
/**
* @AlternativeApproach
* @var SomeType
*/
#[\Nette\DI\Attributes\Inject]
public $someDependency;
}

?>
2 changes: 1 addition & 1 deletion rules/Php80/NodeResolver/SwitchExprsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class SwitchExprsResolver
*/
public function resolve(Switch_ $switch): array
{
$condAndExpr = [];
$condAndExpr = [];
$collectionEmptyCasesCond = [];

foreach ($switch->cases as $key => $case) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,23 @@ public function process(ContainerBuilder $containerBuilder): void
continue;
}

if (!class_exists($class)) {
if (! class_exists($class)) {
throw new ShouldNotHappenException(
sprintf('Rector rule "%s" not found, please verify that the class exists and is autoloadable.', $class)
sprintf(
'Rector rule "%s" not found, please verify that the class exists and is autoloadable.',
$class
)
);
}

if (! is_a($class, RectorInterface::class, true)) {
throw new ShouldNotHappenException(
sprintf('Rector rule "%s" should extend "%s" or implement "%s".', $class, AbstractRector::class, RectorInterface::class)
sprintf(
'Rector rule "%s" should extend "%s" or implement "%s".',
$class,
AbstractRector::class,
RectorInterface::class
)
);
}
}
Expand Down