Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5 PhpStan #17

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .docker/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ RUN docker-php-ext-install \
mysqli

RUN apt-get update && apt-get -y install \
git
git \
unzip \
zip \
16 changes: 16 additions & 0 deletions .github/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,19 @@ on:
- master

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v3

- name: Composer
run: |
composer validate
composer install --no-interaction --prefer-dist

- name: PHPStan
run: |
vendor/bin/phpstan analyse -c config/phpstan.neon --memory-limit 2048M
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
phpstan:
docker-compose -f docker-compose.yml exec php vendor/bin/phpstan analyse -c config/phpstan.neon
10 changes: 9 additions & 1 deletion app/Presenters/Error4xxPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
namespace App\Presenters;

use Nette;
use Nette\Application\BadRequestException;

/**
* @property-read Nette\Bridges\ApplicationLatte\Template $template
* @property-read Nette\Application\Request $request
*/
final class Error4xxPresenter extends Nette\Application\UI\Presenter
{
/**
* @throws BadRequestException
*/
public function startup(): void
{
parent::startup();
if (!$this->getRequest()->isMethod(Nette\Application\Request::FORWARD)) {
if (!$this->request->isMethod(Nette\Application\Request::FORWARD)) {
$this->error();
}
}
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
},
"require-dev": {
"nette/tester": "^2.4",
"symfony/thanks": "^1"
"symfony/thanks": "^1",
"phpstan/phpstan": "^1.10"
},
"autoload": {
"psr-4": {
Expand Down
64 changes: 63 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions config/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 8

paths:
- ../app