Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save erdemkeren/b06ca862400d15fa2041cf6c78c1c06e to your computer and use it in GitHub Desktop.
Save erdemkeren/b06ca862400d15fa2041cf6c78c1c06e to your computer and use it in GitHub Desktop.
Preliminary Information For the Presentation on Friday

Context

We're planning to show a presentation about the coding standards on Friday at 13:00.

This document includes preliminary information about the coding style additions we're going to propose.

Current Standards

We're following PSR-2 at the moment.

Currrent Situation

While PHP-FIG PSR-2 provides a good framework for the coding style guidelines, there are still some cases which are not covered by their rules.

E.g.:

public function logicalNot(bool $bool): bool
{
    return !$bool; // valid for PSR2
}


public function logicalNot(bool $bool): bool
{
    return ! $bool; // valid for PSR2
}

Improvement Proposal

Inherit a more strict coding style ruleset, symfony, so that all of us meet in a common ground.

E.g.:

public function logicalNot(bool $bool): bool
{
    return ! $bool; // Invalid for symfony.
}

You could check the following link to see an example that presents the most of the symfony styling rules:

https://symfony.com/doc/current/contributing/code/standards.html

You can also go to:

PHPStorm Preferences->Editor->Code Style->PHP use the Set from... menu to switch between popular coding style guidelines and compare them yourself.

See also:

https://mlocati.github.io/php-cs-fixer-configurator/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment