Skip to content

Commit c54f555

Browse files
authored
docs: fix grammar, markup and line width in the 4.8 user guide additions (#10710)
1 parent f7545a9 commit c54f555

41 files changed

Lines changed: 1510 additions & 2019 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎user_guide_src/source/changelogs/v4.8.0.rst‎

Lines changed: 67 additions & 161 deletions
Large diffs are not rendered by default.

‎user_guide_src/source/cli/cli_commands.rst‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ building out custom code generators for your company.
1010

1111
.. deprecated:: 4.8.0
1212

13-
``BaseCommand`` is deprecated, and running a command that extends it triggers a
14-
deprecation notice. Write new commands against ``AbstractCommand`` instead.
15-
See :doc:`cli_modern_commands`.
13+
``BaseCommand`` is deprecated, and running a command that extends it triggers a deprecation notice. Write new
14+
commands against ``AbstractCommand`` instead. See :doc:`cli_modern_commands`.
1615

1716
.. contents::
1817
:local:

‎user_guide_src/source/cli/cli_generators.rst‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,17 @@ Argument:
8585
Options:
8686
========
8787
* ``--command`` (``-c``): The command name to run in spark. Defaults to ``command:name``.
88-
* ``--type`` (``-t``): The type of command, whether a ``basic`` command or a ``generator`` command. Defaults to ``basic``.
89-
* ``--group`` (``-g``): The group of the command. Defaults to ``App`` for basic commands, and ``Generators`` for generator commands.
88+
* ``--type`` (``-t``): The type of command, whether a ``basic`` command or a ``generator`` command. Defaults to
89+
``basic``.
90+
* ``--group`` (``-g``): The group of the command. Defaults to ``App`` for basic commands, and ``Generators`` for
91+
generator commands.
9092
* ``--namespace`` (``-n``): Set the root namespace. Defaults to value of ``APP_NAMESPACE``.
9193
* ``--suffix`` (``-s``): Append the component suffix to the generated class name.
9294
* ``--force`` (``-f``): Set this flag to overwrite existing files on destination.
9395

94-
.. note:: Since v4.8.0, the generated class is a :doc:`modern command <cli_modern_commands>`: a ``basic`` command extends
95-
``AbstractCommand``, and a ``generator`` command extends :doc:`AbstractGeneratorCommand <cli_modern_generators>`.
96+
.. note:: Since v4.8.0, the generated class is a :doc:`modern command <cli_modern_commands>`: a ``basic`` command
97+
extends ``AbstractCommand``, and a ``generator`` command extends
98+
:doc:`AbstractGeneratorCommand <cli_modern_generators>`.
9699

97100
make:config
98101
-----------
@@ -133,7 +136,8 @@ Argument:
133136
Options:
134137
========
135138
* ``--bare`` (``-b``): Extends from ``CodeIgniter\Controller`` instead of ``BaseController``.
136-
* ``--restful`` (``-r``): Extends from a RESTful resource. Choices are ``controller`` and ``presenter``. Defaults to ``controller``.
139+
* ``--restful`` (``-r``): Extends from a RESTful resource. Choices are ``controller`` and ``presenter``. Defaults to
140+
``controller``.
137141
* ``--namespace`` (``-n``): Set the root namespace. Defaults to value of ``APP_NAMESPACE``.
138142
* ``--suffix`` (``-s``): Append the component suffix to the generated class name.
139143
* ``--force`` (``-f``): Set this flag to overwrite existing files on destination.
@@ -377,18 +381,17 @@ To include an ``Entity`` class in the scaffolded files, just include the ``--ret
377381
and it will be passed to the model generator.
378382

379383
.. note:: Since v4.8.0, ``make:scaffold`` accepts the ``-b``, ``-t``, ``-g``, ``-n``, ``-s``, and ``-f`` shortcuts.
380-
``--restful`` and ``--return`` have no shortcut here, since both use ``-r`` in their own commands.
381-
When the class name is omitted on an interactive run, it is asked for once and reused for every generated file.
384+
``--restful`` and ``--return`` have no shortcut here, since both use ``-r`` in their own commands. When the class
385+
name is omitted on an interactive run, it is asked for once and reused for every generated file.
382386

383387
**************
384388
GeneratorTrait
385389
**************
386390

387391
.. deprecated:: 4.8.0
388392

389-
``GeneratorTrait`` is the legacy way of building generator commands, tied to the deprecated
390-
``BaseCommand``. New generator commands should extend ``AbstractGeneratorCommand`` instead.
391-
See :doc:`cli_modern_generators`.
393+
``GeneratorTrait`` is the legacy way of building generator commands, tied to the deprecated ``BaseCommand``. New
394+
generator commands should extend ``AbstractGeneratorCommand`` instead. See :doc:`cli_modern_generators`.
392395

393396
Legacy generator commands use the ``GeneratorTrait`` to fully utilize its methods that are used in code
394397
generation.

‎user_guide_src/source/cli/cli_library.rst‎

Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ need to ensure your controller can locate it via a ``use`` statement above your
2424

2525
The class is automatically initialized when the file is loaded the first time.
2626

27-
Since v4.8.0 the static methods delegate to instance classes, which you can also use directly.
28-
See :ref:`cli-library-classes`.
27+
Since v4.8.0 the static methods delegate to instance classes, which you can also use directly. See
28+
:ref:`cli-library-classes`.
2929

3030
Getting Input from the User
3131
***************************
@@ -95,16 +95,15 @@ select() and multiselect()
9595

9696
.. versionadded:: 4.8.0
9797

98-
``select()`` and ``multiselect()`` on :php:class:`Prompt` let the user pick with the arrow keys
99-
(or ``j`` and ``k``), tick with the space bar, tick everything or nothing with ``a``, and confirm
100-
with enter. ``select()`` returns the chosen key, and ``multiselect()`` returns the ticked options,
101-
keyed as in ``$options``. Both take any keys, and long lists scroll:
98+
``select()`` and ``multiselect()`` on :php:class:`Prompt` let the user pick with the arrow keys (or ``j`` and ``k``),
99+
tick with the space bar, tick everything or nothing with ``a``, and confirm with enter. ``select()`` returns the chosen
100+
key, and ``multiselect()`` returns the ticked options, keyed as in ``$options``. Both take any keys, and long lists
101+
scroll:
102102

103103
.. literalinclude:: cli_library/026.php
104104

105-
Where keys cannot be read one by one, such as on Windows or when the input is piped, both prompts
106-
list the options by number and ask for the number, or numbers separated by commas. The filters
107-
question above then reads:
105+
Where keys cannot be read one by one, such as on Windows or when the input is piped, both prompts list the options by
106+
number and ask for the number, or numbers separated by commas. The filters question above then reads:
108107

109108
.. code-block:: console
110109
@@ -116,9 +115,9 @@ question above then reads:
116115
117116
Under WSL, PHP runs as on Linux and reads the keys.
118117

119-
On a quiet output (see :ref:`spark-verbosity`) both prompts return the defaults without asking,
120-
and a required ``multiselect()`` without a default throws a ``CLIException``. They also throw it
121-
when piped input ends before a valid answer.
118+
On a quiet output (see :ref:`spark-verbosity`) both prompts return the defaults without asking, and a required
119+
``multiselect()`` without a default throws a ``CLIException``. They also throw it when piped input ends before a valid
120+
answer.
122121

123122
Pressing Ctrl+C restores the terminal and then interrupts the process as usual.
124123

@@ -309,52 +308,50 @@ The Classes Behind the Facade
309308

310309
.. versionadded:: 4.8.0
311310

312-
The static output methods delegate to instance classes, each with one job.
313-
``CLI::getOutput()`` and ``CLI::getTerminal()`` return the shared instances, and
314-
modern commands reach the output through ``$this->getOutput()``
311+
The static output methods delegate to instance classes, each with one job. ``CLI::getOutput()`` and
312+
``CLI::getTerminal()`` return the shared instances, and modern commands reach the output through ``$this->getOutput()``
315313
(see :ref:`modern-commands-writing-output`):
316314

317315
.. literalinclude:: cli_library/024.php
318316

319-
Mixing the static methods with the instance is safe, because both write to the same
320-
``Output`` and share its line breaks.
317+
Mixing the static methods with the instance is safe, because both write to the same ``Output`` and share its line
318+
breaks.
321319

322-
The prompt methods delegate to :php:class:`Prompt`, which reads through an ``Output``.
323-
``CLI::getPrompt()`` returns one on the shared output, and modern commands reach one on the
324-
output of their run through ``$this->getPrompt()``:
320+
The prompt methods delegate to :php:class:`Prompt`, which reads through an ``Output``. ``CLI::getPrompt()`` returns one
321+
on the shared output, and modern commands reach one on the output of their run through ``$this->getPrompt()``:
325322

326323
.. literalinclude:: cli_library/025.php
327324

328325
.. php:namespace:: CodeIgniter\CLI
329326
330327
.. php:class:: Output
331328
332-
The writer. It targets STDOUT, sends ``error()`` to STDERR, and remembers whether the
333-
cursor sits mid-line so that ``write()`` starts on a fresh line.
329+
The writer. It targets STDOUT, sends ``error()`` to STDERR, and remembers whether the cursor sits mid-line so that
330+
``write()`` starts on a fresh line.
334331

335332
.. php:method:: __construct([InputOutput $io = new InputOutput()[, Terminal $terminal = new Terminal()]])
336333
337334
:param InputOutput $io: The transport the text is written through.
338-
:param Terminal $terminal: The terminal consulted for colour support.
335+
:param Terminal $terminal: The terminal consulted for color support.
339336

340337
.. php:method:: print(string $text = ''[, string $foreground = ''[, string $background = ''[, Verbosity $verbosity = Verbosity::Normal]]]): void
341338
.. php:method:: write(string $text = ''[, string $foreground = ''[, string $background = ''[, Verbosity $verbosity = Verbosity::Normal]]]): void
342339
.. php:method:: newLine([int $num = 1[, Verbosity $verbosity = Verbosity::Normal]]): void
343340
344-
The same as the static methods of the same names, writing nothing when the
345-
level of the output is below ``$verbosity``.
341+
The same as the static methods of the same names, writing nothing when the level of the output is below
342+
``$verbosity``.
346343

347344
.. php:method:: deferNewLine(): void
348345
349-
Writes a blank line before whatever is written next, and none if nothing follows.
350-
The prompts end with it, so a prompt that ends the run leaves no blank line behind.
346+
Writes a blank line before whatever is written next, and none if nothing follows. The prompts end with it, so a
347+
prompt that ends the run leaves no blank line behind.
351348

352349
.. php:method:: error(string $text[, string $foreground = 'light_red'[, string $background = '']]): void
353350
.. php:method:: beep(int $num = 1): void
354351
.. php:method:: clearScreen(): void
355352
356-
The same as the static methods of the same names. ``error()`` writes at every
357-
level but ``Verbosity::Silent``, and the other two only from ``Verbosity::Normal`` on.
353+
The same as the static methods of the same names. ``error()`` writes at every level but ``Verbosity::Silent``,
354+
and the other two only from ``Verbosity::Normal`` on.
358355

359356
.. php:method:: getVerbosity(): Verbosity
360357
.. php:method:: setVerbosity(Verbosity $verbosity): void
@@ -363,27 +360,27 @@ output of their run through ``$this->getPrompt()``:
363360
.. php:method:: isVeryVerbose(): bool
364361
.. php:method:: isDebug(): bool
365362
366-
``isQuiet()`` is true for the quiet and silent levels, and the others for their
367-
level or above. See :ref:`modern-commands-verbosity`.
363+
``isQuiet()`` is true for the quiet and silent levels, and the others for their level or above. See
364+
:ref:`modern-commands-verbosity`.
368365

369366
.. php:method:: color(string $text, string $foreground[, string $background = ''[, string $format = '']]): string
370367
371-
Colours the text when the target stream supports colours, and returns it unchanged otherwise.
372-
``print()``, ``write()``, and ``error()`` colour through this method, so a subclass overriding
373-
it changes the colouring of every write.
368+
Colors the text when the target stream supports colors, and returns it unchanged otherwise. ``print()``,
369+
``write()``, and ``error()`` color through this method, so a subclass overriding it changes the coloring of
370+
every write.
374371

375372
.. php:method:: wrap(string $text[, int $max = 0[, int $padLeft = 0]]): string
376373
377374
The same as ``CLI::wrap()``, measuring the terminal of this output.
378375

379376
.. php:method:: isDecorated(): bool
380377
381-
Whether the target stream supports colours.
378+
Whether the target stream supports colors.
382379

383380
.. php:method:: forStderr(): static
384381
385-
Returns a copy whose STDOUT writes target STDERR, which is what the framework swaps in
386-
while rendering an exception.
382+
Returns a copy whose STDOUT writes target STDERR, which is what the framework swaps in while rendering an
383+
exception.
387384

388385
.. php:method:: getTerminal(): Terminal
389386
@@ -418,9 +415,8 @@ output of their run through ``$this->getPrompt()``:
418415

419416
.. php:class:: Verbosity
420417
421-
The level of the output, as an ``int``-backed enum valued as ``SHELL_VERBOSITY``:
422-
``Silent`` (-2), ``Quiet`` (-1), ``Normal`` (0), ``Verbose`` (1), ``VeryVerbose`` (2),
423-
and ``Debug`` (3).
418+
The level of the output, as an ``int``-backed enum valued as ``SHELL_VERBOSITY``: ``Silent`` (-2), ``Quiet`` (-1),
419+
``Normal`` (0), ``Verbose`` (1), ``VeryVerbose`` (2), and ``Debug`` (3).
424420

425421
.. php:class:: Terminal
426422
@@ -442,14 +438,13 @@ output of their run through ``$this->getPrompt()``:
442438
443439
.. php:method:: advanceTo(float|int $step[, int $totalSteps = 10]): void
444440
445-
Draws the bar for the step, capped at 100%, over the previous bar unless the step
446-
went backwards. A negative step or a total below one throws ``InvalidArgumentException``,
447-
where ``CLI::showProgress()`` keeps tolerating them.
441+
Draws the bar for the step, capped at 100%, over the previous bar unless the step went backwards. A negative
442+
step or a total below one throws ``InvalidArgumentException``, where ``CLI::showProgress()`` keeps tolerating
443+
them.
448444

449445
.. php:method:: clear(): void
450446
451-
Rings the bell and starts a new bar on the next ``advanceTo()``. This is what
452-
``CLI::showProgress(false)`` does.
447+
Rings the bell and starts a new bar on the next ``advanceTo()``. This is what ``CLI::showProgress(false)`` does.
453448

454449
.. php:class:: Table
455450
@@ -464,12 +459,12 @@ output of their run through ``$this->getPrompt()``:
464459

465460
.. php:class:: Color
466461
467-
The ANSI colour codes, independent of any stream.
462+
The ANSI color codes, independent of any stream.
468463

469464
.. php:staticmethod:: apply(string $text, string $foreground[, string $background = ''[, string $format = '']]): string
470465
471-
Wraps the text in the colour codes, always. Throws ``CLIException`` for an unknown colour.
466+
Wraps the text in the color codes, always. Throws ``CLIException`` for an unknown color.
472467

473468
.. php:staticmethod:: width(string $string): int
474469
475-
Returns the display width of the text without its colour codes, as ``CLI::strlen()`` does.
470+
Returns the display width of the text without its color codes, as ``CLI::strlen()`` does.

0 commit comments

Comments
 (0)