Skip to content

Commit

Permalink
Fix magic constants as default parameter values
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 8, 2020
1 parent c2135cb commit 7aabe35
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"nette/utils": "^3.1.1",
"nikic/php-parser": "^4.5.0",
"ondram/ci-detector": "^3.1",
"ondrejmirtes/better-reflection": "^4.3.3",
"ondrejmirtes/better-reflection": "^4.3.4",
"phpdocumentor/type-resolver": "1.0.1",
"phpstan/phpdoc-parser": "^0.4.7",
"react/child-process": "^0.6.1",
Expand Down
6 changes: 6 additions & 0 deletions tests/PHPStan/Analyser/AnalyserIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ public function testTwoSameClassesInSingleFile(): void
$this->assertSame(21, $error->getLine());
}

public function testBug3405(): void
{
$errors = $this->runAnalyse(__DIR__ . '/data/bug-3405.php');
$this->assertCount(0, $errors);
}

/**
* @param string $file
* @return \PHPStan\Analyser\Error[]
Expand Down
21 changes: 21 additions & 0 deletions tests/PHPStan/Analyser/data/bug-3405.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Bug3405;

class Foo
{

public function doFoo(
string $file = __FILE__,
int $line = __LINE__,
string $class = __CLASS__,
string $dir = __DIR__,
string $namespace = __NAMESPACE__,
string $method = __METHOD__,
string $function = __FUNCTION__,
string $trait = __TRAIT__
): void
{
}

}

0 comments on commit 7aabe35

Please sign in to comment.