Skip to content

Commit

Permalink
Merge pull request #64 from brociani/fix-ci
Browse files Browse the repository at this point in the history
fix(ci): use sprintf native function
  • Loading branch information
mremi authored Aug 1, 2024
2 parents 65a5752 + c908c9c commit bab2937
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '7.3', '7.4', '8.0' ]
php: [ '8.1', '8.2', '8.3' ]
steps:
- uses: actions/checkout@v2
- name: Setup PHP with tools
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ CHANGELOG
master
------

* todo...

v2.0.0
------

* Drop support for PHP ^7.3 || ^8.0, support now only ^8.1
* Force usage of native sprintf function
* Added rule to ban shell execution via backticks
* Added rule to ban print statements
* Allow Composer plugin ergebnis/composer-normalize
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"homepage": "https://github.com/ekino/phpstan-banned-code",
"require": {
"php": "^7.3 || ^8.0",
"php": "^8.1",
"phpstan/phpstan": "^1.0"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/BannedNodesRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ public function processNode(Node $node, Scope $scope): array
$function = $node->name->toString();

if (\in_array($function, $this->bannedFunctions)) {
return [sprintf('Should not use function "%s", please change the code.', $function)];
return [\sprintf('Should not use function "%s", please change the code.', $function)];
}

return [];
}

return [sprintf('Should not use node with type "%s", please change the code.', $type)];
return [\sprintf('Should not use node with type "%s", please change the code.', $type)];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/BannedUseTestRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ public function processNode(Node $node, Scope $scope): array
}

if (!$node instanceof Use_) {
throw new \InvalidArgumentException(sprintf('$node must be an instance of %s, %s given', Use_::class, \get_class($node)));
throw new \InvalidArgumentException(\sprintf('$node must be an instance of %s, %s given', Use_::class, \get_class($node)));
}

$errors = [];

foreach ($node->uses as $use) {
if (preg_match('#^Tests#', $use->name->toString())) {
$errors[] = sprintf('Should not use %s in the non-test file %s', $use->name->toString(), $scope->getFile());
$errors[] = \sprintf('Should not use %s in the non-test file %s', $use->name->toString(), $scope->getFile());
}
}

Expand Down

0 comments on commit bab2937

Please sign in to comment.