Skip to content

Commit

Permalink
Increase upper limit requirement on phpstan (#21)
Browse files Browse the repository at this point in the history
increase upper limit requirement on phpstan
  • Loading branch information
juliangut authored and mremi committed Jan 2, 2020
1 parent d43b2e0 commit 3a038b0
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ php:
- '7.1'
- '7.2'
- '7.3'
- '7.4'

env:
global:
Expand All @@ -20,8 +21,6 @@ cache:
directories:
- $HOME/.composer/cache/files

before_install: composer self-update

before_install:
- composer self-update
- if [ -x .travis/before_install_${TARGET}.sh ]; then .travis/before_install_${TARGET}.sh; fi;
Expand All @@ -34,4 +33,3 @@ script:

after_success:
- if [ -x .travis/after_success_${TARGET}.sh ]; then .travis/after_success_${TARGET}.sh; fi;

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ master

* todo...

v0.3.0
------

* Updated to PHPStan 0.12
* Added testing on PHP 7.4

v0.2.0
------

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ parameters:
# enable detection of echo
-
type: Stmt_Echo
functions: null
# enable detection of eval
-
type: Expr_Eval
functions: null
# enable detection of die/exit
-
type: Expr_Exit
functions: null
# enable detection of a set of functions
-
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
],
"require": {
"php": "^7.1",
"phpstan/phpstan": "^0.11"
"phpstan/phpstan": "^0.12"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.12",
"localheinz/composer-normalize": "^1.3",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.2",
"sensiolabs/security-checker": "^5.0",
"symfony/var-dumper": "^4.3"
Expand Down
12 changes: 12 additions & 0 deletions extension.neon
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
parametersSchema:
banned_code: structure([
nodes: listOf(structure([
type: string()
functions: schema(listOf(string()), nullable())
]))
use_from_tests: bool()
])

parameters:
banned_code:
nodes:
# enable detection of echo
-
type: Stmt_Echo
functions: null

# enable detection of eval
-
type: Expr_Eval
functions: null

# enable detection of die/exit
-
type: Expr_Exit
functions: null

# enable detection of a set of functions
-
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
parameters:
checkGenericClassInNonGenericObjectType: false

includes:
- extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/BannedNodesRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
class BannedNodesRule implements Rule
{
/**
* @var array
* @var array<array<string, string[]>>
*/
private $bannedNodes;

/**
* @param array $bannedNodes
* @param array<array<string, string|string[]>> $bannedNodes
*/
public function __construct(array $bannedNodes)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Rules/BannedNodesRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ public function testProcessNodeWithHandledTypes(Expr $node): void
}

/**
* @return \Generator
* @return \Generator<array<Include_>>
*/
public function getUnhandledNodes(): \Generator
{
yield [new Include_($this->createMock(Expr::class), Include_::TYPE_INCLUDE)];
}

/**
* @return \Generator
* @return \Generator<array<Eval_|Exit_>>
*/
public function getHandledNodes(): \Generator
{
Expand Down

0 comments on commit 3a038b0

Please sign in to comment.