generated from filamentphp/plugin-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] Remaining undefined property fix
- Loading branch information
Showing
3 changed files
with
96 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Vormkracht10\TwoFactorAuth\Tests\PHPStan; | ||
|
||
use PHPStan\Reflection\ClassReflection; | ||
use PHPStan\Reflection\PropertyReflection; | ||
use PHPStan\Type\Type; | ||
|
||
class CustomPropertyReflection implements PropertyReflection | ||
{ | ||
private $declaringClass; | ||
private $type; | ||
|
||
public function __construct(ClassReflection $declaringClass, Type $type) | ||
{ | ||
$this->declaringClass = $declaringClass; | ||
$this->type = $type; | ||
} | ||
|
||
public function getDeclaringClass(): ClassReflection | ||
{ | ||
return $this->declaringClass; | ||
} | ||
|
||
public function getType(): Type | ||
{ | ||
return $this->type; | ||
} | ||
|
||
public function isStatic(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function isPrivate(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function isPublic(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function isDeprecated(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function getDeprecatedDescription(): ?string | ||
{ | ||
return null; | ||
} | ||
|
||
public function isInternal(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function getDocComment(): ?string | ||
{ | ||
return null; | ||
} | ||
|
||
public function isReadOnly(): bool | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Vormkracht10\TwoFactorAuth\Tests\PHPStan; | ||
|
||
use PHPStan\Reflection\ClassReflection; | ||
use PHPStan\Reflection\PropertiesClassReflectionExtension; | ||
use PHPStan\Reflection\PropertyReflection; | ||
use PHPStan\Type\ObjectType; | ||
|
||
class UserPropertiesClassReflectionExtension implements PropertiesClassReflectionExtension | ||
{ | ||
public function hasProperty(ClassReflection $classReflection, string $propertyName): bool | ||
{ | ||
return $classReflection->getName() === 'Illuminate\Foundation\Auth\User' && $propertyName === 'two_factor_confirmed_at'; | ||
} | ||
|
||
public function getProperty(ClassReflection $classReflection, string $propertyName): PropertyReflection | ||
{ | ||
$type = new ObjectType('Carbon\Carbon'); | ||
return new CustomPropertyReflection($classReflection, $type); | ||
} | ||
} |