Add PHP_CodeSniffer tooling

This commit is contained in:
Sebastian Meyer 2024-01-23 17:56:19 +01:00
parent f832b58a3e
commit 9832946b35
4 changed files with 16 additions and 11 deletions

1
.gitignore vendored
View File

@ -2,4 +2,5 @@
/vendor/
.php-cs-fixer.php
composer.lock
phpcs.xml
phpstan.neon

View File

@ -1,8 +1,8 @@
<?php
/**
* Useful PHP Basics
* Copyright (C) 2023 Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
* PHP Basics
* Copyright (C) 2024 Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -11,11 +11,11 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
@ -30,9 +30,5 @@ namespace PhpCsFixer;
*/
return (new Config())
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true,
])
->setFinder(
(new Finder())->in(__DIR__)
);
->setRules(['@PSR12' => true])
->setFinder((new Finder())->in(__DIR__));

View File

@ -37,7 +37,8 @@
"require-dev": {
"phpstan/phpstan": "^1.10.56",
"phpstan/phpstan-strict-rules": "^1.5",
"friendsofphp/php-cs-fixer": "^3.48"
"friendsofphp/php-cs-fixer": "^3.48",
"squizlabs/php_codesniffer": "^3.8"
},
"autoload": {
"psr-4": {

7
phpcs.xml.dist Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<ruleset name="OCC Standard Ruleset">
<description>Open Culture Consulting strictly follows PSR standards.</description>
<file>./src</file>
<arg name="extensions" value="php"/>
<rule ref="PSR12"/>
</ruleset>