phattarachai/thaidate

View on GitHub
src/Thaidate.php

Summary

Maintainability
A
30 mins
Test Coverage

Avoid too many return statements within this method.
Open

        return $format;
Severity: Major
Found in src/Thaidate.php - About 30 mins to fix

    Argument 2 (replace) is int but \str_replace() takes array|string
    Open

                return str_replace('y', $year, $format);
    Severity: Minor
    Found in src/Thaidate.php by phan

    Argument 2 (replace) is float|int but \str_replace() takes array|string
    Open

                return str_replace('o', (date('o', $timestamp) + 543), $format);
    Severity: Minor
    Found in src/Thaidate.php by phan

    When fetching an array index from a value of type array{0:'อา.',1:'จ.',2:'อ.',3:'พ.',4:'พฤ.',5:'ศ.',6:'ส.'}, found an array index of type false|string, but expected the index to be of type int
    Open

                return str_replace('D', $this->shortDays[$this->dayNum($timestamp)], $format);
    Severity: Minor
    Found in src/Thaidate.php by phan

    Doc-block of monthNum contains declared return type string which is incompatible with the return type int declared in the signature
    Open

         * @return false|int|string
    Severity: Minor
    Found in src/Thaidate.php by phan

    When fetching an array index from a value of type array{0:'อาทิตย์',1:'จันทร์',2:'อังคาร',3:'พุธ',4:'พฤหัสบดี',5:'ศุกร์',6:'เสาร์'}, found an array index of type false|string, but expected the index to be of type int
    Open

                return str_replace('l', $this->longDays[$this->dayNum($timestamp)], $format);
    Severity: Minor
    Found in src/Thaidate.php by phan

    Doc-block of monthNum contains declared return type false which is incompatible with the return type int declared in the signature
    Open

         * @return false|int|string
    Severity: Minor
    Found in src/Thaidate.php by phan

    Argument 2 (replace) is float|int but \str_replace() takes array|string
    Open

                return str_replace('Y', (date('Y', $timestamp) + 543), $format);
    Severity: Minor
    Found in src/Thaidate.php by phan

    The closing brace for the class must go on the next line after the body
    Open

    }
    Severity: Minor
    Found in src/Thaidate.php by phpcodesniffer

    Blank line found at start of control structure
    Open

            if (str_contains($format, 'y')) {
    Severity: Minor
    Found in src/Thaidate.php by phpcodesniffer

    Line exceeds 120 characters; contains 123 characters
    Open

         * @param string $format The format as same as PHP date function format. See http://php.net/manual/en/function.date.php
    Severity: Minor
    Found in src/Thaidate.php by phpcodesniffer

    Line exceeds 120 characters; contains 172 characters
    Open

        public $longDays = ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'];
    Severity: Minor
    Found in src/Thaidate.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status