nekoos/php-property-decorator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nekoos/php-property-decorator

Composer 安装命令:

composer require nekoos/php-property-decorator

包简介

Simple manager for

README 文档

README

Properties combine aspects of both fields and methods. To the user of an object, a property appears to be a field, accessing the property requires the same syntax. To the implementer of a class, a property is one or two code blocks, representing a get accessor and/or a set accessor.

Installation

composer require "nekoos/php-property-decorator:dev-master"

Usage

General use

This library provides your with a built-in @property decorator as DocBlock which makes use of getter and setters much easier in Object-Oriented Programming.

use NekoOs\Decorator\Concerns\HasDecoratorProperties;

require_once "vendor/autoload.php";
/**
 * @property int $age {read getAge} {write setAge}
 */
class SomeClass
{
    use HasDecoratorProperties;

    private $age;

    public function getAge() : int
    {
        return $this->age;
    }

    public function setAge(int $value): void
    {
        $this->age= $value;
    }
}

$someClass = new SomeClass();

$someClass->age = '33';

var_dump($someClass->age);      # int(33)

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固