Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Bug: Auth.php Errors

未关闭
#1,270 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
php

调研方向

从 shield/src/Auth.php 开始,使用包含所报告 PHP、CodeIgniter 和 Shield 版本的基础 Shield 安装,检查 PhpStorm 针对 attempt() 和 check() 的 @method 注解给出的诊断。复现所报告的错误,并确定注解的预期行为;在不删除方法声明的情况下解决文档中记录的错误,即视为完成。

由索引模型根据 Issue 内容生成。

描述

bug
PHP Version

8.4.9

CodeIgniter4 Version

4.6.1

Shield Version

1.1.0

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MySQL 8.4.3

Did you customize Shield?

No Customizations base install.

// shield/src/Auth.php

The minute I open Auth.php the errors show up.

The 2 Result lines below are throwing errors in phpStorm newest version.

If I remark them out like this they go away, it seems to be throwing the errors
because of the email?: and all others with the ? mark in them

 //           | Errors
 // * @method //Result    attempt(array{email?: string, username?: string, password?: string, token?: string} $credentials)
 // * @method //Result    check(array{email?: string, username?: string, password?: string, token?: string} $credentials)

/**
 * Facade for Authentication
 *
 * @method Result    attempt(array{email?: string, username?: string, password?: string, token?: string} $credentials)
 * @method Result    check(array{email?: string, username?: string, password?: string, token?: string} $credentials)
 * @method bool      checkAction(string $token, string $type)                                                          [Session]
 * @method void      forget(?User $user = null)                                                                        [Session]
 * @method User|null getUser()
 * @method bool      loggedIn()
 * @method bool      login(User $user)
 * @method void      loginById($userId)
 * @method bool      logout()
 * @method void      recordActiveDate()
 * @method $this     remember(bool $shouldRemember = true)                                                             [Session]
 */
class Auth
{}
What happened?

Errors

Steps to Reproduce

Base install of shield

Expected Output

No Errors

Anything else?

No response

主要语言
PHP
星标
426
派生
144
平均合并
3 天 14 小时
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codeigniter4/shield 的其他 Issue

查看 codeigniter4/shield 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。