Refine the return type
This commit is contained in:
parent
864b338e30
commit
ce3dfbaf10
26 changed files with 55 additions and 55 deletions
|
@ -162,9 +162,9 @@ class Container
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return ContainerInterface Self reference
|
||||
* @return Container
|
||||
*/
|
||||
public function setParameter(string $name, $value): self
|
||||
public function setParameter(string $name, $value): Container
|
||||
{
|
||||
$segments = \explode('.', $name);
|
||||
$n = \count($segments);
|
||||
|
|
|
@ -181,7 +181,7 @@ class File
|
|||
*
|
||||
* @return File
|
||||
*/
|
||||
public function rename(bool $rename): self
|
||||
public function rename(bool $rename): File
|
||||
{
|
||||
$this->rename = $rename;
|
||||
|
||||
|
@ -195,7 +195,7 @@ class File
|
|||
*
|
||||
* @return File
|
||||
*/
|
||||
public function rewrite(bool $rewrite): self
|
||||
public function rewrite(bool $rewrite): File
|
||||
{
|
||||
$this->rewrite = $rewrite;
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class Image extends File
|
|||
*
|
||||
* @return Image
|
||||
*/
|
||||
public function resize(int $maxW, int $maxH): self
|
||||
public function resize(int $maxW, int $maxH): Image
|
||||
{
|
||||
$oldW = \imagesx($this->image);
|
||||
$oldH = \imagesy($this->image);
|
||||
|
|
|
@ -169,7 +169,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function reset(): self
|
||||
public function reset(): Mail
|
||||
{
|
||||
$this->to = [];
|
||||
$this->headers = [];
|
||||
|
@ -185,7 +185,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function setSubject(string $subject): self
|
||||
public function setSubject(string $subject): Mail
|
||||
{
|
||||
$this->headers['Subject'] = $this->encodeText(\preg_replace('%[\x00-\x1F]%', '', \trim($subject)));
|
||||
|
||||
|
@ -200,7 +200,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function addTo($email, string $name = null): self
|
||||
public function addTo($email, string $name = null): Mail
|
||||
{
|
||||
if (! \is_array($email)) {
|
||||
$email = \preg_split('%[,\n\r]%', (string) $email, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
@ -223,7 +223,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function setTo($email, string $name = null): self
|
||||
public function setTo($email, string $name = null): Mail
|
||||
{
|
||||
$this->to = [];
|
||||
|
||||
|
@ -238,7 +238,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function setFrom(string $email, string $name = null): self
|
||||
public function setFrom(string $email, string $name = null): Mail
|
||||
{
|
||||
$email = $this->valid($email, false, true);
|
||||
if (false !== $email) {
|
||||
|
@ -256,7 +256,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function setReplyTo(string $email, string $name = null): self
|
||||
public function setReplyTo(string $email, string $name = null): Mail
|
||||
{
|
||||
$email = $this->valid($email, false, true);
|
||||
if (false !== $email) {
|
||||
|
@ -323,7 +323,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function setFolder(string $folder): self
|
||||
public function setFolder(string $folder): Mail
|
||||
{
|
||||
$this->folder = $folder;
|
||||
|
||||
|
@ -337,7 +337,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function setLanguage(string $language): self
|
||||
public function setLanguage(string $language): Mail
|
||||
{
|
||||
$this->language = $language;
|
||||
|
||||
|
@ -354,7 +354,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function setTpl(string $tpl, array $data): self
|
||||
public function setTpl(string $tpl, array $data): Mail
|
||||
{
|
||||
$file = \rtrim($this->folder, '\\/') . '/' . $this->language . '/mail/' . $tpl;
|
||||
if (! \is_file($file)) {
|
||||
|
@ -380,7 +380,7 @@ class Mail
|
|||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function setMessage(string $message): self
|
||||
public function setMessage(string $message): Mail
|
||||
{
|
||||
$this->message = \str_replace("\0", $this->EOL,
|
||||
\str_replace(["\r\n", "\n", "\r"], "\0",
|
||||
|
|
|
@ -68,9 +68,9 @@ class Parser extends Parserus
|
|||
*
|
||||
* @param array $bb
|
||||
*
|
||||
* @return Parser
|
||||
* @return Parserus
|
||||
*/
|
||||
public function addBBCode(array $bb): self
|
||||
public function addBBCode(array $bb): Parserus
|
||||
{
|
||||
if ('quote' == $bb['tag']) {
|
||||
$bb['self nesting'] = (int) $this->c->config->o_quote_depth;
|
||||
|
|
|
@ -104,7 +104,7 @@ class Validator
|
|||
*
|
||||
* @return Validator
|
||||
*/
|
||||
public function reset(): self
|
||||
public function reset(): Validator
|
||||
{
|
||||
$this->validators = [
|
||||
'absent' => [$this, 'vAbsent'],
|
||||
|
@ -147,7 +147,7 @@ class Validator
|
|||
*
|
||||
* @return Validator
|
||||
*/
|
||||
public function addValidators(array $validators): self
|
||||
public function addValidators(array $validators): Validator
|
||||
{
|
||||
$this->validators = \array_replace($this->validators, $validators);
|
||||
|
||||
|
@ -163,7 +163,7 @@ class Validator
|
|||
*
|
||||
* @return Validator
|
||||
*/
|
||||
public function addRules(array $list): self
|
||||
public function addRules(array $list): Validator
|
||||
{
|
||||
foreach ($list as $field => $raw) {
|
||||
$suffix = null;
|
||||
|
@ -213,7 +213,7 @@ class Validator
|
|||
*
|
||||
* @return Validator
|
||||
*/
|
||||
public function addArguments(array $arguments): self
|
||||
public function addArguments(array $arguments): Validator
|
||||
{
|
||||
$this->arguments = \array_replace($this->arguments, $arguments);
|
||||
|
||||
|
@ -227,7 +227,7 @@ class Validator
|
|||
*
|
||||
* @return Validator
|
||||
*/
|
||||
public function addMessages(array $messages): self
|
||||
public function addMessages(array $messages): Validator
|
||||
{
|
||||
$this->messages = \array_replace($this->messages, $messages);
|
||||
|
||||
|
@ -241,7 +241,7 @@ class Validator
|
|||
*
|
||||
* @return Validator
|
||||
*/
|
||||
public function addAliases(array $aliases): self
|
||||
public function addAliases(array $aliases): Validator
|
||||
{
|
||||
$this->aliases = \array_replace($this->aliases, $aliases);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class Action
|
|||
*
|
||||
* @return Action
|
||||
*/
|
||||
public function setManager(ManagerModel $manager): self
|
||||
public function setManager(ManagerModel $manager): Action
|
||||
{
|
||||
$this->manager = $manager;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return AdminList\Model
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Model
|
||||
{
|
||||
if ($this->c->Cache->has('admins')) {
|
||||
$this->list = $this->c->Cache->get('admins');
|
||||
|
@ -28,7 +28,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return AdminList\Model
|
||||
*/
|
||||
public function reset(): self
|
||||
public function reset(): Model
|
||||
{
|
||||
$this->c->Cache->delete('admins');
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return BanList\Model
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Model
|
||||
{
|
||||
if ($this->c->Cache->has('banlist')) {
|
||||
$list = $this->c->Cache->get('banlist');
|
||||
|
|
|
@ -20,7 +20,7 @@ class Manager extends ManagerModel
|
|||
*
|
||||
* @return Manager
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Manager
|
||||
{
|
||||
$query = 'SELECT c.id, c.cat_name, c.disp_position
|
||||
FROM ::categories AS c
|
||||
|
@ -36,7 +36,7 @@ class Manager extends ManagerModel
|
|||
return $this->repository;
|
||||
}
|
||||
|
||||
public function set($key, $value): self
|
||||
public function set($key, $value): ManagerModel
|
||||
{
|
||||
if (! isset($value['cat_name'], $value['disp_position'])) {
|
||||
throw new InvalidArgumentException('Expected array with cat_name and disp_position elements');
|
||||
|
@ -57,7 +57,7 @@ class Manager extends ManagerModel
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function update(): self
|
||||
public function update(): Manager
|
||||
{
|
||||
foreach ($this->modified as $key => $value) {
|
||||
$cat = $this->get($key);
|
||||
|
@ -101,7 +101,7 @@ class Manager extends ManagerModel
|
|||
return $cid;
|
||||
}
|
||||
|
||||
public function delete(int $cid): self
|
||||
public function delete(int $cid): Manager
|
||||
{
|
||||
$root = $this->c->forums->get(0);
|
||||
$del = [];
|
||||
|
|
|
@ -11,7 +11,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return Censorship\Model
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Model
|
||||
{
|
||||
if ('1' == $this->c->config->o_censoring) {
|
||||
if ($this->c->Cache->has('censorship')) {
|
||||
|
|
|
@ -11,7 +11,7 @@ class Model extends DataModel
|
|||
*
|
||||
* @return Config\Model
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Model
|
||||
{
|
||||
if ($this->c->Cache->has('config')) {
|
||||
$this->setAttrs($this->c->Cache->get('config'));
|
||||
|
|
|
@ -11,7 +11,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return DBMap\Model
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Model
|
||||
{
|
||||
if ($this->c->Cache->has('db_map')) {
|
||||
$this->setAttrs($this->c->Cache->get('db_map'));
|
||||
|
@ -29,7 +29,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return DBMap\Model
|
||||
*/
|
||||
public function reset(): self
|
||||
public function reset(): Model
|
||||
{
|
||||
$this->c->Cache->delete('db_map');
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ class DataModel extends Model
|
|||
*
|
||||
* @param array $attrs
|
||||
*
|
||||
* @return DataModel
|
||||
* @return Model
|
||||
*/
|
||||
public function setAttrs(array $attrs): self
|
||||
public function setAttrs(array $attrs): Model
|
||||
{
|
||||
$this->zModFlags = [];
|
||||
$this->zTrackFlags = [];
|
||||
|
@ -44,7 +44,7 @@ class DataModel extends Model
|
|||
*
|
||||
* @return DataModel
|
||||
*/
|
||||
public function replAttrs(array $attrs, bool $setFlags = false): self
|
||||
public function replAttrs(array $attrs, bool $setFlags = false): DataModel
|
||||
{
|
||||
foreach ($attrs as $name => $value) {
|
||||
$this->__set($name, $value);
|
||||
|
|
|
@ -34,7 +34,7 @@ class Manager extends ManagerModel
|
|||
*
|
||||
* @return Manager
|
||||
*/
|
||||
public function init(Group $group = null): self
|
||||
public function init(Group $group = null): Manager
|
||||
{
|
||||
if (null === $group) {
|
||||
$gid = $this->c->user->group_id;
|
||||
|
|
|
@ -35,7 +35,7 @@ class Manager extends ManagerModel
|
|||
*
|
||||
* @return Manager
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Manager
|
||||
{
|
||||
if (empty($this->flag)) {
|
||||
$query = 'SELECT g.*
|
||||
|
|
|
@ -16,7 +16,7 @@ class ManagerModel extends Model
|
|||
return $this->repository[$key] ?? null;
|
||||
}
|
||||
|
||||
public function set($key, $value): self
|
||||
public function set($key, $value): ManagerModel
|
||||
{
|
||||
$this->repository[$key] = $value;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class Method
|
|||
*
|
||||
* @return Method
|
||||
*/
|
||||
public function setModel(Model $model): self
|
||||
public function setModel(Model $model): Method
|
||||
{
|
||||
$this->model = $model;
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class Model
|
|||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function setAttr(string $name, $value): self
|
||||
public function setAttr(string $name, $value): Model
|
||||
{
|
||||
$this->unsetCalc($name);
|
||||
$this->zAttrs[$name] = $value;
|
||||
|
@ -122,7 +122,7 @@ class Model
|
|||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function setAttrs(array $attrs): self
|
||||
public function setAttrs(array $attrs): Model
|
||||
{
|
||||
$this->zAttrs = $attrs; //????
|
||||
$this->zAttrsCalc = [];
|
||||
|
|
|
@ -30,7 +30,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return Online\Model
|
||||
*/
|
||||
public function calc(Page $page): self
|
||||
public function calc(Page $page): Model
|
||||
{
|
||||
if ($this->done) {
|
||||
return $this;
|
||||
|
|
|
@ -256,7 +256,7 @@ abstract class Page extends Model
|
|||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function addStyle(string $name, string $value): self
|
||||
public function addStyle(string $name, string $value): Page
|
||||
{
|
||||
$attr = $this->getAttr('pageHeaders', []);
|
||||
$attr['style'][$name] = $value;
|
||||
|
@ -274,7 +274,7 @@ abstract class Page extends Model
|
|||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function header(string $key, string $value, bool $replace = true): self
|
||||
public function header(string $key, string $value, bool $replace = true): Page
|
||||
{
|
||||
if ('HTTP/' === \substr($key, 0, 5)) {
|
||||
if (
|
||||
|
@ -319,7 +319,7 @@ abstract class Page extends Model
|
|||
*
|
||||
* @return Page
|
||||
*/
|
||||
protected function httpStatus(): self
|
||||
protected function httpStatus(): Page
|
||||
{
|
||||
$list = [
|
||||
403 => '403 Forbidden',
|
||||
|
|
|
@ -19,7 +19,7 @@ class Profile extends Rules
|
|||
*
|
||||
* @return Rules\Profile
|
||||
*/
|
||||
public function setUser(User $curUser): self
|
||||
public function setUser(User $curUser): Profile
|
||||
{
|
||||
$this->setAttrs([]);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class Users extends Rules
|
|||
*
|
||||
* @return Rules\Users
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Users
|
||||
{
|
||||
$this->setAttrs([]);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return SmileyList\Model
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Model
|
||||
{
|
||||
if ($this->c->Cache->has('smilies')) {
|
||||
$this->list = $this->c->Cache->get('smilies');
|
||||
|
|
|
@ -12,7 +12,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return Models\Stats
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Model
|
||||
{
|
||||
if ($this->c->Cache->has('stats')) {
|
||||
$list = $this->c->Cache->get('stats');
|
||||
|
@ -36,7 +36,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return Models\Stats
|
||||
*/
|
||||
public function reset(): self
|
||||
public function reset(): Model
|
||||
{
|
||||
$this->c->Cache->delete('stats');
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return Stopwords\Model
|
||||
*/
|
||||
public function init(): self
|
||||
public function init(): Model
|
||||
{
|
||||
$data = $this->c->Cache->get('stopwords');
|
||||
if (
|
||||
|
@ -58,7 +58,7 @@ class Model extends ParentModel
|
|||
*
|
||||
* @return Stopwords\Model
|
||||
*/
|
||||
protected function load(): self
|
||||
protected function load(): Model
|
||||
{
|
||||
$id = $this->generateId();
|
||||
|
||||
|
|
Loading…
Reference in a new issue