Skip to content

Commit bab2937

Browse files
authored
Merge pull request #64 from brociani/fix-ci
fix(ci): use sprintf native function
2 parents 65a5752 + c908c9c commit bab2937

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

.github/workflows/github-actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
php: [ '7.3', '7.4', '8.0' ]
14+
php: [ '8.1', '8.2', '8.3' ]
1515
steps:
1616
- uses: actions/checkout@v2
1717
- name: Setup PHP with tools

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ CHANGELOG
44
master
55
------
66

7+
* todo...
8+
9+
v2.0.0
10+
------
11+
12+
* Drop support for PHP ^7.3 || ^8.0, support now only ^8.1
13+
* Force usage of native sprintf function
714
* Added rule to ban shell execution via backticks
815
* Added rule to ban print statements
916
* Allow Composer plugin ergebnis/composer-normalize

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"homepage": "https://github.com/ekino/phpstan-banned-code",
1919
"require": {
20-
"php": "^7.3 || ^8.0",
20+
"php": "^8.1",
2121
"phpstan/phpstan": "^1.0"
2222
},
2323
"require-dev": {

src/Rules/BannedNodesRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public function processNode(Node $node, Scope $scope): array
7171
$function = $node->name->toString();
7272

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

7777
return [];
7878
}
7979

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

8383
/**

src/Rules/BannedUseTestRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ public function processNode(Node $node, Scope $scope): array
6262
}
6363

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

6868
$errors = [];
6969

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

0 commit comments

Comments
 (0)