cleanup
This commit is contained in:
parent
134714ff55
commit
246c80e6df
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
namespace PHPSTORM_META {
|
||||
override(\StubTests\TestData\Providers\EntitiesFilter::getFiltered(0), type(0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace StubTests\Model;
|
|||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Identifier;
|
||||
|
@ -110,6 +111,7 @@ abstract class BasePHPElement
|
|||
return null;
|
||||
}
|
||||
|
||||
#[Pure]
|
||||
public function hasMutedProblem(int $stubProblemType): bool
|
||||
{
|
||||
return in_array($stubProblemType, $this->mutedProblems, true);
|
||||
|
|
|
@ -84,17 +84,17 @@ class PHPClass extends BasePHPClass
|
|||
if ($node->getDocComment() !== null) {
|
||||
$docBlock = DocBlockFactory::createInstance()->create($node->getDocComment()->getText());
|
||||
/** @var PropertyRead[] $properties */
|
||||
$properties = array_merge($docBlock->getTagsByName("property-read"),
|
||||
$docBlock->getTagsByName("property"));
|
||||
$properties = array_merge($docBlock->getTagsByName('property-read'),
|
||||
$docBlock->getTagsByName('property'));
|
||||
foreach ($properties as $property) {
|
||||
$propertyName = $property->getVariableName();
|
||||
assert($propertyName !== "", "@property name is empty in class $this->name");
|
||||
assert($propertyName !== '', "@property name is empty in class $this->name");
|
||||
$newProperty = new PHPProperty($this->name);
|
||||
$newProperty->is_static = false;
|
||||
$newProperty->access = "public";
|
||||
$newProperty->access = 'public';
|
||||
$newProperty->name = $propertyName;
|
||||
$newProperty->parentName = $this->name;
|
||||
$newProperty->type = "" . $property->getType();
|
||||
$newProperty->type = '' . $property->getType();
|
||||
assert(!array_key_exists($propertyName, $this->properties),
|
||||
"Property '$propertyName' is already declared in class '$this->name'");
|
||||
$this->properties[$propertyName] = $newProperty;
|
||||
|
|
|
@ -67,7 +67,7 @@ trait PHPDocElement
|
|||
$this->removedTags = $phpDoc->getTagsByName('removed');
|
||||
$this->hasInternalMetaTag = $phpDoc->hasTag('meta');
|
||||
$this->hasInheritDocTag = $phpDoc->hasTag('inheritdoc') || $phpDoc->hasTag('inheritDoc') ||
|
||||
stripos($phpDoc->getSummary(), "inheritdoc") > 0;
|
||||
stripos($phpDoc->getSummary(), 'inheritdoc') > 0;
|
||||
} catch (Exception $e) {
|
||||
$this->parseError = $e;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ use phpDocumentor\Reflection\Type;
|
|||
use PhpParser\Comment\Doc;
|
||||
use PhpParser\Node\FunctionLike;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\NodeAbstract;
|
||||
use ReflectionFunction;
|
||||
use stdClass;
|
||||
use StubTests\Parsers\DocFactoryProvider;
|
||||
|
|
|
@ -32,7 +32,7 @@ class PHPProperty extends BasePHPElement
|
|||
}
|
||||
$this->access = $access;
|
||||
$this->is_static = $reflectionObject->isStatic();
|
||||
$this->type = "";
|
||||
$this->type = '';
|
||||
if ($reflectionObject->hasType()) {
|
||||
$reflectionNamedType = $reflectionObject->getType();
|
||||
if (isset($reflectionNamedType)){
|
||||
|
@ -60,7 +60,7 @@ class PHPProperty extends BasePHPElement
|
|||
$this->access = $access;
|
||||
|
||||
|
||||
$this->type = $node->type->name ?? "";
|
||||
$this->type = $node->type->name ?? '';
|
||||
|
||||
$parentNode = $node->getAttribute('parent');
|
||||
if ($parentNode !== null){
|
||||
|
|
|
@ -3,7 +3,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace StubTests\Model;
|
||||
|
||||
use \RuntimeException;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use RuntimeException;
|
||||
use function array_key_exists;
|
||||
|
||||
class StubsContainer
|
||||
|
@ -62,6 +63,7 @@ class StubsContainer
|
|||
}
|
||||
}
|
||||
|
||||
#[Pure]
|
||||
public function getClass(string $name): ?PHPClass
|
||||
{
|
||||
if (array_key_exists($name, $this->classes) && isset($this->classes[$name])) {
|
||||
|
@ -93,7 +95,7 @@ class StubsContainer
|
|||
*/
|
||||
public function addClass(PHPClass $class): void
|
||||
{
|
||||
if (isset($class->name)){
|
||||
if (isset($class->name)) {
|
||||
if (array_key_exists($class->name, $this->classes)) {
|
||||
throw new RuntimeException($class->name . ' is already defined in stubs');
|
||||
}
|
||||
|
@ -101,6 +103,7 @@ class StubsContainer
|
|||
}
|
||||
}
|
||||
|
||||
#[Pure]
|
||||
public function getInterface(string $name): ?PHPInterface
|
||||
{
|
||||
if (array_key_exists($name, $this->interfaces) && isset($this->interfaces[$name])) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
namespace StubTests\Parsers;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use PhpParser\Node\Expr;
|
||||
|
||||
class ExpectedFunctionArgumentsInfo
|
||||
|
@ -56,6 +57,7 @@ class ExpectedFunctionArgumentsInfo
|
|||
return $this->index;
|
||||
}
|
||||
|
||||
#[Pure]
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->functionReference === null) {
|
||||
|
|
|
@ -3,10 +3,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace StubTests\Parsers\Visitors;
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use StubTests\Model\StubsContainer;
|
||||
|
||||
class CoreStubASTVisitor extends ASTVisitor
|
||||
{
|
||||
#[Pure]
|
||||
public function __construct(StubsContainer $stubs)
|
||||
{
|
||||
parent::__construct($stubs);
|
||||
|
|
Loading…
Reference in New Issue