Skip to content

Commit

Permalink
added phpstan typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
karser committed Apr 28, 2024
1 parent 9c3adb3 commit 0802d2d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
14 changes: 7 additions & 7 deletions Tests/Form/Recaptcha3TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public function testDefaultOptions()
$form = $this->factory->create(Recaptcha3Type::class);
$form->setData($data);

$this->assertTrue($form->isSynchronized());
$this->assertEquals($data, $form->getData());
self::assertTrue($form->isSynchronized());
self::assertEquals($data, $form->getData());

$view = $form->createView();
$this->assertSame(self::SITEKEY, $view->vars['site_key']);
$this->assertSame(self::HOST, $view->vars['host']);
$this->assertSame('homepage', $view->vars['action_name']);
$this->assertSame('', $view->vars['script_nonce_csp']);
$this->assertTrue($view->vars['enabled']);
self::assertSame(self::SITEKEY, $view->vars['site_key']);
self::assertSame(self::HOST, $view->vars['host']);
self::assertSame('homepage', $view->vars['action_name']);
self::assertSame('', $view->vars['script_nonce_csp']);
self::assertTrue($view->vars['enabled']);
}
}
2 changes: 1 addition & 1 deletion Tests/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function setConfigurationFilename($filename)
/**
* {@inheritdoc}
*/
public function registerBundles(): array
public function registerBundles(): iterable
{
return [
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
Expand Down
2 changes: 1 addition & 1 deletion Tests/Validator/Constraints/Recaptcha3ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testLastResponse()
$this->recaptcha->nextSuccess = true;

$validator = new Recaptcha3Validator($this->recaptcha, $enabled = true, $this->resolver);
self::assertNull($this->validator->getLastResponse());
self::assertNull($validator->getLastResponse());

$validator->validate('test', new Recaptcha3());
self::assertNotNull($validator->getLastResponse());
Expand Down
24 changes: 24 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
includes:
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon

parameters:
level: 5
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
inferPrivatePropertyTypeFromConstructor: true
paths:
- %currentWorkingDirectory%
ignoreErrors:
- '#Class Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder constructor invoked with 0 parameters, 1-3 required#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder::root\(\)#'
- '#Call to function method_exists\(\) with .*?TreeBuilder.*? and .*?getRootNode.*? will always evaluate to true#'
- '#Comparison operation "<" between 70006 and 50200 is always false#'
- '#Comparison operation ">=" between 7 and 6 is always true#'
- '#Else branch is unreachable because ternary operator condition is always true#'

excludePaths:
- %currentWorkingDirectory%/.github/*
- %currentWorkingDirectory%/.idea/*
- %currentWorkingDirectory%/vendor/*

0 comments on commit 0802d2d

Please sign in to comment.