5

是否有 php 的框架或库可以帮助我在我的应用程序中实现合同设计?

在最好的情况下,它会在注释中使用 javadoc 之类的注释。

4

3 回答 3

4

我已经开始从事按合同设计的项目PHP-Contracts

还有一些关于这个主题的博客文章:

于 2011-09-21T21:18:59.803 回答
1

基于面向方面编程的 PHP 新 DbC 框架:https ://github.com/lisachenko/php-deal

/**
 * Simple trade account contract
 */
interface AccountContract
{
    /**
     * Deposits fixed amount of money to the account
     *
     * @param float $amount
     *
     * @Contract\Verify("$amount>0 && is_numeric($amount)")
     * @Contract\Ensure("$this->balance == $__old->balance+$amount")
     */
    public function deposit($amount);

    /**
     * Returns current balance
     *
     * @Contract\Ensure("$__result == $this->balance")
     *
     * @return float
     */
    public function getBalance();
}
于 2014-02-04T07:39:31.973 回答
0

会是类似http://code.google.com/p/addendum/的东西吗?

于 2011-05-06T08:22:56.620 回答