yiisoft /
demo
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | declare(strict_types=1); |
||||||
| 4 | |||||||
| 5 | namespace App\User; |
||||||
| 6 | |||||||
| 7 | use Cycle\Annotated\Annotation\Column; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 8 | use Cycle\Annotated\Annotation\Entity; |
||||||
|
0 ignored issues
–
show
The type
Cycle\Annotated\Annotation\Entity was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 9 | use Cycle\Annotated\Annotation\Table\Index; |
||||||
|
0 ignored issues
–
show
The type
Cycle\Annotated\Annotation\Table\Index was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 10 | use Cycle\ORM\Entity\Behavior\CreatedAt; |
||||||
|
0 ignored issues
–
show
The type
Cycle\ORM\Entity\Behavior\CreatedAt was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 11 | use Cycle\ORM\Entity\Behavior\UpdatedAt; |
||||||
|
0 ignored issues
–
show
The type
Cycle\ORM\Entity\Behavior\UpdatedAt was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 12 | use DateTimeImmutable; |
||||||
| 13 | use Yiisoft\Auth\IdentityInterface; |
||||||
|
0 ignored issues
–
show
The type
Yiisoft\Auth\IdentityInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 14 | use Yiisoft\Security\PasswordHasher; |
||||||
|
0 ignored issues
–
show
The type
Yiisoft\Security\PasswordHasher was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 15 | use Yiisoft\Security\Random; |
||||||
|
0 ignored issues
–
show
The type
Yiisoft\Security\Random was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 16 | |||||||
| 17 | #[Entity(repository: UserRepository::class)] |
||||||
| 18 | #[Index(columns: ['login', 'token'], unique: true)] |
||||||
| 19 | #[CreatedAt(field: 'created_at', column: 'created_at')] |
||||||
| 20 | #[UpdatedAt(field: 'updated_at', column: 'updated_at')] |
||||||
| 21 | class User implements IdentityInterface |
||||||
| 22 | { |
||||||
| 23 | #[Column(type: 'primary')] |
||||||
| 24 | private ?int $id = null; |
||||||
| 25 | |||||||
| 26 | #[Column(type: 'string(128)')] |
||||||
| 27 | private string $token; |
||||||
| 28 | |||||||
| 29 | #[Column(type: 'string(48)')] |
||||||
| 30 | private string $login; |
||||||
| 31 | |||||||
| 32 | #[Column(type: 'string')] |
||||||
| 33 | private string $passwordHash; |
||||||
| 34 | |||||||
| 35 | /** |
||||||
| 36 | * Annotations for this field placed in a mapper class. |
||||||
| 37 | */ |
||||||
| 38 | private DateTimeImmutable $created_at; |
||||||
| 39 | |||||||
| 40 | /** |
||||||
| 41 | * Annotations for this field placed in a mapper class. |
||||||
| 42 | */ |
||||||
| 43 | private DateTimeImmutable $updated_at; |
||||||
| 44 | |||||||
| 45 | public function __construct(string $login, string $password) |
||||||
| 46 | { |
||||||
| 47 | $this->login = $login; |
||||||
| 48 | $this->created_at = new DateTimeImmutable(); |
||||||
| 49 | $this->updated_at = new DateTimeImmutable(); |
||||||
| 50 | $this->setPassword($password); |
||||||
| 51 | $this->resetToken(); |
||||||
|
0 ignored issues
–
show
The method
resetToken() does not exist on App\User\User.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 52 | } |
||||||
| 53 | |||||||
| 54 | public function getId(): ?string |
||||||
| 55 | { |
||||||
| 56 | return $this->id === null ? null : (string) $this->id; |
||||||
| 57 | } |
||||||
| 58 | |||||||
| 59 | public function getToken(): string |
||||||
| 60 | { |
||||||
| 61 | return $this->token; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 62 | } |
||||||
| 63 | |||||||
| 64 | public function resetToken(): void |
||||||
| 65 | { |
||||||
| 66 | $this->token = Random::string(128); |
||||||
| 67 | } |
||||||
| 68 | |||||||
| 69 | public function getLogin(): string |
||||||
| 70 | { |
||||||
| 71 | return $this->login; |
||||||
| 72 | } |
||||||
| 73 | |||||||
| 74 | public function setLogin(string $login): void |
||||||
| 75 | { |
||||||
| 76 | $this->login = $login; |
||||||
| 77 | } |
||||||
| 78 | |||||||
| 79 | public function validatePassword(string $password): bool |
||||||
| 80 | { |
||||||
| 81 | return (new PasswordHasher())->validate($password, $this->passwordHash); |
||||||
| 82 | } |
||||||
| 83 | |||||||
| 84 | public function setPassword(string $password): void |
||||||
| 85 | { |
||||||
| 86 | $this->passwordHash = (new PasswordHasher())->hash($password); |
||||||
| 87 | } |
||||||
| 88 | |||||||
| 89 | public function getCreatedAt(): DateTimeImmutable |
||||||
| 90 | { |
||||||
| 91 | return $this->created_at; |
||||||
| 92 | } |
||||||
| 93 | |||||||
| 94 | public function getUpdatedAt(): DateTimeImmutable |
||||||
| 95 | { |
||||||
| 96 | return $this->updated_at; |
||||||
| 97 | } |
||||||
| 98 | } |
||||||
| 99 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths