Skip to content

Commit 573c1c4

Browse files
committed
Add type hints
1 parent 1754507 commit 573c1c4

41 files changed

Lines changed: 61 additions & 59 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

phpcs.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@
7878
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
7979
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
8080
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
81+
<rule ref="SlevomatCodingStandard.TypeHints.ClassConstantTypeHint"/>
82+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
83+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>
84+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
85+
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
8186
<rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat">
8287
<properties>
8388
<property name="withSpacesAroundOperators" value="no" />

src/AbstractRule.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ protected function shortname(): string
3939

4040
/**
4141
* Return localized error message
42-
*
43-
* @return string
4442
*/
45-
public function message()
43+
public function message(): string
4644
{
4745
// try key for application custom translation
4846
$key = 'validation.' . $this->shortname();

src/Laravel/ValidationServiceProvider.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ class ValidationServiceProvider extends ServiceProvider
1212
{
1313
/**
1414
* Bootstrap the application events.
15-
*
16-
* @return void
1715
*/
18-
public function boot()
16+
public function boot(): void
1917
{
2018
// load translation files
2119
$this->loadTranslationsFrom(
@@ -78,7 +76,7 @@ protected function errorMessage(string $rulename): string
7876
*
7977
* @return array<string>
8078
*/
81-
public function provides()
79+
public function provides(): array
8280
{
8381
return ['validator'];
8482
}

src/Rules/Iban.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ private function checksum(string $iban): int
160160

161161
/**
162162
* Returns the designated length of IBAN for given IBAN
163-
*
164-
* @return int|false
165163
*/
166164
private function designatedIbanLength(string $iban): int|false
167165
{

tests/Rules/AustrianInsuranceNumberTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
final class AustrianInsuranceNumberTest extends TestCase
1313
{
1414
#[DataProvider('dataProvider')]
15-
public function testValidation($result, $value): void
15+
public function testValidation(bool $result, string $value): void
1616
{
1717
$valid = (new AustrianInsuranceNumber())->isValid($value);
1818
$this->assertEquals($result, $valid);

tests/Rules/Base64Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
final class Base64Test extends TestCase
1313
{
1414
#[DataProvider('dataProvider')]
15-
public function testValidation($result, $value): void
15+
public function testValidation(bool $result, string $value): void
1616
{
1717
$valid = (new Base64())->isValid($value);
1818
$this->assertEquals($result, $valid);

tests/Rules/BicTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
final class BicTest extends TestCase
1313
{
1414
#[DataProvider('dataProvider')]
15-
public function testValidation($result, $value): void
15+
public function testValidation(bool $result, string $value): void
1616
{
1717
$valid = (new Bic())->isValid($value);
1818
$this->assertEquals($result, $valid);

tests/Rules/CamelcaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
final class CamelcaseTest extends TestCase
1313
{
1414
#[DataProvider('dataProvider')]
15-
public function testValidation($result, $value): void
15+
public function testValidation(bool $result, string $value): void
1616
{
1717
$valid = (new Camelcase())->isValid($value);
1818
$this->assertEquals($result, $valid);

tests/Rules/CidrTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
final class CidrTest extends TestCase
1313
{
1414
#[DataProvider('dataProvider')]
15-
public function testValidation($result, $value): void
15+
public function testValidation(bool $result, string $value): void
1616
{
1717
$valid = (new Cidr())->isValid($value);
1818
$this->assertEquals($result, $valid);

tests/Rules/CreditcardTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
final class CreditcardTest extends TestCase
1313
{
1414
#[DataProvider('dataProvider')]
15-
public function testValidation($result, $value): void
15+
public function testValidation(bool $result, string $value): void
1616
{
1717
$valid = (new Creditcard())->isValid($value);
1818
$this->assertEquals($result, $valid);

0 commit comments

Comments
 (0)