0

Zend_Date_DateObject がタイムスタンプ プロパティを返す前にその型をチェックする理由 (および int または string にキャストする理由) を誰かが説明できますか?

    protected function getTimestamp()
    {
        if ($this->_unixTimestamp === intval($this->_unixTimestamp)) {
            return (int) $this->_unixTimestamp;
        } else {
            return (string) $this->_unixTimestamp;
        }
    }

これはかなり奇妙に思えますが、これには何らかの論理があるに違いありません??

4

1 に答える 1

0

彼らのsvnログによると:

> svn log http://framework.zend.com/svn/framework -r 2773
------------------------------------------------------------------------
r2773 | gavin | 2007-01-15 19:22:51 +0200 (Mon, 15 Jan 2007) | 5 lines

* consistency updates
* bug fixes
* updates for DateObject unit tests to work with recent changes
  (10 Errors, 3 Failures yet to fix)

------------------------------------------------------------------------

この (string/int) 動作を実行するいくつかのテストが追加されました。したがって、これは単にユニットテストが準拠するためのものだと言えます。

于 2012-08-21T07:38:00.250 に答える