No description
Find a file
2025-06-19 14:27:27 +02:00
.github/workflows ci: update workflows 2025-06-18 17:55:14 +02:00
src style: enforce no_whitespace_in_blank_line 2025-06-18 17:34:42 +02:00
.gitignore ignore changed cache dir 2021-10-26 21:17:54 +02:00
.php-cs-fixer.dist.php use php-cs-fixer ^3.2 2021-10-26 21:13:58 +02:00
CHANGELOG.md chore: update changelog 2025-06-19 11:41:29 +02:00
composer.json ci: update workflows 2025-06-18 17:55:14 +02:00
LICENSE Initial commit 2020-03-27 16:13:13 +01:00
README.md fix(docs): Update old file name in readme 2024-02-01 15:39:16 +01:00

Nextcloud Coding Standard

Nextcloud coding standards for the php cs fixer.

Installation

Add the package to your dev dependencies

composer require --dev nextcloud/coding-standard

and create a .php-cs-fixer.dist.php like

<?php

declare(strict_types=1);

require_once './vendor/autoload.php';

use Nextcloud\CodingStandard\Config;

$config = new Config();
$config
	->getFinder()
	->ignoreVCSIgnored(true)
	->notPath('build')
	->notPath('l10n')
	->notPath('src')
	->notPath('vendor')
	->in(__DIR__);
return $config;

To run the fixer you first have to install it. Then you can run php-cs-fixer fix to apply all automated fixes.

For convenience you may add it to the scripts section of your composer.json:

{
    "scripts": {
        "cs:check": "php-cs-fixer fix --dry-run --diff",
        "cs:fix": "php-cs-fixer fix"
    }
}

Note: Don't forget to exclude .php-cs-fixer.dist.php and .php-cs-fixer.cache in your build scripts.

Upgrade from v0.x to v1.0

With v1.0 php-cs-fixer was updated from v2 to v3. You'll have to adjust your app slightly:

  • Rename .php_cs.dist to .php-cs-fixer.dist.php
  • Add .php-cs-fixer.cache to your ignore files