Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions src/helper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check warning on line 1 in src/helper.php

View workflow job for this annotation

GitHub Actions / php-cs-fixer

Found violation(s) of type: declare_equal_normalize

Check warning on line 1 in src/helper.php

View workflow job for this annotation

GitHub Actions / php-cs-fixer

Found violation(s) of type: blank_line_after_opening_tag
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
Expand Down Expand Up @@ -42,9 +42,9 @@
if (!function_exists('abort')) {
/**
* 抛出HTTP异常
* @param integer|Response $code 状态码 或者 Response对象实例
* @param string $message 错误信息
* @param array $header 参数
* @param int|Response $code 状态码 或者 Response对象实例
* @param string $message 错误信息
* @param array $header 参数
*/
function abort($code, string $message = '', array $header = [])
{
Expand Down
6 changes: 3 additions & 3 deletions src/think/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class App extends Container
* 核心框架版本
* @deprecated 已经废弃 请改用version()方法
*/
const VERSION = '8.0.0';
public const VERSION = '8.0.0';

/**
* 应用调试模式
Expand Down Expand Up @@ -71,7 +71,7 @@ class App extends Container

/**
* 应用内存初始占用
* @var integer
* @var int
*/
protected $beginMem;

Expand Down Expand Up @@ -427,7 +427,7 @@ public function getBeginTime(): float
/**
* 获取应用初始内存占用
* @access public
* @return integer
* @return int
*/
public function getBeginMem(): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/think/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected function setCookie(string $name, string $value, int $expire, array $op
* @access public
* @param string $name cookie名称
* @param string $value cookie值
* @param mixed $option 可选参数 可能会是 null|integer|string
* @param mixed $option 可选参数 可能会是 null|int|string
* @return void
*/
public function forever(string $name, string $value = '', $option = null): void
Expand Down
7 changes: 6 additions & 1 deletion src/think/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ public function observe($observer, string $prefix = '')

if (empty($prefix) && $reflect->hasProperty('eventPrefix')) {
$reflectProperty = $reflect->getProperty('eventPrefix');
$reflectProperty->setAccessible(true);

if (PHP_VERSION_ID < 80100) {
// 8.0 版本时调用
$reflectProperty->setAccessible(true);
}

$prefix = $reflectProperty->getValue($observer);
}

Expand Down
6 changes: 3 additions & 3 deletions src/think/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ public function ext(): string
* 获取当前请求的时间
* @access public
* @param bool $float 是否使用浮点类型
* @return integer|float
* @return int|float
*/
public function time(bool $float = false)
{
Expand Down Expand Up @@ -1682,7 +1682,7 @@ public function ip(): string
* @param string $ip IP地址
* @param string $type IP地址类型 (ipv4, ipv6)
*
* @return boolean
* @return bool
*/
public function isValidIP(string $ip, string $type = ''): bool
{
Expand Down Expand Up @@ -2191,7 +2191,7 @@ public function __get(string $name)
* 检测中间传递数据的值
* @access public
* @param string $name 名称
* @return boolean
* @return bool
*/
public function __isset(string $name): bool
{
Expand Down
6 changes: 3 additions & 3 deletions src/think/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract class Response

/**
* 状态码
* @var integer
* @var int
*/
protected $code = 200;

Expand Down Expand Up @@ -277,7 +277,7 @@ public function content($content)
/**
* 发送HTTP状态
* @access public
* @param integer $code 状态码
* @param int $code 状态码
* @return $this
*/
public function code(int $code)
Expand Down Expand Up @@ -406,7 +406,7 @@ public function getContent(): string
/**
* 获取状态码
* @access public
* @return integer
* @return int
*/
public function getCode(): int
{
Expand Down
6 changes: 3 additions & 3 deletions src/think/cache/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ abstract class Driver implements CacheHandlerInterface

/**
* 缓存读取次数
* @var integer
* @var int
*/
protected $readTimes = 0;

/**
* 缓存写入次数
* @var integer
* @var int
*/
protected $writeTimes = 0;

Expand All @@ -61,7 +61,7 @@ abstract class Driver implements CacheHandlerInterface
/**
* 获取有效期
* @access protected
* @param integer|DateInterval|DateTimeInterface $expire 有效期
* @param int|DateInterval|DateTimeInterface $expire 有效期
* @return int
*/
protected function getExpireTime(int | DateInterval | DateTimeInterface $expire): int
Expand Down
6 changes: 3 additions & 3 deletions src/think/cache/TagSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function __construct(protected array $tag, protected Driver $handler)
/**
* 写入缓存
* @access public
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param integer|DateInterval|DateTimeInterface $expire 有效时间(秒)
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param int|DateInterval|DateTimeInterface $expire 有效时间(秒)
* @return bool
*/
public function set($name, $value, $expire = null): bool
Expand Down
6 changes: 3 additions & 3 deletions src/think/cache/driver/Memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ public function get($name, $default = null): mixed
/**
* 写入缓存
* @access public
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param integer|DateInterval|DateTimeInterface $expire 有效时间(秒)
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param int|DateInterval|DateTimeInterface $expire 有效时间(秒)
* @return bool
*/
public function set($name, $value, $expire = null): bool
Expand Down
6 changes: 3 additions & 3 deletions src/think/cache/driver/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public function get($name, $default = null): mixed
/**
* 写入缓存
* @access public
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param integer|DateInterval|DateTimeInterface $expire 有效时间(秒)
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param int|DateInterval|DateTimeInterface $expire 有效时间(秒)
* @return bool
*/
public function set($name, $value, $expire = null): bool
Expand Down
6 changes: 3 additions & 3 deletions src/think/cache/driver/Wincache.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public function get($name, $default = null): mixed
/**
* 写入缓存
* @access public
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param integer|DateInterval|DateTimeInterface $expire 有效时间(秒)
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param int|DateInterval|DateTimeInterface $expire 有效时间(秒)
* @return bool
*/
public function set($name, $value, $expire = null): bool
Expand Down
2 changes: 1 addition & 1 deletion src/think/console/output/Descriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected function describeCommand(Command $command, array $options = [])
*/
protected function describeConsole(Console $console, array $options = [])
{
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$describedNamespace = $options['namespace'] ?? null;
$description = new ConsoleDescription($console, $describedNamespace);

if (isset($options['raw_text']) && $options['raw_text']) {
Expand Down
8 changes: 4 additions & 4 deletions src/think/console/output/driver/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ public function renderException(\Throwable $e)
]);

for ($i = 0, $count = count($trace); $i < $count; ++$i) {
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
$type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
$class = $trace[$i]['class'] ?? '';
$type = $trace[$i]['type'] ?? '';
$function = $trace[$i]['function'];
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
$file = $trace[$i]['file'] ?? 'n/a';
$line = $trace[$i]['line'] ?? 'n/a';

$this->write(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), true, Output::OUTPUT_NORMAL, $stderr);
}
Expand Down
20 changes: 10 additions & 10 deletions src/think/contract/ModelRelationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public function eagerlyResult(Model $result, string $relation, array $subRelatio
/**
* 关联统计
* @access public
* @param Model $result 模型对象
* @param Closure $closure 闭包
* @param string $aggregate 聚合查询方法
* @param string $field 字段
* @param string $name 统计字段别名
* @return integer
* @param Model $result 模型对象
* @param Closure $closure 闭包
* @param string $aggregate 聚合查询方法
* @param string $field 字段
* @param string|null $name 统计字段别名
* @return int
*/
public function relationCount(Model $result, Closure $closure, string $aggregate = 'count', string $field = '*', ?string &$name = null);

Expand All @@ -78,10 +78,10 @@ public function getRelationCountQuery(?Closure $closure = null, string $aggregat
/**
* 根据关联条件查询当前模型
* @access public
* @param string $operator 比较操作符
* @param integer $count 个数
* @param string $id 关联表的统计字段
* @param string $joinType JOIN类型
* @param string $operator 比较操作符
* @param int $count 个数
* @param string $id 关联表的统计字段
* @param string $joinType JOIN类型
* @return Query
*/
public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = 'INNER', ?Query $query = null): Query;
Expand Down
12 changes: 6 additions & 6 deletions src/think/exception/ErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ class ErrorException extends Exception
{
/**
* 用于保存错误级别
* @var integer
* @var int
*/
protected $severity;

/**
* 错误异常构造函数
* @access public
* @param integer $severity 错误级别
* @param string $message 错误详细信息
* @param string $file 出错文件路径
* @param integer $line 出错行号
* @param int $severity 错误级别
* @param string $message 错误详细信息
* @param string $file 出错文件路径
* @param int $line 出错行号
*/
public function __construct(int $severity, string $message, string $file, int $line)
{
Expand All @@ -48,7 +48,7 @@ public function __construct(int $severity, string $message, string $file, int $l
/**
* 获取错误级别
* @access public
* @return integer 错误级别
* @return int 错误级别
*/
final public function getSeverity()
{
Expand Down
2 changes: 1 addition & 1 deletion src/think/exception/Handle.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ protected function renderExceptionContent(Throwable $exception): string
* ErrorException则使用错误级别作为错误编码
* @access protected
* @param Throwable $exception
* @return integer 错误编码
* @return int 错误编码
*/
protected function getCode(Throwable $exception)
{
Expand Down
2 changes: 1 addition & 1 deletion src/think/facade/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @method static string getConfigPath() 获取应用配置目录
* @method static string getConfigExt() 获取配置后缀
* @method static float getBeginTime() 获取应用开启时间
* @method static integer getBeginMem() 获取应用初始内存占用
* @method static int getBeginMem() 获取应用初始内存占用
* @method static \think\App initialize() 初始化应用
* @method static bool initialized() 是否初始化过
* @method static void loadLangPack(string $langset) 加载语言包
Expand Down
7 changes: 4 additions & 3 deletions src/think/facade/Request.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
Expand Down Expand Up @@ -38,7 +39,7 @@
* @method static \think\Request setPathinfo(string $pathinfo) 设置当前请求的pathinfo
* @method static string pathinfo() 获取当前请求URL的pathinfo信息(含URL后缀)
* @method static string ext() 当前URL的访问后缀
* @method static integer|float time(bool $float = false) 获取当前请求的时间
* @method static int|float time(bool $float = false) 获取当前请求的时间
* @method static string type() 当前请求的资源类型
* @method static void mimeType(string|array $type, string $val = '') 设置资源类型
* @method static \think\Request setMethod(string $method) 设置请求类型
Expand Down Expand Up @@ -81,7 +82,7 @@
* @method static bool isAjax(bool $ajax = false) 当前是否Ajax请求
* @method static bool isPjax(bool $pjax = false) 当前是否Pjax请求
* @method static string ip() 获取客户端IP地址
* @method static boolean isValidIP(string $ip, string $type = '') 检测是否是合法的IP地址
* @method static bool isValidIP(string $ip, string $type = '') 检测是否是合法的IP地址
* @method static string ip2bin(string $ip) 将IP地址转换为二进制字符串
* @method static bool isMobile() 检测是否使用手机访问
* @method static string scheme() 当前URL地址中的scheme参数
Expand Down Expand Up @@ -116,7 +117,7 @@
* @method static \think\Request withRoute(array $route) 设置ROUTE变量
* @method static mixed __set(string $name, mixed $value) 设置中间传递数据
* @method static mixed __get(string $name) 获取中间传递数据的值
* @method static boolean __isset(string $name) 检测中间传递数据的值
* @method static bool __isset(string $name) 检测中间传递数据的值
* @method static bool offsetExists(mixed $name)
* @method static mixed offsetGet(mixed $name)
* @method static mixed offsetSet(mixed $name, $value)
Expand Down
8 changes: 4 additions & 4 deletions src/think/initializer/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ public function appException(Throwable $e): void
/**
* Error Handler
* @access public
* @param integer $errno 错误编号
* @param string $errstr 详细错误信息
* @param string $errfile 出错的文件
* @param integer $errline 出错行号
* @param int $errno 错误编号
* @param string $errstr 详细错误信息
* @param string $errfile 出错的文件
* @param int $errline 出错行号
* @throws ErrorException
*/
public function appError(int $errno, string $errstr, string $errfile = '', int $errline = 0): void
Expand Down
2 changes: 1 addition & 1 deletion src/think/response/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function isContent(bool $content = true)
/**
* 设置有效期
* @access public
* @param integer $expire 有效期
* @param int $expire 有效期
* @return $this
*/
public function expire(int $expire)
Expand Down
Loading
Loading