Skip to content

Commit

Permalink
cover generic class string
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Aug 6, 2022
1 parent b770192 commit 9c45e29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Type/Php/LtrimFunctionReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use PhpParser\Node\Expr\FuncCall;
use PHPStan\Analyser\Scope;
use PHPStan\Php\PhpVersion;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Type\ClassStringType;
use PHPStan\Type\Constant\ConstantStringType;
Expand All @@ -16,7 +15,7 @@
class LtrimFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension
{

public function __construct(private PhpVersion $phpVersion)
public function __construct()
{
}

Expand Down
8 changes: 8 additions & 0 deletions tests/PHPStan/Analyser/data/bug-7483.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

class A {}

/**
* @param class-string<A> $class
*/
function bar($class): string
{
assertType('class-string', ltrim($class, '\\'));
}

/**
* @param class-string $class
* @return class-string
Expand Down

0 comments on commit 9c45e29

Please sign in to comment.