Skip to content

Commit

Permalink
fixup! remove annotation stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Apr 1, 2021
1 parent ab0462a commit a830ec2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function getValuesWithExplicitSilentAndWithoutQuotes(): array
foreach ($this->values as $key => $value) {
$valueWithoutQuotes = $this->getValueWithoutQuotes($key);

if (is_int($key)) {
if (is_int($key) && $this->silentKey !== null) {
$explicitKeysValues[$this->silentKey] = $valueWithoutQuotes;
} else {
$explicitKeysValues[$key] = $valueWithoutQuotes;
Expand Down Expand Up @@ -158,7 +158,7 @@ public function getSilentValue()
public function changeSilentValue($value): void
{
// is quoted?
$isQuoted = (bool) Strings::match($this->items[0], self::CONSTNAT_REGEX);
$isQuoted = (bool) Strings::match($this->items[0], self::UNQUOTED_VALUE_REGEX);
if ($isQuoted) {
$value = '"' . $value . '"';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
final class SilentKeyMap
{
/**
* @var array<class-string, string>
* @var array<string, string>
*/
public const CLASS_NAMES_TO_SILENT_KEYS = [
'Symfony\Component\Routing\Annotation\Route' => 'path',
Expand Down
2 changes: 1 addition & 1 deletion packages/BetterPhpDocParser/ValueObject/NodeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class NodeTypes
];

/**
* @var array<class-string>
* @var string[]
*/
public const TYPE_AWARE_DOCTRINE_ANNOTATION_CLASSES = [
'JMS\Serializer\Annotation\Type',
Expand Down
38 changes: 0 additions & 38 deletions rules/CodingStyle/Node/NameImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\UseUse;
use PHPStan\Reflection\ReflectionProvider;
Expand Down Expand Up @@ -125,10 +124,6 @@ private function shouldSkipName(Name $name): bool
return true;
}

// if ($this->isNonExistingClassLikeAndFunctionFullyQualifiedName($name)) {
// return true;
// }

// Importing root namespace classes (like \DateTime) is optional
$importShortClasses = $this->parameterProvider->provideParameter(Option::IMPORT_SHORT_CLASSES);
if (! $importShortClasses) {
Expand Down Expand Up @@ -213,39 +208,6 @@ private function isFunctionOrConstantImportWithSingleName(Name $name): bool
return false;
}

// private function isNonExistingClassLikeAndFunctionFullyQualifiedName(Name $name): bool
// {
// if (! $name instanceof FullyQualified) {
// return false;
// }
//
// // can be also in to be renamed classes
// $classOrFunctionName = $name->toString();
//
// $oldToNewClasses = $this->renamedClassesCollector->getOldToNewClasses();
// if (in_array($classOrFunctionName, $oldToNewClasses, true)) {
// return false;
// }
//
// $parent = $name->getAttribute(AttributeKey::PARENT_NODE);
// if ($parent instanceof FuncCall) {
// return false;
// }
//
// return false;
// // skip-non existing class-likes and functions
// dump($classOrFunctionName);
// dump($this->reflectionProvider->hasClass($classOrFunctionName));
// die;
//
// if ($this->reflectionProvider->hasClass($classOrFunctionName)) {
// return false;
// }
//
// $parent = $name->getAttribute(AttributeKey::PARENT_NODE);
// return ! $parent instanceof FuncCall;
// }

private function addUseImport(Name $name, FullyQualifiedObjectType $fullyQualifiedObjectType): void
{
if ($this->useNodesToAddCollector->hasImport($name, $fullyQualifiedObjectType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
final class AnnotatedPropertyInjectToConstructorInjectionRector extends AbstractRector
{
/**
* @var array<class-string>
* @var string[]
*/
private const INJECT_ANNOTATION_CLASSES = ['JMS\DiExtraBundle\Annotation\Inject', 'DI\Annotation\Inject'];

Expand Down

0 comments on commit a830ec2

Please sign in to comment.