Skip to content

[PHP] Update imi PHP 8.2 #7779

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
merged 7 commits into from
Dec 12, 2022
Merged
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
46 changes: 30 additions & 16 deletions frameworks/PHP/imi/Model/Base/FortuneBase.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
<?php

declare(strict_types=1);

namespace ImiApp\Model\Base;

use Imi\Model\Model as Model;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Table;
use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use Imi\Model\Model as Model;

/**
* fortune 基类
* @Entity(bean=false)
* @Table(name="fortune", id={"id"})
* fortune 基类.
*
* @Entity(camel=true, bean=false, incrUpdate=false)
* @Table(name=@ConfigValue(name="@app.models.ImiApp\Model\Fortune.name", default="fortune"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\Model\Fortune.poolName"))
* @DDL(sql="CREATE TABLE `fortune` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `message` varchar(2048) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", decode="")
*
* @property int|null $id
* @property string|null $message
*/
abstract class FortuneBase extends Model
{
/**
* id
* @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true)
* {@inheritdoc}
*/
public const PRIMARY_KEY = 'id';

/**
* {@inheritdoc}
*/
public const PRIMARY_KEYS = ["id"];

/**
* id.
* @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=true, virtual=false)
* @var int|null
*/
protected ?int $id = null;
protected ?int $id = NULL;

/**
* 获取 id
* 获取 id.
*
* @return int|null
*/
Expand All @@ -37,7 +51,7 @@ public function getId(): ?int
}

/**
* 赋值 id
* 赋值 id.
* @param int|null $id id
* @return static
*/
Expand All @@ -48,14 +62,14 @@ public function setId($id)
}

/**
* message
* @Column(name="message", type="varchar", length=2048, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false)
* message.
* @Column(name="message", type="varchar", length=2048, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
* @var string|null
*/
protected ?string $message = null;
protected ?string $message = NULL;

/**
* 获取 message
* 获取 message.
*
* @return string|null
*/
Expand All @@ -65,7 +79,7 @@ public function getMessage(): ?string
}

/**
* 赋值 message
* 赋值 message.
* @param string|null $message message
* @return static
*/
Expand Down
46 changes: 30 additions & 16 deletions frameworks/PHP/imi/Model/Base/WorldBase.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
<?php

declare(strict_types=1);

namespace ImiApp\Model\Base;

use Imi\Model\Model as Model;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Table;
use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use Imi\Model\Model as Model;

/**
* world 基类
* @Entity(bean=false)
* @Table(name="world", id={"id"})
* world 基类.
*
* @Entity(camel=true, bean=false, incrUpdate=false)
* @Table(name=@ConfigValue(name="@app.models.ImiApp\Model\World.name", default="world"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\Model\World.poolName"))
* @DDL(sql="CREATE TABLE `world` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `randomNumber` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", decode="")
*
* @property int|null $id
* @property int|null $randomNumber
*/
abstract class WorldBase extends Model
{
/**
* id
* @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true)
* {@inheritdoc}
*/
public const PRIMARY_KEY = 'id';

/**
* {@inheritdoc}
*/
public const PRIMARY_KEYS = ["id"];

/**
* id.
* @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=true, virtual=false)
* @var int|null
*/
protected ?int $id = null;
protected ?int $id = NULL;

/**
* 获取 id
* 获取 id.
*
* @return int|null
*/
Expand All @@ -37,7 +51,7 @@ public function getId(): ?int
}

/**
* 赋值 id
* 赋值 id.
* @param int|null $id id
* @return static
*/
Expand All @@ -48,14 +62,14 @@ public function setId($id)
}

/**
* randomNumber
* @Column(name="randomNumber", type="int", length=11, accuracy=0, nullable=false, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false)
* randomNumber.
* @Column(name="randomNumber", type="int", length=11, accuracy=0, nullable=false, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
* @var int|null
*/
protected ?int $randomNumber = null;
protected ?int $randomNumber = 0;

/**
* 获取 randomNumber
* 获取 randomNumber.
*
* @return int|null
*/
Expand All @@ -65,7 +79,7 @@ public function getRandomNumber(): ?int
}

/**
* 赋值 randomNumber
* 赋值 randomNumber.
* @param int|null $randomNumber randomNumber
* @return static
*/
Expand Down
46 changes: 32 additions & 14 deletions frameworks/PHP/imi/Model/PgSql/Base/FortuneBase.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
<?php

declare(strict_types=1);

namespace ImiApp\Model\PgSql\Base;

use Imi\Pgsql\Model\PgModel as Model;
use Imi\Model\Annotation\Table;
use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use Imi\Pgsql\Model\PgModel as Model;

