Skip to content

Commit 730a4e6

Browse files
authored
docs: Remove $ from console command snippets in documentation (#6599)
1 parent e338674 commit 730a4e6

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

doc/cookbook_fixers.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ Execute the following command in your command shell:
279279

280280
.. code-block:: console
281281
282-
$ php dev-tools/doc.php
282+
php dev-tools/doc.php
283283
284284
Next, we must filter what type of tokens we want to fix. Here, we are interested in code that contains ``T_COMMENT`` tokens:
285285

@@ -319,7 +319,7 @@ For now, let us just make a fixer that applies no modification:
319319
}
320320
}
321321
322-
Run ``$ phpunit tests/Fixer/Comment/RemoveCommentsFixerTest.php``.
322+
Run ``phpunit tests/Fixer/Comment/RemoveCommentsFixerTest.php``.
323323
You are going to see that the tests fail.
324324

325325
Break
@@ -487,7 +487,7 @@ itself. Thus, on the command line call:
487487

488488
.. code-block:: console
489489
490-
$ php php-cs-fixer fix
490+
php php-cs-fixer fix
491491
492492
This will fix all the coding style mistakes.
493493

doc/installation.rst

+14-14
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@ your system:
2323

2424
.. code-block:: console
2525
26-
$ wget https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer
26+
wget https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer
2727
2828
or with specified version:
2929

3030
.. code-block:: console
3131
32-
$ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.0.1/php-cs-fixer.phar -O php-cs-fixer
32+
wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.0.1/php-cs-fixer.phar -O php-cs-fixer
3333
3434
or with curl:
3535

3636
.. code-block:: console
3737
38-
$ curl -L https://cs.symfony.com/download/php-cs-fixer-v3.phar -o php-cs-fixer
38+
curl -L https://cs.symfony.com/download/php-cs-fixer-v3.phar -o php-cs-fixer
3939
4040
then:
4141

4242
.. code-block:: console
4343
44-
$ sudo chmod a+x php-cs-fixer
45-
$ sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
44+
sudo chmod a+x php-cs-fixer
45+
sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
4646
4747
Then, just run ``php-cs-fixer``.
4848

@@ -53,20 +53,20 @@ To install PHP CS Fixer, `install Composer <https://getcomposer.org/download/>`_
5353

5454
.. code-block:: console
5555
56-
$ composer global require friendsofphp/php-cs-fixer
56+
composer global require friendsofphp/php-cs-fixer
5757
5858
Then make sure you have the global Composer binaries directory in your ``PATH``. This directory is platform-dependent, see `Composer documentation <https://getcomposer.org/doc/03-cli.md#composer-home>`_ for details. Example for some Unix systems:
5959

6060
.. code-block:: console
6161
62-
$ export PATH="$PATH:$HOME/.composer/vendor/bin"
62+
export PATH="$PATH:$HOME/.composer/vendor/bin"
6363
6464
Globally (homebrew)
6565
~~~~~~~~~~~~~~~~~~~
6666

6767
.. code-block:: console
6868
69-
$ brew install php-cs-fixer
69+
brew install php-cs-fixer
7070
7171
Locally (PHIVE)
7272
~~~~~~~~~~~~~~~
@@ -75,7 +75,7 @@ Install `PHIVE <https://phar.io>`_ and issue the following command:
7575

7676
.. code-block:: console
7777
78-
$ phive install php-cs-fixer # use `--global` for global install
78+
phive install php-cs-fixer # use `--global` for global install
7979
8080
Update
8181
------
@@ -87,7 +87,7 @@ The ``self-update`` command tries to update ``php-cs-fixer`` itself:
8787

8888
.. code-block:: console
8989
90-
$ php php-cs-fixer.phar self-update
90+
php php-cs-fixer.phar self-update
9191
9292
Globally (manual)
9393
~~~~~~~~~~~~~~~~~
@@ -96,7 +96,7 @@ You can update ``php-cs-fixer`` through this command:
9696

9797
.. code-block:: console
9898
99-
$ sudo php-cs-fixer self-update
99+
sudo php-cs-fixer self-update
100100
101101
Globally (Composer)
102102
~~~~~~~~~~~~~~~~~~~
@@ -105,7 +105,7 @@ You can update ``php-cs-fixer`` through this command:
105105

