Apply "phpstan/phpstan-deprecation-rules" rules

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
Henrique Moody 2019-02-04 02:14:03 +01:00
parent d00ed89f3c
commit 95b499b627
No known key found for this signature in database
GPG key ID: 221E9281655813A6
7 changed files with 4 additions and 72 deletions

View file

@ -25,6 +25,7 @@
"malukenho/docheader": "^0.1.4", "malukenho/docheader": "^0.1.4",
"mikey179/vfsstream": "^1.6", "mikey179/vfsstream": "^1.6",
"phpstan/phpstan": "^0.11", "phpstan/phpstan": "^0.11",
"phpstan/phpstan-deprecation-rules": "^0.11.0",
"phpstan/phpstan-phpunit": "^0.11.0", "phpstan/phpstan-phpunit": "^0.11.0",
"phpunit/phpunit": "^7.3", "phpunit/phpunit": "^7.3",
"slevomat/coding-standard": "^5.0", "slevomat/coding-standard": "^5.0",

View file

@ -1,4 +1,5 @@
includes: includes:
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon - vendor/phpstan/phpstan-phpunit/rules.neon

View file

@ -15,6 +15,7 @@ namespace Respect\Validation\Rules;
use Respect\Validation\Test\TestCase; use Respect\Validation\Test\TestCase;
use Respect\Validation\Validatable; use Respect\Validation\Validatable;
use function array_intersect_key;
/** /**
* @test core * @test core
@ -78,6 +79,6 @@ final class AbstractEnvelopeTest extends TestCase
$exception = $rule->reportError($input); $exception = $rule->reportError($input);
self::assertArraySubset($parameters, $exception->getParams()); self::assertEquals($parameters, array_intersect_key($parameters, $exception->getParams()));
} }
} }

View file

@ -27,18 +27,6 @@ use Respect\Validation\Validatable;
*/ */
final class AbstractWrapperTest extends TestCase final class AbstractWrapperTest extends TestCase
{ {
/**
* @test
*/
public function shouldReturnDefinedValidatable(): void
{
$validatable = $this->createMock(Validatable::class);
$wrapper = $this->getMockForAbstractClass(AbstractWrapper::class, [$validatable]);
self::assertAttributeSame($validatable, 'validatable', $wrapper);
}
/** /**
* @test * @test
*/ */

View file

@ -27,29 +27,6 @@ use stdClass;
*/ */
final class KeySetTest extends TestCase final class KeySetTest extends TestCase
{ {
/**
* @test
*/
public function shouldAcceptKeyRule(): void
{
$key = new Key('foo', new AlwaysValid(), false);
$keySet = new KeySet($key);
self::assertAttributeSame([$key], 'keyRules', $keySet);
}
/**
* @test
*/
public function shouldAcceptAllOfWithOneKeyRule(): void
{
$key = new Key('foo', new AlwaysValid(), false);
$allOf = new AllOf($key);
$keySet = new KeySet($allOf);
self::assertAttributeSame([$key], 'keyRules', $keySet);
}
/** /**
* @test * @test
* *
@ -92,19 +69,6 @@ final class KeySetTest extends TestCase
new KeySet($alwaysValid); new KeySet($alwaysValid);
} }
/**
* @test
*/
public function shouldReturnKeys(): void
{
$key1 = new Key('foo', new AlwaysValid(), true);
$key2 = new Key('bar', new AlwaysValid(), false);
$keySet = new KeySet($key1, $key2);
self::assertAttributeSame(['foo', 'bar'], 'keys', $keySet);
}
/** /**
* @test * @test
*/ */

View file

@ -19,7 +19,6 @@ use Symfony\Component\Validator\Constraints\IsFalse;
use Symfony\Component\Validator\Constraints\IsNull; use Symfony\Component\Validator\Constraints\IsNull;
use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\Validator\TraceableValidator; use Symfony\Component\Validator\Validator\TraceableValidator;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use function class_exists; use function class_exists;
/** /**
@ -53,16 +52,6 @@ final class SfTest extends TestCase
self::assertFalse($sut->validate(true)); self::assertFalse($sut->validate(true));
} }
/**
* @test
*/
public function itShouldHaveTheValidatorByDefault(): void
{
$sut = new Sf(new IsNull());
self::assertAttributeInstanceOf(ValidatorInterface::class, 'validator', $sut);
}
/** /**
* @test * @test
*/ */

View file

@ -14,7 +14,6 @@ declare(strict_types=1);
namespace Respect\Validation\Rules; namespace Respect\Validation\Rules;
use Respect\Validation\Test\RuleTestCase; use Respect\Validation\Test\RuleTestCase;
use Respect\Validation\Validatable;
use stdClass; use stdClass;
/** /**
@ -64,17 +63,6 @@ final class VatinTest extends RuleTestCase
]; ];
} }
/**
* @test
*/
public function shouldAcceptCountryCodeOnConstructor(): void
{
$countryCode = 'PL';
$rule = new Vatin($countryCode);
self::assertAttributeInstanceOf(Validatable::class, 'validatable', $rule);
}
/** /**
* @expectedException \Respect\Validation\Exceptions\ComponentException * @expectedException \Respect\Validation\Exceptions\ComponentException
* @expectedExceptionMessage "BR" is not a supported country code * @expectedExceptionMessage "BR" is not a supported country code