Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP-CS-Fixer: how to remove header DocBlock comments

Tags:

php

By mistake I've added DocBlock comments to my files:

/**
 * @author      My Name <[email protected]>
 * @copyright   Copyright (C) 2012 - 2015 My App. All rights reserved.
 * @license     Some notes about the license.
 */

But this si wrong as I want the header comments set like those:

/*
 * This file is part of the My App.
 *
 * Copyright My Name 2012-2016.
 *
 * This code is to consider private and non disclosable to anyone for whatever reason.
 * Every right on this code is reserved.
 *
 * @author My name <[email protected]>
 */

Now, I've added the header comment using PHP-CS-Fixer but now, how can I remove the old ones?

like image 538
Aerendir Avatar asked Oct 23 '25 10:10

Aerendir


1 Answers

Using friendsofphp/php-cs-fixer:^2.0.0, the header comment can be removed entirely using the following configuration:

$config = PhpCsFixer\Config::create()->setRules([
    'header_comment' => [
        'header' => '',
    ],
]);

Note how we provide an empty string.

like image 100
localheinz Avatar answered Oct 26 '25 00:10

localheinz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!