Decoded Output
Download<?php
declare(strict_types=1);
namespace Larastan\Larastan\ReturnTypes;
use Illuminate\Support\Facades\Auth;
use Larastan\Larastan\Concerns;
use PhpParser\Node\Expr\StaticCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Type\DynamicStaticMethodReturnTypeExtension;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
use function array_map;
use function count;
/** @internal */
final class AuthExtension implements DynamicStaticMethodReturnTypeExtension
{
use Concerns\HasContainer;
use Concerns\LoadsAuthModel;
public function getClass(): string
{
return Auth::class;
}
public function isStaticMethodSupported(MethodReflection $methodReflection): bool
{
return $methodReflection->getName() === 'user';
}
public function getTypeFromStaticMethodCall(
MethodReflection $methodReflection,
StaticCall $methodCall,
Scope $scope,
): Type {
$config = $this->getContainer()->get('config');
$authModels = [];
if ($config !== null) {
$authModels = $this->getAuthModels($config);
}
if (count($authModels) === 0) {
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
}
return TypeCombinator::addNull(
TypeCombinator::union(...array_map(
static fn (string $authModel): Type => new ObjectType($authModel),
$authModels,
)),
);
}
}
?>
Did this file decode correctly?
How would you describe this file?
Thank you for your feedback! This will help us detect malicious PHP files more accurately in the future.
Function Calls
None
Variables
None
Stats
| MD5 | e54fe3139e03ab08 |
|---|---|
| Eval Count | 0 |
| Decode Time | 105 ms |
Original Code
<?php
declare(strict_types=1);
namespace Larastan\Larastan\ReturnTypes;
use Illuminate\Support\Facades\Auth;
use Larastan\Larastan\Concerns;
use PhpParser\Node\Expr\StaticCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Type\DynamicStaticMethodReturnTypeExtension;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
use function array_map;
use function count;
/** @internal */
final class AuthExtension implements DynamicStaticMethodReturnTypeExtension
{
use Concerns\HasContainer;
use Concerns\LoadsAuthModel;
public function getClass(): string
{
return Auth::class;
}
public function isStaticMethodSupported(MethodReflection $methodReflection): bool
{
return $methodReflection->getName() === 'user';
}
public function getTypeFromStaticMethodCall(
MethodReflection $methodReflection,
StaticCall $methodCall,
Scope $scope,
): Type {
$config = $this->getContainer()->get('config');
$authModels = [];
if ($config !== null) {
$authModels = $this->getAuthModels($config);
}
if (count($authModels) === 0) {
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
}
return TypeCombinator::addNull(
TypeCombinator::union(...array_map(
static fn (string $authModel): Type => new ObjectType($authModel),
$authModels,
)),
);
}
}