Skip to content

Commit

Permalink
Added phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsche committed Jan 9, 2020
1 parent 810cc78 commit 67a88e2
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 11 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ install:
script:
- vendor/bin/simple-phpunit --coverage-clover coverage.xml
- composer cs:dry
- composer phpstan

after_script:
- wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG-3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
* Fixed compatibility with Symfony 5
* Dropped compatibility with Symfony < 4.4
* Dropped support for PHP < 7.2
* Added php-cs-fixer & phpstan
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Note there are a few helpers to maintain code quality, that you can run using th

```bash
composer cs:dry # Code style check
composer phpstan # Static analysis
vendor/bin/simple-phpunit # Run tests
```

Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@
"symfony/http-kernel": "^4.4|^5.0",
"symfony/routing": "^4.4|^5.0",
"symfony/translation": "^4.4|^5.0",
"symfony/validator": "^4.4|^5.0",
"symfony/twig-bundle": "^4.4|^5.0",
"symfony/validator": "^4.4|^5.0",
"twig/twig": "^2.9|^3.0"
},
"require-dev": {
"doctrine/data-fixtures": "^1.0",
"friendsofphp/php-cs-fixer": "^2.16.1",
"fzaninotto/faker": "^1.1",
"doctrine/data-fixtures": "^1.0",
"phpstan/phpstan": "^0.12.4",
"symfony/phpunit-bridge": "^4.4|^5.0"
},
"scripts": {
"cs:dry": "php-cs-fixer fix --diff --diff-format=udiff --dry-run --no-interaction --ansi",
"cs:fix": "php-cs-fixer fix --ansi"
"cs:fix": "php-cs-fixer fix --ansi",
"phpstan": "vendor/bin/phpstan analyse --ansi"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 9 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
parameters:
autoload_directories:
- vendor/bin/.phpunit/phpunit-8.3-0/src
paths:
- src
- tests
level: 0
ignoreErrors:
- '#^Class Symfony\\Bridge\\Doctrine\\Form\\Type\\EntityType not found.$#'
4 changes: 4 additions & 0 deletions src/Datalist/Filter/Type/EntityFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public function buildForm(FormBuilderInterface $builder, DatalistFilterInterface
}
}

if (!class_exists(EntityType::class)) {
throw new \LogicException('You can not use the EntityFilterType as Doctrine bridge is not installed.');
}

$builder->add($filter->getName(), EntityType::class, $formOptions);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Form/Type/RecaptchaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class RecaptchaType extends AbstractType
*/
protected $localeResolver;

protected $scripts = [];

/**
* @param string $publicKey Recaptcha public key
* @param bool $enabled Recaptache status
Expand Down
8 changes: 0 additions & 8 deletions src/Listener/RequestListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@

namespace Leapt\CoreBundle\Listener;

use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;

if (!class_exists(RequestEvent::class)) {
class_alias(GetResponseEvent::class, RequestEvent::class);
}

/**
* Class RequestListener.
*/
class RequestListener
{
public function onKernelRequest(RequestEvent $event)
Expand Down

0 comments on commit 67a88e2

Please sign in to comment.