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

fix(ci): use sprintf native function #64

Merged
merged 1 commit into from
Aug 1, 2024
Merged
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
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
mremi marked this conversation as resolved.
Show resolved Hide resolved
------

* 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
Loading