From c8745692ad2a4a7527f949380b2110f567714c5e Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Fri, 17 Feb 2023 06:25:29 -0800 Subject: [PATCH] Add a `composer phpcbf` command (#161) --- bin/run-phpcbf-cleanup | 7 +++++++ composer.json | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 bin/run-phpcbf-cleanup diff --git a/bin/run-phpcbf-cleanup b/bin/run-phpcbf-cleanup new file mode 100644 index 00000000..f7a4d8fb --- /dev/null +++ b/bin/run-phpcbf-cleanup @@ -0,0 +1,7 @@ +#!/bin/sh + +# Run the code style check only if a configuration file exists. +if [ -f ".phpcs.xml" ] || [ -f "phpcs.xml" ] || [ -f ".phpcs.xml.dist" ] || [ -f "phpcs.xml.dist" ] +then + vendor/bin/phpcbf "$@" +fi diff --git a/composer.json b/composer.json index f3e2b6b0..86a9ff2e 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ ], "homepage": "https://wp-cli.org", "license": "MIT", - "type" : "phpcodesniffer-standard", + "type": "phpcodesniffer-standard", "require": { "php": ">=5.6", "behat/behat": "^3.7", @@ -60,13 +60,15 @@ "bin/run-behat-tests", "bin/run-linter-tests", "bin/run-php-unit-tests", - "bin/run-phpcs-tests" + "bin/run-phpcs-tests", + "bin/run-phpcbf-cleanup" ], "scripts": { "behat": "run-behat-tests", "behat-rerun": "rerun-behat-tests", "lint": "run-linter-tests", "phpcs": "run-phpcs-tests", + "phpcbf": "run-phpcbf-cleanup", "phpunit": "run-php-unit-tests", "prepare-tests": "install-package-tests", "test": [