Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Из гитлаба #1

Open
drabodan opened this issue Mar 12, 2021 · 0 comments
Open

Из гитлаба #1

drabodan opened this issue Mar 12, 2021 · 0 comments
Assignees

Comments

@drabodan
Copy link
Member

(21) Comment phpcs error

case 'personandorganization':
               // Find or create company
                if (!empty($sendFields['organization'])) {
                    $organizationID = self::findOrCreateOrganization($sendFields);

                    // Set organization for deal
                    if ($organizationID) {
                        $sendFields['person']['org_id'] = $organizationID;
                    }
                }

                // Find or create person
                if (!empty($sendFields['person'])) {
                    $personID = self::findOrCreatePerson($sendFields);
                }
                break;

(14) Remove reference to values after foreach loop
Valid:

$arr = array(1, 2, 3, 4);

foreach ($arr as &$value) {
    $value = $value * 2;
}

unset($value);

See: http://php.net/manual/ru/control-structures.foreach.php, https://www.toptal.com/php/10-most-common-mistakes-php-programmers-make
(13) Compact with https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
(12) Evaluation http://edorian.github.io/php-coding-standard-generator/
(11) Evaluation https://github.com/php-fig-rectified/psr2r-sniffer
(10) Evaluation https://styleci.readme.io/v1.0/docs/fixers project
(9) Evaluation ArrayAssignmentRestrictions sniff.
Sniff contain inside WordPress-Coding-Standards.
(8) New sniff: YodaConditions.
(6) New rule: RegExpDelimitersSniff.
https://secure.php.net/manual/ru/regexp.reference.delimiters.php
(4) New rule: FunctionSpacing.
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/WhiteSpace/FunctionSpacingSniff.php
(3) New rule: PreferDoubleQuote.
(2) New rule: ScopePropertiesOrder.
As ScopeMethodsOrder
(19) Add options whitelist function to EscapeOutputSniff and don't lint all build-in function return not string
Example: rand
(15) ConstrolSignature - Newline before close brace

if (is_array($slug)) {
        
    } elseif (is_string($slug)) {
        $templates[] = $slug . '.php';
    } else {
        throw new Exception('Name template part must be string or array.');
    }

(16) Sniffs ForbiddenFunctions for class and methods
(17) Best function for escaping instead htmlspecialchars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants