Skip to content

Commit fe54415

Browse files
committed
phpstan fixes
1 parent 5cacadc commit fe54415

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: shivammathur/setup-php@v1
14+
- uses: shivammathur/setup-php@v2
1515
with:
1616
php-version: 7.4
1717
coverage: none
1818

1919
- run: composer install --no-progress --prefer-dist
20-
- run: composer phpstan
20+
- run: composer phpstan -- --no-progress
2121
continue-on-error: true # is only informative

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- stage: Static Analysis (informative)
4646
php: 7.4
4747
script:
48-
- composer run-script phpstan
48+
- composer phpstan -- --no-progress
4949

5050

5151
- stage: Code Coverage

src/PhpGenerator/Factory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ private function extractBody(PhpParser\NodeFinder $nodeFinder, string $originalC
277277
$nodeFinder->findInstanceOf($statements, Node\Scalar\String_::class),
278278
$nodeFinder->findInstanceOf($statements, Node\Scalar\EncapsedStringPart::class)
279279
) as $node) {
280+
/** @var Node\Scalar\String_|Node\Scalar\EncapsedStringPart $node */
280281
$token = substr($body, $node->getStartFilePos() - $start, $node->getEndFilePos() - $node->getStartFilePos() + 1);
281282
if (strpos($token, "\n") !== false) {
282283
$quote = $node instanceof Node\Scalar\String_ ? '"' : '';
@@ -290,6 +291,7 @@ private function extractBody(PhpParser\NodeFinder $nodeFinder, string $originalC
290291

291292
// HEREDOC => "string"
292293
foreach ($nodeFinder->findInstanceOf($statements, Node\Scalar\Encapsed::class) as $node) {
294+
/** @var Node\Scalar\Encapsed $node */
293295
if ($node->getAttribute('kind') === Node\Scalar\String_::KIND_HEREDOC) {
294296
$replacements[] = [
295297
$node->getStartFilePos(),

src/PhpGenerator/Printer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public function printParameters($function, PhpNamespace $namespace = null): stri
267267
$params[] =
268268
($promoted ? Helpers::formatDocComment((string) $promoted->getComment()) : '')
269269
. ($attrs = self::printAttributes($param->getAttributes(), $namespace, true))
270-
. ($promoted ? ($param->getVisibility() ?: 'public') . ' ' : '')
270+
. ($promoted ? ($promoted->getVisibility() ?: 'public') . ' ' : '')
271271
. ltrim($this->printType($type, $param->isNullable(), $namespace) . ' ')
272272
. ($param->isReference() ? '&' : '')
273273
. ($variadic ? '...' : '')

0 commit comments

Comments
 (0)