Fixes for notes in PR #468
This commit is contained in:
parent
548ecc8d3a
commit
2d60e980b4
|
@ -14,6 +14,7 @@
|
|||
"inspection"
|
||||
],
|
||||
"require-dev": {
|
||||
"php": "^7.1",
|
||||
"nikic/php-parser": "v4.0.1",
|
||||
"phpdocumentor/reflection-docblock": "^4.3",
|
||||
"phpunit/phpunit": "7.1.4"
|
||||
|
|
|
@ -10,7 +10,7 @@ abstract class BasePHPElement
|
|||
{
|
||||
public $name;
|
||||
public $parseError;
|
||||
protected $relatedStubProblems = [];
|
||||
protected $mutedProblems = [];
|
||||
|
||||
/**
|
||||
* @param mixed $object
|
||||
|
@ -26,7 +26,7 @@ abstract class BasePHPElement
|
|||
*/
|
||||
abstract public function readObjectFromStubNode($node);
|
||||
|
||||
abstract public function readStubProblems($jsonData);
|
||||
abstract public function readMutedProblems($jsonData);
|
||||
|
||||
protected function getConstantFQN(NodeAbstract $node, string $nodeName): string
|
||||
{
|
||||
|
@ -52,8 +52,8 @@ abstract class BasePHPElement
|
|||
return rtrim($fqn, "\\");
|
||||
}
|
||||
|
||||
public function relatedStubHasProblem($stubProblemType): bool
|
||||
public function hasMutedProblem($stubProblemType): bool
|
||||
{
|
||||
return in_array($stubProblemType, $this->relatedStubProblems, true);
|
||||
return in_array($stubProblemType, $this->mutedProblems, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class PHPClass extends BasePHPClass
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function readStubProblems($jsonData): void
|
||||
public function readMutedProblems($jsonData): void
|
||||
{
|
||||
/**@var stdClass $class */
|
||||
foreach ($jsonData as $class) {
|
||||
|
@ -89,28 +89,28 @@ class PHPClass extends BasePHPClass
|
|||
foreach ($class->problems as $problem) {
|
||||
switch ($problem) {
|
||||
case 'wrong parent':
|
||||
$this->relatedStubProblems[] = StubProblemType::WRONG_PARENT;
|
||||
$this->mutedProblems[] = StubProblemType::WRONG_PARENT;
|
||||
break;
|
||||
case 'wrong interface':
|
||||
$this->relatedStubProblems[] = StubProblemType::WRONG_INTERFACE;
|
||||
$this->mutedProblems[] = StubProblemType::WRONG_INTERFACE;
|
||||
break;
|
||||
case 'missing class':
|
||||
$this->relatedStubProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
$this->mutedProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
break;
|
||||
default:
|
||||
$this->relatedStubProblems[] = -1;
|
||||
$this->mutedProblems[] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($class->methods)) {
|
||||
foreach ($this->methods as $method) {
|
||||
$method->readStubProblems($class->methods);
|
||||
$method->readMutedProblems($class->methods);
|
||||
}
|
||||
}
|
||||
if (!empty($class->constants)) {
|
||||
foreach ($this->constants as $constant) {
|
||||
$constant->readStubProblems($class->constants);
|
||||
$constant->readMutedProblems($class->constants);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -55,7 +55,7 @@ class PHPConst extends BasePHPElement
|
|||
return null;
|
||||
}
|
||||
|
||||
public function readStubProblems($jsonData): void
|
||||
public function readMutedProblems($jsonData): void
|
||||
{
|
||||
/**@var stdClass $constant */
|
||||
foreach ($jsonData as $constant) {
|
||||
|
@ -64,13 +64,13 @@ class PHPConst extends BasePHPElement
|
|||
foreach ($constant->problems as $problem) {
|
||||
switch ($problem) {
|
||||
case 'wrong value':
|
||||
$this->relatedStubProblems[] = StubProblemType::WRONG_CONSTANT_VALUE;
|
||||
$this->mutedProblems[] = StubProblemType::WRONG_CONSTANT_VALUE;
|
||||
break;
|
||||
case 'missing constant':
|
||||
$this->relatedStubProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
$this->mutedProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
break;
|
||||
default:
|
||||
$this->relatedStubProblems[] = -1;
|
||||
$this->mutedProblems[] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class PHPFunction extends BasePHPElement
|
|||
}
|
||||
}
|
||||
|
||||
public function readStubProblems($jsonData): void
|
||||
public function readMutedProblems($jsonData): void
|
||||
{
|
||||
/**@var stdClass $function */
|
||||
foreach ($jsonData as $function) {
|
||||
|
@ -110,16 +110,16 @@ class PHPFunction extends BasePHPElement
|
|||
foreach ($function->problems as $problem) {
|
||||
switch ($problem) {
|
||||
case 'parameter mismatch':
|
||||
$this->relatedStubProblems[] = StubProblemType::FUNCTION_PARAMETER_MISMATCH;
|
||||
$this->mutedProblems[] = StubProblemType::FUNCTION_PARAMETER_MISMATCH;
|
||||
break;
|
||||
case 'missing function':
|
||||
$this->relatedStubProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
$this->mutedProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
break;
|
||||
case 'deprecated function':
|
||||
$this->relatedStubProblems[] = StubProblemType::FUNCTION_IS_DEPRECATED;
|
||||
$this->mutedProblems[] = StubProblemType::FUNCTION_IS_DEPRECATED;
|
||||
break;
|
||||
default:
|
||||
$this->relatedStubProblems[] = -1;
|
||||
$this->mutedProblems[] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class PHPInterface extends BasePHPClass
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function readStubProblems($jsonData): void
|
||||
public function readMutedProblems($jsonData): void
|
||||
{
|
||||
/**@var stdClass $interface */
|
||||
foreach ($jsonData as $interface) {
|
||||
|
@ -70,25 +70,25 @@ class PHPInterface extends BasePHPClass
|
|||
foreach ($interface->problems as $problem) {
|
||||
switch ($problem) {
|
||||
case 'wrong parent':
|
||||
$this->relatedStubProblems[] = StubProblemType::WRONG_PARENT;
|
||||
$this->mutedProblems[] = StubProblemType::WRONG_PARENT;
|
||||
break;
|
||||
case 'missing interface':
|
||||
$this->relatedStubProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
$this->mutedProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
break;
|
||||
default:
|
||||
$this->relatedStubProblems[] = -1;
|
||||
$this->mutedProblems[] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($interface->methods)) {
|
||||
foreach ($this->methods as $method) {
|
||||
$method->readStubProblems($interface->methods);
|
||||
$method->readMutedProblems($interface->methods);
|
||||
}
|
||||
}
|
||||
if (!empty($interface->constants)) {
|
||||
foreach ($this->constants as $constant) {
|
||||
$constant->readStubProblems($interface->constants);
|
||||
$constant->readMutedProblems($interface->constants);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -71,7 +71,7 @@ class PHPMethod extends PHPFunction
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function readStubProblems($jsonData): void
|
||||
public function readMutedProblems($jsonData): void
|
||||
{
|
||||
/**@var stdClass $method */
|
||||
foreach ($jsonData as $method) {
|
||||
|
@ -80,16 +80,16 @@ class PHPMethod extends PHPFunction
|
|||
foreach ($method->problems as $problem) {
|
||||
switch ($problem) {
|
||||
case 'parameter mismatch':
|
||||
$this->relatedStubProblems[] = StubProblemType::FUNCTION_PARAMETER_MISMATCH;
|
||||
$this->mutedProblems[] = StubProblemType::FUNCTION_PARAMETER_MISMATCH;
|
||||
break;
|
||||
case 'missing method':
|
||||
$this->relatedStubProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
$this->mutedProblems[] = StubProblemType::STUB_IS_MISSED;
|
||||
break;
|
||||
case 'deprecated method':
|
||||
$this->relatedStubProblems[] = StubProblemType::FUNCTION_IS_DEPRECATED;
|
||||
$this->mutedProblems[] = StubProblemType::FUNCTION_IS_DEPRECATED;
|
||||
break;
|
||||
default:
|
||||
$this->relatedStubProblems[] = -1;
|
||||
$this->mutedProblems[] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class PHPParameter extends BasePHPElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function readStubProblems($jsonData): void
|
||||
public function readMutedProblems($jsonData): void
|
||||
{
|
||||
/**@var stdClass $parameter */
|
||||
foreach ($jsonData as $parameter) {
|
||||
|
@ -58,16 +58,16 @@ class PHPParameter extends BasePHPElement
|
|||
foreach ($parameter->problems as $problem) {
|
||||
switch ($problem) {
|
||||
case 'parameter type mismatch':
|
||||
$this->relatedStubProblems[] = StubProblemType::PARAMETER_TYPE_MISMATCH;
|
||||
$this->mutedProblems[] = StubProblemType::PARAMETER_TYPE_MISMATCH;
|
||||
break;
|
||||
case 'parameter reference':
|
||||
$this->relatedStubProblems[] = StubProblemType::PARAMETER_REFERENCE;
|
||||
$this->mutedProblems[] = StubProblemType::PARAMETER_REFERENCE;
|
||||
break;
|
||||
case 'parameter vararg':
|
||||
$this->relatedStubProblems[] = StubProblemType::PARAMETER_VARARG;
|
||||
$this->mutedProblems[] = StubProblemType::PARAMETER_VARARG;
|
||||
break;
|
||||
default:
|
||||
$this->relatedStubProblems[] = -1;
|
||||
$this->mutedProblems[] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,14 +24,14 @@ class PHPReflectionParser
|
|||
$const_groups = Utils::flattenArray($const_groups, true);
|
||||
foreach ($const_groups as $name => $value) {
|
||||
$constant = (new PHPDefineConstant())->readObjectFromReflection([$name, $value]);
|
||||
$constant->readStubProblems($jsonData->constants);
|
||||
$constant->readMutedProblems($jsonData->constants);
|
||||
$stubs->addConstant($constant);
|
||||
}
|
||||
|
||||
/**@var ReflectionFunction $function */
|
||||
foreach (get_defined_functions()['internal'] as $function) {
|
||||
$phpFunction = (new PHPFunction())->readObjectFromReflection($function);
|
||||
$phpFunction->readStubProblems($jsonData->functions);
|
||||
$phpFunction->readMutedProblems($jsonData->functions);
|
||||
$stubs->addFunction($phpFunction);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class PHPReflectionParser
|
|||
$reflectionClass = new ReflectionClass($clazz);
|
||||
if ($reflectionClass->isInternal()) {
|
||||
$class = (new PHPClass())->readObjectFromReflection($clazz);
|
||||
$class->readStubProblems($jsonData->classes);
|
||||
$class->readMutedProblems($jsonData->classes);
|
||||
$stubs->addClass($class);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class PHPReflectionParser
|
|||
$reflectionInterface = new ReflectionClass($interface);
|
||||
if ($reflectionInterface->isInternal()) {
|
||||
$phpInterface = (new PHPInterface())->readObjectFromReflection($interface);
|
||||
$phpInterface->readStubProblems($jsonData->interfaces);
|
||||
$phpInterface->readMutedProblems($jsonData->interfaces);
|
||||
$stubs->addInterface($phpInterface);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,11 +44,11 @@ class StubParser
|
|||
}
|
||||
|
||||
foreach ($stubs->getInterfaces() as $interface) {
|
||||
$stubs->getInterface($interface->name)->parentInterfaces = $visitor->combineParentInterfaces($interface);
|
||||
$interface->parentInterfaces = $visitor->combineParentInterfaces($interface);
|
||||
}
|
||||
|
||||
foreach ($stubs->getClasses() as $class) {
|
||||
$stubs->getClass($class->name)->interfaces =
|
||||
$class->interfaces =
|
||||
Utils::flattenArray($visitor->combineImplementedInterfaces($class), false);
|
||||
}
|
||||
return $stubs;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace StubTests;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Link;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Reference\Url;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\See;
|
||||
|
@ -11,6 +10,7 @@ use SebastianBergmann\RecursionContext\InvalidArgumentException;
|
|||
use StubTests\Model\BasePHPClass;
|
||||
use StubTests\Model\PHPClass;
|
||||
use StubTests\Model\PHPConst;
|
||||
use StubTests\Model\PHPDocElement;
|
||||
use StubTests\Model\PHPFunction;
|
||||
use StubTests\Model\PHPInterface;
|
||||
use StubTests\Model\PHPMethod;
|
||||
|
@ -29,7 +29,7 @@ class TestStubs extends TestCase
|
|||
$constantName = $constant->name;
|
||||
$constantValue = $constant->value;
|
||||
$stubConstants = PhpStormStubsSingleton::getPhpStormStubs()->getConstants();
|
||||
if ($constant->relatedStubHasProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
if ($constant->hasMutedProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
static::markTestSkipped('constant is excluded');
|
||||
}
|
||||
static::assertArrayHasKey(
|
||||
|
@ -48,9 +48,8 @@ class TestStubs extends TestCase
|
|||
{
|
||||
$constantName = $constant->name;
|
||||
$constantValue = $constant->value;
|
||||
/**@var PHPConst[] $stubConstants */
|
||||
$stubConstants = PhpStormStubsSingleton::getPhpStormStubs()->getConstants();
|
||||
if ($constant->relatedStubHasProblem(StubProblemType::WRONG_CONSTANT_VALUE)) {
|
||||
if ($constant->hasMutedProblem(StubProblemType::WRONG_CONSTANT_VALUE)) {
|
||||
static::markTestSkipped('constant is excluded');
|
||||
}
|
||||
|
||||
|
@ -72,19 +71,18 @@ class TestStubs extends TestCase
|
|||
$functionName = $function->name;
|
||||
$stubFunctions = PhpStormStubsSingleton::getPhpStormStubs()->getFunctions();
|
||||
$params = self::getParameterRepresentation($function);
|
||||
if ($function->relatedStubHasProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
if ($function->hasMutedProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
static::markTestSkipped('function is excluded');
|
||||
}
|
||||
static::assertArrayHasKey($functionName, $stubFunctions, "Missing function: function $functionName($params){}");
|
||||
/**@var PHPFunction $phpstormFunction */
|
||||
$phpstormFunction = $stubFunctions[$functionName];
|
||||
if (!$function->relatedStubHasProblem(StubProblemType::FUNCTION_IS_DEPRECATED)) {
|
||||
if (!$function->hasMutedProblem(StubProblemType::FUNCTION_IS_DEPRECATED)) {
|
||||
static::assertFalse(
|
||||
$function->is_deprecated && $phpstormFunction->is_deprecated !== true,
|
||||
"Function $functionName is not deprecated in stubs"
|
||||
);
|
||||
}
|
||||
if (!$function->relatedStubHasProblem(StubProblemType::FUNCTION_PARAMETER_MISMATCH)) {
|
||||
if (!$function->hasMutedProblem(StubProblemType::FUNCTION_PARAMETER_MISMATCH)) {
|
||||
static::assertSameSize(
|
||||
$function->parameters,
|
||||
$phpstormFunction->parameters,
|
||||
|
@ -103,13 +101,12 @@ class TestStubs extends TestCase
|
|||
{
|
||||
$className = $class->name;
|
||||
$stubClasses = PhpStormStubsSingleton::getPhpStormStubs()->getClasses();
|
||||
if ($class->relatedStubHasProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
if ($class->hasMutedProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
static::markTestSkipped('class is skipped');
|
||||
}
|
||||
static::assertArrayHasKey($className, $stubClasses, "Missing class $className: class $className {}");
|
||||
/**@var PHPClass $stubClass */
|
||||
$stubClass = $stubClasses[$className];
|
||||
if (!$class->relatedStubHasProblem(StubProblemType::WRONG_PARENT)) {
|
||||
if (!$class->hasMutedProblem(StubProblemType::WRONG_PARENT)) {
|
||||
static::assertEquals(
|
||||
$class->parentClass,
|
||||
$stubClass->parentClass,
|
||||
|
@ -117,7 +114,7 @@ class TestStubs extends TestCase
|
|||
);
|
||||
}
|
||||
foreach ($class->constants as $constant) {
|
||||
if (!$constant->relatedStubHasProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
if (!$constant->hasMutedProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
static::assertArrayHasKey(
|
||||
$constant->name,
|
||||
$stubClass->constants,
|
||||
|
@ -128,35 +125,35 @@ class TestStubs extends TestCase
|
|||
foreach ($class->methods as $method) {
|
||||
$params = self::getParameterRepresentation($method);
|
||||
$methodName = $method->name;
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
static::assertArrayHasKey(
|
||||
$methodName,
|
||||
$stubClass->methods,
|
||||
"Missing method $className::$methodName($params){}"
|
||||
);
|
||||
$stubMethod = $stubClass->methods[$methodName];
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::FUNCTION_IS_FINAL)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::FUNCTION_IS_FINAL)) {
|
||||
static::assertEquals(
|
||||
$method->is_final,
|
||||
$stubMethod->is_final,
|
||||
"Method $className::$methodName final modifier is incorrect"
|
||||
);
|
||||
}
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::FUNCTION_IS_STATIC)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::FUNCTION_IS_STATIC)) {
|
||||
static::assertEquals(
|
||||
$method->is_static,
|
||||
$stubMethod->is_static,
|
||||
"Method $className::$methodName static modifier is incorrect"
|
||||
);
|
||||
}
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::FUNCTION_ACCESS)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::FUNCTION_ACCESS)) {
|
||||
static::assertEquals(
|
||||
$method->access,
|
||||
$stubMethod->access,
|
||||
"Method $className::$methodName access modifier is incorrect"
|
||||
);
|
||||
}
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::FUNCTION_PARAMETER_MISMATCH)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::FUNCTION_PARAMETER_MISMATCH)) {
|
||||
static::assertSameSize(
|
||||
$method->parameters,
|
||||
$stubMethod->parameters,
|
||||
|
@ -167,7 +164,7 @@ class TestStubs extends TestCase
|
|||
}
|
||||
}
|
||||
foreach ($class->interfaces as $interface) {
|
||||
if (!$class->relatedStubHasProblem(StubProblemType::WRONG_INTERFACE)) {
|
||||
if (!$class->hasMutedProblem(StubProblemType::WRONG_INTERFACE)) {
|
||||
static::assertContains(
|
||||
$interface,
|
||||
$stubClass->interfaces,
|
||||
|
@ -185,9 +182,8 @@ class TestStubs extends TestCase
|
|||
public function testInterfaces(PHPInterface $interface): void
|
||||
{
|
||||
$interfaceName = $interface->name;
|
||||
/**@var PHPInterface[] $stubInterfaces */
|
||||
$stubInterfaces = PhpStormStubsSingleton::getPhpStormStubs()->getInterfaces();
|
||||
if ($interface->relatedStubHasProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
if ($interface->hasMutedProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
static::markTestSkipped('interface is skipped');
|
||||
}
|
||||
static::assertArrayHasKey(
|
||||
|
@ -196,11 +192,11 @@ class TestStubs extends TestCase
|
|||
"Missing interface $interfaceName: interface $interfaceName {}"
|
||||
);
|
||||
$stubInterface = $stubInterfaces[$interfaceName];
|
||||
if (!$interface->relatedStubHasProblem(StubProblemType::WRONG_PARENT)) {
|
||||
if (!$interface->hasMutedProblem(StubProblemType::WRONG_PARENT)) {
|
||||
static::assertEquals($stubInterface->parentInterfaces, $interface->parentInterfaces);
|
||||
}
|
||||
foreach ($interface->constants as $constant) {
|
||||
if (!$constant->relatedStubHasProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
if (!$constant->hasMutedProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
static::assertArrayHasKey(
|
||||
$constant->name,
|
||||
$stubInterface->constants,
|
||||
|
@ -211,35 +207,35 @@ class TestStubs extends TestCase
|
|||
foreach ($interface->methods as $method) {
|
||||
$params = self::getParameterRepresentation($method);
|
||||
$methodName = $method->name;
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::STUB_IS_MISSED)) {
|
||||
static::assertArrayHasKey(
|
||||
$methodName,
|
||||
$stubInterface->methods,
|
||||
"Missing method $interfaceName::$methodName($params){}"
|
||||
);
|
||||
$stubMethod = $stubInterface->methods[$methodName];
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::FUNCTION_IS_FINAL)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::FUNCTION_IS_FINAL)) {
|
||||
static::assertEquals(
|
||||
$method->is_final,
|
||||
$stubMethod->is_final,
|
||||
"Method $interfaceName::$methodName final modifier is incorrect"
|
||||
);
|
||||
}
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::FUNCTION_IS_STATIC)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::FUNCTION_IS_STATIC)) {
|
||||
static::assertEquals(
|
||||
$method->is_static,
|
||||
$stubMethod->is_static,
|
||||
"Method $interfaceName::$methodName static modifier is incorrect"
|
||||
);
|
||||
}
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::FUNCTION_ACCESS)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::FUNCTION_ACCESS)) {
|
||||
static::assertEquals(
|
||||
$method->access,
|
||||
$stubMethod->access,
|
||||
"Method $interfaceName::$methodName access modifier is incorrect"
|
||||
);
|
||||
}
|
||||
if (!$method->relatedStubHasProblem(StubProblemType::FUNCTION_PARAMETER_MISMATCH)) {
|
||||
if (!$method->hasMutedProblem(StubProblemType::FUNCTION_PARAMETER_MISMATCH)) {
|
||||
static::assertSameSize(
|
||||
$method->parameters,
|
||||
$stubMethod->parameters,
|
||||
|
@ -331,9 +327,13 @@ class TestStubs extends TestCase
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPDocElement $element
|
||||
* @param string $elementName
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
private function checkLinks($element, $elementName): void
|
||||
{
|
||||
/**@var Tag $link */
|
||||
foreach ($element->links as $link) {
|
||||
if ($link instanceof Link) {
|
||||
static::assertStringStartsWith(
|
||||
|
@ -343,7 +343,6 @@ class TestStubs extends TestCase
|
|||
);
|
||||
}
|
||||
}
|
||||
/**@var Tag $see */
|
||||
foreach ($element->see as $see) {
|
||||
if ($see instanceof See && $see->getReference() instanceof Url && strncmp($see, 'http', 4) === 0) {
|
||||
static::assertStringStartsWith('https', $see, "In $elementName @see doesn't start with https");
|
||||
|
|
Loading…
Reference in New Issue