2017 © Pedro PelĂĄez
 

library magento2-smilelab-phpcs

PHPCS Coding standards for Smile Lab Magento2 community projects.

image

smile/magento2-smilelab-phpcs

PHPCS Coding standards for Smile Lab Magento2 community projects.

  • Wednesday, July 5, 2017
  • by afoucret
  • Repository
  • 5 Watchers
  • 1 Stars
  • 8,322 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 17 % Grown

The README.md

Smile Lab PHPCS Coding Standard

Description

This coding standard is meant to be used on Magento projects and modules., (*1)

It uses the following rulesets:, (*2)

Installation

To use this ruleset, require it in composer:, (*3)

composer require --dev smile/magento2-smilelab-phpcs

Rulesets

Two rulesets are available:, (*4)

  • SmileLab (Magento >=2.4.4)
  • SmileLab-237-243 (Magento >=2.3.7 <2.4.4)

Older versions of Magento (<2.4.4) require a separate ruleset, because they use an outdated version of the Magento coding standard., (*5)

Configuration

Create a configuration file namedphpcs.xml.dist at the root of your project., (*6)

Example for a Magento project:, (*7)

<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

    <arg name="basepath" value="."/>
    <arg name="extensions" value="php,phtml"/>
    <arg name="colors"/>
    <arg value="p"/>
    <arg value="s"/>

    <rule ref="SmileLab"/>

    <file>app/code</file>
    <file>app/design</file>
</ruleset>

Example for a community module:, (*8)


<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

    <arg name="basepath" value="."/>
    <arg name="extensions" value="php,phtml"/>
    <arg name="colors"/>
    <arg value="p"/>
    <arg value="s"/>

    <config name="php_version" value="{{min_php_version}}"/>

    <rule ref="SmileLab"/>

    <file>.</file>
    <exclude-pattern>vendor/*</exclude-pattern>
</ruleset>

Where {{min_php_version}} is the minimum compatible version of PHP required by your module. For example, if the min version is PHP 7.4:, (*9)

<config name="php_version" value="70400"/>

Usage

You can run phpcs with this command:, (*10)

vendor/bin/phpcs --extensions=php,phtml

You can fix most of the errors found with:, (*11)

vendor/bin/phpcbf --extensions=php,phtml

Guidelines

If your class overrides a method declared in a parent class, use @inheritdoc:, (*12)

/**
 * @inheritdoc
 */
public function execute(InputInterface $input, OutputInterface $output): int
{
    // ...
}

The Versions

05/07 2017

dev-master

9999999-dev https://github.com/Smile-SA/magento2-smilelab-phpcs

PHPCS Coding standards for Smile Lab Magento2 community projects.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

by Aurélien FOUCRET
by Romain Ruaud

phpcs php coding standards

05/07 2017

1.0.5

1.0.5.0 https://github.com/Smile-SA/magento2-smilelab-phpcs

PHPCS Coding standards for Smile Lab Magento2 community projects.

  Sources   Download

OSL-3.0

The Requires

 

by Aurélien FOUCRET
by Romain Ruaud

phpcs php coding standards

05/07 2017

1.0.4

1.0.4.0 https://github.com/Smile-SA/magento2-smilelab-phpcs

PHPCS Coding standards for Smile Lab Magento2 community projects.

  Sources   Download

OSL-3.0

The Requires

 

by Aurélien FOUCRET
by Romain Ruaud

phpcs php coding standards

05/07 2017

1.0.3

1.0.3.0 https://github.com/Smile-SA/magento2-smilelab-phpcs

PHPCS Coding standards for Smile Lab Magento2 community projects.

  Sources   Download

OSL-3.0

The Requires

 

by Aurélien FOUCRET
by Romain Ruaud

phpcs php coding standards

05/07 2017

1.0.2

1.0.2.0 https://github.com/Smile-SA/magento2-smilelab-phpcs

PHPCS Coding standards for Smile Lab Magento2 community projects.

  Sources   Download

OSL-3.0

The Requires

 

by Aurélien FOUCRET
by Romain Ruaud

phpcs php coding standards

16/03 2017

1.0.1

1.0.1.0 https://github.com/Smile-SA/magento2-smilelab-phpcs

PHPCS Coding standards for Smile Lab Magento2 community projects.

  Sources   Download

OSL-3.0

The Development Requires

by Aurélien FOUCRET
by Romain Ruaud

phpcs php coding standards

25/01 2017

1.0.0

1.0.0.0 https://github.com/Smile-SA/magento2-smilelab-phpcs

PHPCS Coding standards for Smile Lab Magento2 community projects.

  Sources   Download

OSL-3.0

The Development Requires

by Aurélien FOUCRET
by Romain Ruaud

phpcs php coding standards