PHPackages                             wieni/wmcodestyle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. wieni/wmcodestyle

ActiveApplication

wieni/wmcodestyle
=================

A set of Wieni best practices, coding standards and tools to enforce them.

1.10.1(2y ago)38.1k↓100%2[2 issues](https://github.com/wieni/wmcodestyle/issues)20MITPHPPHP ^7.1 || ^8.0CI failing

Since Dec 17Pushed 2y ago6 watchersCompare

[ Source](https://github.com/wieni/wmcodestyle)[ Packagist](https://packagist.org/packages/wieni/wmcodestyle)[ RSS](/packages/wieni-wmcodestyle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (9)Versions (21)Used By (20)

wmcodestyle
===========

[](#wmcodestyle)

[![Latest Stable Version](https://camo.githubusercontent.com/05436da111f3aa9b0b8bd4f89b63cd5f1053ec99d0860fa7db1fc1311501c358/68747470733a2f2f706f7365722e707567782e6f72672f7769656e692f776d636f64657374796c652f762f737461626c65)](https://packagist.org/packages/wieni/wmcodestyle)[![Total Downloads](https://camo.githubusercontent.com/3b6c6e663a7c5454ab9b29c16e8dcfee6f7741abef3c1513d68c47b1a04383cb/68747470733a2f2f706f7365722e707567782e6f72672f7769656e692f776d636f64657374796c652f646f776e6c6f616473)](https://packagist.org/packages/wieni/wmcodestyle)[![License](https://camo.githubusercontent.com/6f730509b391b253f8377945d8e357e139d74740c4a28bb2a2f258280f2ca31c/68747470733a2f2f706f7365722e707567782e6f72672f7769656e692f776d636f64657374796c652f6c6963656e7365)](https://packagist.org/packages/wieni/wmcodestyle)

> A set of Wieni best practices, coding standards and tools to enforce them.

Why?
----

[](#why)

- A central location to keep track of our written coding standards and best practices
- Make configuration for tools to enforce our codestyle available in all of our repositories, without having to duplicate and sync them manually

Table of Contents
-----------------

[](#table-of-contents)

1. [Coding standards](#coding-standards-and-best-practices)
2. [Tooling](#tooling)
    - [Installation](#installation)
    - [Sync config files with your project](#sync-config-files-with-your-project)
    - [PHP-CS-Fixer](#php-cs-fixerhttpgithubcomfriendsofphpphp-cs-fixer)
    - [Rector](#rectorhttpsgithubcomrectorphprector)
    - [PHPStan](#phpstanhttpsgithubcomphpstanphpstan)
    - [composer-normalize](#composer-normalizehttpsgithubcomergebniscomposer-normalize)
    - [Running code style fixers](#running-code-style-fixers)
3. [Changelog](#changelog)
4. [Security](#security)
5. [License](#license)
6. [Acknowledgments](#acknowledgments)

Coding standards
----------------

[](#coding-standards)

- [General](standards/GENERAL.md)
- [Drupal modules](standards/DRUPAL_MODULES.md)
- [Model–view–controller (and presenter)](standards/MVC.md)
- [Git](standards/GIT.md)

Tooling
-------

[](#tooling)

### Installation

[](#installation)

This package requires PHP 7.1 or higher and can be installed using Composer:

```
 composer require --dev wieni/wmcodestyle
```

### Sync config files with your project

[](#sync-config-files-with-your-project)

This package provides a command to sync any file from this repository to your project. It is recommended to add it to the `scripts` section of composer.json so it is automatically executed at the appropriate time.

```
 {
   "name": "foo/bar",
   "require": {
     "php": "^8.0",
   },
   "require-dev": {
     "wieni/wmcodestyle": "^1.0"
+  },
+  "scripts": {
+    "post-update-cmd": [
+      "wmcodestyle sync .editorconfig --quiet"
+    ]
   }
 }
```

### [PHP-CS-Fixer](http://github.com/FriendsOfPHP/PHP-CS-Fixer)

[](#php-cs-fixer)

This package provides a configuration factory and multiple rule sets for [`friendsofphp/php-cs-fixer`](http://github.com/FriendsOfPHP/PHP-CS-Fixer).

#### Configuration

[](#configuration)

Pick one of the rule sets:

- [`Wieni\wmcodestyle\PhpCsFixer\Config\RuleSet\Php71`](src/PhpCsFixer/Config/RuleSet/Php71.php)
- [`Wieni\wmcodestyle\PhpCsFixer\Config\RuleSet\Php73`](src/PhpCsFixer/Config/RuleSet/Php73.php)
- [`Wieni\wmcodestyle\PhpCsFixer\Config\RuleSet\Php74`](src/PhpCsFixer/Config/RuleSet/Php74.php)
- [`Wieni\wmcodestyle\PhpCsFixer\Config\RuleSet\Php80`](src/PhpCsFixer/Config/RuleSet/Php80.php)

Create a configuration file `.php_cs.php` in the root of your project:

```
