From fb420b131975a84a7a97e9b620cd9aac61e016a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Tou=C5=A1ek?= Date: Fri, 27 Jul 2018 11:15:00 +0200 Subject: [PATCH] Update dev dependencies --- composer.json | 9 +++++---- phpstan.neon | 1 + src/Application/ComponentsProtectionTrait.php | 4 ++-- src/Rules/ActionsRuleHandler.php | 4 +--- tests/functional/src/Classes/ArticlePresenter.php | 3 ++- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 8a5edba..5da8a75 100644 --- a/composer.json +++ b/composer.json @@ -21,15 +21,16 @@ }, "require-dev": { "arachne/codeception": "^0.8.0", - "codeception/codeception": "^2.3.2", + "codeception/codeception": "^2.4.3", "eloquent/phony": "^3.0.0", "eloquent/phony-phpunit": "^4.0.0", - "eloquent/phpstan-phony": "^0.1.1", + "eloquent/phpstan-phony": "^0.3.0", "friendsofphp/php-cs-fixer": "^2.8.0", "kdyby/doctrine-cache": "^2.6.1", "latte/latte": "^2.4.0", - "phpstan/phpstan": "^0.9.0", - "phpstan/phpstan-nette": "^0.9.0" + "phpstan/phpstan": "^0.10.0", + "phpstan/phpstan-nette": "^0.10.0", + "phpstan/phpstan-strict-rules": "^0.10.0" }, "autoload": { "psr-4": { diff --git a/phpstan.neon b/phpstan.neon index 3fda261..a78a153 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,7 @@ includes: - vendor/phpstan/phpstan-nette/extension.neon - vendor/phpstan/phpstan-nette/rules.neon + - vendor/phpstan/phpstan-strict-rules/rules.neon - vendor/eloquent/phpstan-phony/phony.neon - vendor/arachne/codeception/extension.neon diff --git a/src/Application/ComponentsProtectionTrait.php b/src/Application/ComponentsProtectionTrait.php index 58f3cfe..3ad4732 100644 --- a/src/Application/ComponentsProtectionTrait.php +++ b/src/Application/ComponentsProtectionTrait.php @@ -28,7 +28,7 @@ trait ComponentsProtectionTrait /** * @param Reader $reader */ - final public function injectReader(Reader $reader) + final public function injectReader(Reader $reader): void { $this->reader = $reader; } @@ -41,7 +41,7 @@ public function checkRequirements($reflection): void if ( $reflection instanceof ReflectionMethod && substr($reflection->getName(), 0, 15) === 'createComponent' - && !$this->reader->getMethodAnnotation($reflection, Actions::class) + && $this->reader->getMethodAnnotation($reflection, Actions::class) === null ) { $name = lcfirst(substr($reflection->getName(), 15)); throw new MissingAnnotationException(sprintf('Missing annotation @%s for component "%s".', Actions::class, $name)); diff --git a/src/Rules/ActionsRuleHandler.php b/src/Rules/ActionsRuleHandler.php index 82ecb56..d198617 100644 --- a/src/Rules/ActionsRuleHandler.php +++ b/src/Rules/ActionsRuleHandler.php @@ -17,8 +17,6 @@ class ActionsRuleHandler implements RuleHandlerInterface { /** - * @param Actions $rule - * * @throws VerificationException */ public function checkRule(RuleInterface $rule, Request $request, ?string $component = null): void @@ -32,7 +30,7 @@ public function checkRule(RuleInterface $rule, Request $request, ?string $compon } $parameters = $request->getParameters(); - if (!in_array($parameters[Presenter::ACTION_KEY], $rule->actions)) { + if (!in_array($parameters[Presenter::ACTION_KEY], $rule->actions, true)) { throw new VerificationException($rule, 'Component is inaccessible for the given action.'); } } diff --git a/tests/functional/src/Classes/ArticlePresenter.php b/tests/functional/src/Classes/ArticlePresenter.php index 6dc67f3..a8b7675 100644 --- a/tests/functional/src/Classes/ArticlePresenter.php +++ b/tests/functional/src/Classes/ArticlePresenter.php @@ -63,8 +63,9 @@ protected function createComponentUnprotected(): void public function formatTemplateFiles(): array { + /** @var string */ $name = $this->getName(); - $presenter = substr($name, strrpos(':'.$name, ':')); + $presenter = substr($name, (int) strrpos(':'.$name, ':')); return [__DIR__."/../../templates/$presenter.$this->view.latte"]; }