Skip to content

Use stubfile extension for PasswordUpgraderInterface #335

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

Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update stub file extensions checks
  • Loading branch information
VincentLanglet committed Feb 20, 2023
commit ce7182c683d35f3b84e337fe2bc538245a2f12c5
17 changes: 15 additions & 2 deletions src/Symfony/InputBagStubFilesExtension.php
Original file line number Diff line number Diff line change
@@ -2,15 +2,28 @@

namespace PHPStan\Symfony;

use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
use PHPStan\BetterReflection\Reflector\Reflector;
use PHPStan\PhpDoc\StubFilesExtension;
use function class_exists;

class InputBagStubFilesExtension implements StubFilesExtension
{

/** @var Reflector */
private $reflector;

public function __construct(
Reflector $reflector
)
{
$this->reflector = $reflector;
}

public function getFiles(): array
{
if (!class_exists('Symfony\Component\HttpFoundation\InputBag')) {
try {
$this->reflector->reflectClass('Symfony\Component\HttpFoundation\InputBag');
} catch (IdentifierNotFound $e) {
return [];
}

17 changes: 15 additions & 2 deletions src/Symfony/PasswordAuthenticatedUserStubFilesExtension.php
Original file line number Diff line number Diff line change
@@ -2,15 +2,28 @@

namespace PHPStan\Symfony;

use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
use PHPStan\BetterReflection\Reflector\Reflector;
use PHPStan\PhpDoc\StubFilesExtension;
use function interface_exists;

class PasswordAuthenticatedUserStubFilesExtension implements StubFilesExtension
{

/** @var Reflector */
private $reflector;

public function __construct(
Reflector $reflector
)
{
$this->reflector = $reflector;
}

public function getFiles(): array
{
if (!interface_exists('Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface')) {
try {
$this->reflector->reflectClass('Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface');
} catch (IdentifierNotFound $e) {
return [];
}