/**
* Fortune 基类
* fortune 基类.
*
* @Entity(bean=false)
* @Table(name="Fortune", id={"id"}, dbPoolName="pgsql")
* @Table(name=@ConfigValue(name="@app.models.ImiApp\Model\PgSql\Fortune.name", default="fortune"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\Model\PgSql\Fortune.poolName", default="pgsql"))
*
* @property int|null $id
* @property string|null $message
*/
abstract class FortuneBase extends Model
{
/**
* id
* @Column(name="id", type="int4", length=-1, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=1, isAutoIncrement=false, ndims=0)
* {@inheritdoc}
*/
public const PRIMARY_KEY = 'id';

/**
* {@inheritdoc}
*/
public const PRIMARY_KEYS = ["id"];

/**
* id.

* @Column(name="id", type="int4", length=-1, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=1, isAutoIncrement=false, ndims=0, virtual=false)
* @var int|null
*/
protected ?int $id = null;
protected ?int $id = NULL;

/**
* 获取 id
* 获取 id.
*
* @return int|null
*/
Expand All @@ -35,7 +50,8 @@ public function getId(): ?int
}

/**
* 赋值 id
* 赋值 id.
*
* @param int|null $id id
* @return static
*/
Expand All @@ -46,14 +62,15 @@ public function setId(?int $id)
}

/**
* message
* @Column(name="message", type="varchar", length=0, accuracy=2048, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, ndims=0)
* message.

* @Column(name="message", type="varchar", length=0, accuracy=2048, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, ndims=0, virtual=false)
* @var string|null
*/
protected ?string $message = null;
protected ?string $message = NULL;

/**
* 获取 message
* 获取 message.
*
* @return string|null
*/
Expand All @@ -63,7 +80,8 @@ public function getMessage(): ?string
}

/**
* 赋值 message
* 赋值 message.
*
* @param string|null $message message
* @return static
*/
Expand Down
46 changes: 32 additions & 14 deletions frameworks/PHP/imi/Model/PgSql/Base/WorldBase.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
<?php

declare(strict_types=1);

namespace ImiApp\Model\PgSql\Base;

use Imi\Pgsql\Model\PgModel as Model;
use Imi\Model\Annotation\Table;
use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use Imi\Pgsql\Model\PgModel as Model;

/**
* World 基类
* World 基类.
*
* @Entity(bean=false)
* @Table(name="World", id={"id"}, dbPoolName="pgsql")
* @Table(name=@ConfigValue(name="@app.models.ImiApp\Model\PgSql\World.name", default="World"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\Model\PgSql\World.poolName", default="pgsql"))
*
* @property int|null $id
* @property int|null $randomnumber
*/
abstract class WorldBase extends Model
{
/**
* id
* @Column(name="id", type="int4", length=-1, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=1, isAutoIncrement=false, ndims=0)
* {@inheritdoc}
*/
public const PRIMARY_KEY = 'id';

/**
* {@inheritdoc}
*/
public const PRIMARY_KEYS = ["id"];

/**
* id.

* @Column(name="id", type="int4", length=-1, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=1, isAutoIncrement=false, ndims=0, virtual=false)
* @var int|null
*/
protected ?int $id = null;
protected ?int $id = NULL;

/**
* 获取 id
* 获取 id.
*
* @return int|null
*/
Expand All @@ -35,7 +50,8 @@ public function getId(): ?int
}

/**
* 赋值 id
* 赋值 id.
*
* @param int|null $id id
* @return static
*/
Expand All @@ -46,14 +62,15 @@ public function setId(?int $id)
}

/**
* randomnumber
* @Column(name="randomnumber", type="int4", length=-1, accuracy=0, nullable=false, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, ndims=0)
* randomnumber.

* @Column(name="randomnumber", type="int4", length=-1, accuracy=0, nullable=false, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, ndims=0, virtual=false)
* @var int|null
*/
protected ?int $randomnumber = null;
protected ?int $randomnumber = 0;

/**
* 获取 randomnumber
* 获取 randomnumber.
*
* @return int|null
*/
Expand All @@ -63,7 +80,8 @@ public function getRandomnumber(): ?int
}

/**
* 赋值 randomnumber
* 赋值 randomnumber.
*
* @param int|null $randomnumber randomnumber
* @return static
*/
Expand Down
2 changes: 1 addition & 1 deletion frameworks/PHP/imi/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
'username' => env('DB_USERNAME', 'benchmarkdbuser'),
'password' => env('DB_PASSWORD', 'benchmarkdbpass'),
'database' => 'hello_world',
'dbClass' => \Imi\Swoole\Db\Driver\Swoole\Driver::class,
'dbClass' => \Imi\Db\Mysql\Drivers\Mysqli\Driver::class,
],
],
'pgsql' => [
Expand Down
Loading