106106
.. code-block:: console
107107
108-
$ ./composer.phar global update friendsofphp/php-cs-fixer
108+
./composer.phar global update friendsofphp/php-cs-fixer
109109
110110
Globally (homebrew)
111111
~~~~~~~~~~~~~~~~~~~
@@ -114,13 +114,13 @@ You can update ``php-cs-fixer`` through this command:
114114

115115
.. code-block:: console
116116
117-
$ brew upgrade php-cs-fixer
117+
brew upgrade php-cs-fixer
118118
119119
Locally (PHIVE)
120120
~~~~~~~~~~~~~~~
121121

122122
.. code-block:: console
123123
124-
$ phive update php-cs-fixer
124+
phive update php-cs-fixer
125125
126126
.. _php-cs-fixer.phar: https://cs.symfony.com/download/php-cs-fixer-v3.phar

doc/usage.rst

+24-24
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ problems as possible on a given file or files in a given directory and its subdi
1010

1111
.. code-block:: console
1212
13-
$ php php-cs-fixer.phar fix /path/to/dir
14-
$ php php-cs-fixer.phar fix /path/to/file
13+
php php-cs-fixer.phar fix /path/to/dir
14+
php php-cs-fixer.phar fix /path/to/file
1515
1616
By default ``--path-mode`` is set to ``override``, which means, that if you specify the path to a file or a directory via
1717
command arguments, then the paths provided to a ``Finder`` in config file will be ignored. You can also use ``--path-mode=intersection``,
1818
which will use the intersection of the paths from the config file and from the argument:
1919

2020
.. code-block:: console
2121
22-
$ php php-cs-fixer.phar fix --path-mode=intersection /path/to/dir
22+
php php-cs-fixer.phar fix --path-mode=intersection /path/to/dir
2323
2424
The ``--format`` option for the output format. Supported formats are ``txt`` (default one), ``json``, ``xml``, ``checkstyle``, ``junit`` and ``gitlab``.
2525

@@ -45,34 +45,34 @@ project:
4545

4646
.. code-block:: console
4747
48-
$ php php-cs-fixer.phar fix /path/to/project --rules=@PSR12
48+
php php-cs-fixer.phar fix /path/to/project --rules=@PSR12
4949
5050
By default the ``PSR12`` rules are used. If the ``--rules`` option is used rules from config files are ignored.
5151

5252
The ``--rules`` option lets you choose the exact rules to apply (the rule names must be separated by a comma):
5353

5454
.. code-block:: console
5555
56-
$ php php-cs-fixer.phar fix /path/to/dir --rules=line_ending,full_opening_tag,indentation_type
56+
php php-cs-fixer.phar fix /path/to/dir --rules=line_ending,full_opening_tag,indentation_type
5757
5858
You can also exclude the rules you don't want by placing a dash in front of the rule name, if this is more convenient,
5959
using ``-name_of_fixer``:
6060

6161
.. code-block:: console
6262
63-
$ php php-cs-fixer.phar fix /path/to/dir --rules=-full_opening_tag,-indentation_type
63+
php php-cs-fixer.phar fix /path/to/dir --rules=-full_opening_tag,-indentation_type
6464
6565
When using combinations of exact and exclude rules, applying exact rules along with above excluded results:
6666

6767
.. code-block:: console
6868
69-
$ php php-cs-fixer.phar fix /path/to/project --rules=@Symfony,-@PSR1,-blank_line_before_statement,strict_comparison
69+
php php-cs-fixer.phar fix /path/to/project --rules=@Symfony,-@PSR1,-blank_line_before_statement,strict_comparison
7070
7171
Complete configuration for rules can be supplied using a ``json`` formatted string.
7272

7373
.. code-block:: console
7474
75-
$ php php-cs-fixer.phar fix /path/to/project --rules='{"concat_space": {"spacing": "none"}}'
75+
php php-cs-fixer.phar fix /path/to/project --rules='{"concat_space": {"spacing": "none"}}'
7676
7777
The ``--dry-run`` flag will run the fixer without making changes to your files.
7878

@@ -92,28 +92,28 @@ If the option is not provided, it defaults to ``dots`` unless a config file that
9292

9393
.. code-block:: console
9494
95-
$ php php-cs-fixer.phar fix --verbose --show-progress=estimating
95+
php php-cs-fixer.phar fix --verbose --show-progress=estimating
9696
9797
The command can also read from standard input, in which case it won't
9898
automatically fix anything:
9999

100100
.. code-block:: console
101101
102-
$ cat foo.php | php php-cs-fixer.phar fix --diff -
102+
cat foo.php | php php-cs-fixer.phar fix --diff -
103103
104104
Finally, if you don't need BC kept on CLI level, you might use `PHP_CS_FIXER_FUTURE_MODE` to start using options that
105105
would be default in next MAJOR release and to forbid using deprecated configuration:
106106

107107
.. code-block:: console
108108
109-
$ PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer.phar fix -v --diff
109+
PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer.phar fix -v --diff
110110
111111
The ``--dry-run`` option displays the files that need to be
112112
fixed but without actually modifying them:
113113

114114
.. code-block:: console
115115
116-
$ php php-cs-fixer.phar fix /path/to/code --dry-run
116+
php php-cs-fixer.phar fix /path/to/code --dry-run
117117
118118
By using ``--using-cache`` option with ``yes`` or ``no`` you can set if the caching
119119
mechanism should be used.
@@ -125,13 +125,13 @@ The ``list-files`` command will list all files which need fixing.
125125

126126
.. code-block:: console
127127
128-
$ php php-cs-fixer.phar list-files
128+
php php-cs-fixer.phar list-files
129129
130130
The ``--config`` option can be used, like in the ``fix`` command, to tell from which path a config file should be loaded.
131131

132132
.. code-block:: console
133133
134-
$ php php-cs-fixer.phar list-files --config=.php-cs-fixer.dist.php
134+
php php-cs-fixer.phar list-files --config=.php-cs-fixer.dist.php
135135
136136
The output is built in a form that its easy to use in combination with ``xargs`` command in a linux pipe.
137137
This can be useful e.g. in situations where the caching mechanism might not be available (CI, Docker) and distribute
@@ -141,7 +141,7 @@ Note: You need to pass the config to the ``fix`` command, in order to make it wo
141141

142142
.. code-block:: console
143143
144-
$ php php-cs-fixer.phar list-files --config=.php-cs-fixer.dist.php | xargs -n 10 -P 8 php php-cs-fixer.phar fix --config=.php-cs-fixer.dist.php --path-mode intersection -v
144+
php php-cs-fixer.phar list-files --config=.php-cs-fixer.dist.php | xargs -n 10 -P 8 php php-cs-fixer.phar fix --config=.php-cs-fixer.dist.php --path-mode intersection -v
145145
146146
* ``-n`` defines how many files a single subprocess process
147147
* ``-P`` defines how many subprocesses the shell is allowed to spawn for parallel processing (usually similar to the number of CPUs your system has)
@@ -154,13 +154,13 @@ Use the following command to quickly understand what a rule will do to your code
154154

155155
.. code-block:: console
156156
157-
$ php php-cs-fixer.phar describe align_multiline_comment
157+
php php-cs-fixer.phar describe align_multiline_comment
158158
159159
To visualize all the rules that belong to a ruleset:
160160

161161
.. code-block:: console
162162
163-
$ php php-cs-fixer.phar describe @PSR2
163+
php php-cs-fixer.phar describe @PSR2
164164
165165
Caching
166166
-------
@@ -196,17 +196,17 @@ Require ``friendsofphp/php-cs-fixer`` as a ``dev`` dependency:
196196

197197
.. code-block:: console
198198
199-
$ ./composer.phar require --dev friendsofphp/php-cs-fixer
199+
./composer.phar require --dev friendsofphp/php-cs-fixer
200200
201201
Then, add the following command to your CI:
202202

203203
.. code-block:: console
204204
205-
$ IFS='
206-
$ '
207-
$ CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}")
208-
$ if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi
209-
$ vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS}
205+
IFS='
206+
'
207+
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}")
208+
if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi
209+
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS}
210210
211211
Where ``$COMMIT_RANGE`` is your range of commits, e.g. ``$TRAVIS_COMMIT_RANGE`` or ``HEAD~..HEAD``.
212212

@@ -220,7 +220,7 @@ NOTE: Execution may be unstable when used.
220220

221221
.. code-block:: console
222222
223-
$ PHP_CS_FIXER_IGNORE_ENV=1 php php-cs-fixer.phar fix /path/to/dir
223+
PHP_CS_FIXER_IGNORE_ENV=1 php php-cs-fixer.phar fix /path/to/dir
224224
225225
Exit code
226226
---------

0 commit comments

Comments
 (0)