Skip to content

Commit b55a381

Browse files
authoredNov 27, 2023
doc: Fix various linted errors (#1224)
1 parent 0af38b1 commit b55a381

16 files changed

+67
-64
lines changed
 

‎.github/workflows/docs-empty.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ name: Null Docs
44
on:
55
# To be aware it need to be the counter-part of docs.yaml.
66
pull_request:
7-
paths-ignore:
8-
- doc/**
9-
- mkdocs.yaml
10-
- .github/workflows/docs.yaml
7+
paths:
8+
- '!doc/**'
9+
- '!mkdocs.yaml'
10+
- '!.github/workflows/docs.yaml'
1111

1212
# See https://stackoverflow.com/a/72408109
1313
concurrency:

‎.github/workflows/docs.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Check Markdown formatting
3636
uses: DavidAnson/markdownlint-cli2-action@v13.0.0
3737
with:
38-
globs: "*.md|docs/**/*.md"
38+
globs: "*.md|doc/**/*.md"
3939

4040
check-links:
4141
name: Lint Links
@@ -56,7 +56,7 @@ jobs:
5656
uses: lycheeverse/lychee-action@v1.8.0
5757
with:
5858
# To keep in sync with Makefile#lychee
59-
args: "--verbose --no-progress '*.md' 'docs/**/*.md' --cache --max-cache-age 1d ."
59+
args: "--verbose --no-progress '*.md' 'doc/**/*.md' --cache --max-cache-age 1d ."
6060
output: ${{ runner.temp }}/lychee/out.md
6161
fail: true
6262

‎.markdownlint.jsonc

+2
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
"MD033": false,
88
"MD034": false,
99
"MD041": false,
10+
"MD046": false,
11+
"MD053": false,
1012
}

‎Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ website_check: markdownlint lychee website_build
327327
markdownlint:
328328
@echo "$(YELLOW_COLOR)Ensure you have the nodejs & npm installed. For more information, check:$(NO_COLOR)"
329329
@# To keep in sync with .github/workflows/gh-pages.yaml#check-links
330-
npx markdownlint-cli2 "*.md|docs/**/*.md"
330+
npx markdownlint-cli2 "*.md|doc/**/*.md"
331331

332332
.PHONY: lychee
333333
lychee:

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img src="doc/img/box.png" width=900 />
2+
<img src="doc/img/box.png" width=900 alt="Box logo" />
33
</p>
44

55

‎doc/code-isolation.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## Why/Explanation
99

10-
When bundling the code in a PHAR, it is equivalent to compacting all the code in a single file. However unlike in a
10+
When bundling the code in a PHAR, it is equivalent to compacting all the code in a single file. However unlike in a
1111
compiled language, the code does not change. This, when the PHAR _loads_ external code, can lead to dependency
1212
conflicts.
1313

@@ -22,7 +22,7 @@ myapp.phar myscript.php
2222
For the sake of the example, `myapp.phar` is using Composer and loads the YAML component right away when starting, i.e.
2323
when running `myapp.phar`, the class `Symfony\Yaml\Yaml` _from the PHAR_ is going to be loaded. Now what `myapp.phar`
2424
is actually going to do is scan the whole file given, and do some reflection work on each classes found. I.e. for each
25-
class `$class` found, it will do `new \ReflectionClass($class)`.
25+
class `$class` found, it will do `new \ReflectionClass($class)`.
2626

2727
Now if `myscript.php` is using the Symfony YAML 4.0.0 component with some new features added in 4.0.0 that are
2828
non-existent in 2.8.0, when doing `new \ReflectionClass('Symfony\Yaml\Yaml')`, the class `Symfony\Yaml\Yaml` will be
@@ -45,12 +45,12 @@ Box provides an integration with [PHP-Scoper][php-scoper]. To use it, [enable th
4545
compactor][php-scoper-compactor].
4646

4747
If you need an extra configuration for PHP-Scoper, you can create a `scoper.inc.php` file as
48-
[per the documentation][php-scoper-config]. The only difference is that you can ignore the `finders` setting as the
48+
[per the documentation][php-scoper-config]. The only difference is that you can ignore the `finders` setting as the
4949
files to scope are already collected by Box.
5050

5151
And that's it!
5252

53-
Warning: keep in mind however that scoping is a very brittle process due to the nature of PHP. As such you will likely
53+
Warning: keep in mind however that scoping is a very brittle process due to the nature of PHP. As such you will likely
5454
need some adjustments in your code or the configuration.
5555

5656

‎doc/configuration.md

+21-19
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ When the parameter is not given or set to `null`, Box tries to guess the binary
128128
`composer.json` file. If the [Composer `bin`][composer-bin] is set, Box will pick the first value provided. Otherwise it
129129
will fallback on the [PHAR][phar class] default file used which is `index.php`.
130130

131-
The main file contents is processed by the [compactors][compactors] as the other files.
131+
The main file contents is processed by the [compactors][compactors] as the other files.
132132

133133
If the main file starts with a shebang line (`#!`), it will be automatically removed (the shebang line goes in the
134134
[stub][stub] for a PHAR and is configured by the [shebang][shebang] setting).
@@ -158,9 +158,9 @@ constraint before running. See more information about it [here][requirement-chec
158158
the requirement checker will be added. Note that this is true only if either the `composer.json` or `composer.lock`
159159
could have been found.
160160

161-
!!! Warning
161+
!!! Warning
162162
this check is still done within the PHAR. As a result, if [the required extension to open the PHAR][compression]
163-
due to the compression algorithm is not loaded, a hard failure will still appear: the requirement
163+
due to the compression algorithm is not loaded, a hard failure will still appear: the requirement
164164
checker _cannot_ be executed before that.
165165

166166

@@ -196,7 +196,7 @@ The `force-autodiscovery` (`bool` default `false`) setting forces Box to attempt
196196
though you are using the [`directories`][directories] or [`finder`][finder] setting.
197197

198198
When Box tries to find which files to include, it may remove some files such as readmes or test files. If however you
199-
are using the [`directories`][directories] or [`finder`][finder], Box will _append_ the found files to the ones you
199+
are using the [`directories`][directories] or [`finder`][finder], Box will _append_ the found files to the ones you
200200
listed.
201201

202202

@@ -228,7 +228,7 @@ Files listed in the [`blacklist`][blacklist] will not be added to the PHAR.
228228
the files such as images, those that contain binary data or simply a file you do not want to alter at all despite using
229229
compactors.
230230

231-
!!! Warning
231+
!!! Warning
232232
Setting the key `directories` (regardless of its value), will disable the file auto-discovery. If you want
233233
to keep it, check the [force the auto-discovery][force-autodiscovery] setting.
234234

@@ -243,7 +243,7 @@ compactors.
243243
included in `directories` (respectively `directories-bin`), the those files **will be included**. The files included
244244
are a union of the directives.
245245

246-
!!! Warning
246+
!!! Warning
247247
Symlinks are not followed/supported.
248248

249249

@@ -252,7 +252,7 @@ compactors.
252252
The finder (`object[]`|`null` default `[]`) setting is a list of JSON objects. Each object (key, value) tuple is a
253253
(method, arguments) of the [Symfony Finder][symfony-finder] used by Box. If an array of values is provided for a single
254254
key, the method will be called once per value in the array.
255-
255+
256256
Note that the paths specified for the `in` method are relative to [`base-path`][base-path] and that the finder will
257257
account for the files registered in the [`blacklist`][blacklist].
258258

@@ -307,7 +307,7 @@ blacklisted are the ones found using the other available configuration settings:
307307
Note that all the blacklisted paths are relative to the settings configured above. For example if you have the following
308308
file structure:
309309

310-
```
310+
```text
311311
project/
312312
├── box.json.dist
313313
├── A/
@@ -335,7 +335,7 @@ With:
335335
Box will try to collect all the files found in `project` (cf. [Including files][including-files]) but will exclude `A/`
336336
and `B/A resulting in the following files being collected:
337337

338-
```
338+
```text
339339
project/
340340
├── box.json.dist
341341
└── B/
@@ -372,14 +372,15 @@ belonging to dev only packages. For example for the given project:
372372
}
373373
}
374374
```
375+
375376
</details>
376377

377378
The `vendor` directory will have `beberlei/assert` and `bamarni/composer-bin-plugin`. If `exclude-dev-files` is not
378379
disabled, the `bamarni/composer-bin-plugin` package will be removed from the PHAR.
379380

380381
This setting will automatically be disabled when [`dump-autoload`][dump-autoload] is disabled. Indeed, otherwise some
381-
files will not be shipped in the PHAR but may still appear in the Composer autoload classmap, resulting in an
382-
autoloading error.
382+
files will not be shipped in the PHAR but may still appear in the Composer autoload classmap, resulting in an
383+
autoloading error.
383384

384385

385386
### Map (`map`)
@@ -420,13 +421,14 @@ the above files will be stored with the following paths in the PHAR:
420421
The [PHAR stub][phar.fileformat.stub] file is the PHAR bootstrapping file, i.e. the very first file executed whenever
421422
the PHAR is executed. It usually contains things like the PHAR configuration and executing the [main script file][main].
422423

423-
The default PHAR stub file can be used but Box also propose a couple of options to customize the stub used.
424+
The default PHAR stub file can be used but Box also propose a couple of options to customize the stub used.
424425

425426

426427
### Stub (`stub`)
427428

428429
The stub (`string`|`boolean`|`null` default `true`) setting is used to specify the location of a stub file or if one
429430
should be generated:
431+
430432
- `string`: Path to the stub file will be used as is inside the PHAR
431433
- `true` (default): A new stub will be generated
432434
- `false`: The default stub used by the PHAR class will be used
@@ -440,7 +442,7 @@ If a custom stub file is provided, none of the other options ([`shebang`][sheban
440442
The shebang (`string`|`false`|`null`) setting is used to specify the shebang line used when generating a new stub. By
441443
default, this line is used:
442444

443-
```
445+
```sh
444446
#!/usr/bin/env php
445447
```
446448

@@ -543,7 +545,7 @@ done for you.
543545

544546
For example `Custom banner` will result in the stub file:
545547

546-
```
548+
```php
547549
/*
548550
* Custom banner
549551
*/
@@ -659,7 +661,7 @@ command ✨.
659661
### Annotations (`annotations`)
660662

661663
The annotations (`boolean`|`object`|`null` default `true`) setting is used to enable compacting annotations in PHP source
662-
code.
664+
code.
663665

664666
This setting is only taken into consideration if the [`KevinGH\Box\Compactor\Php` compactor][compactors] is enabled.
665667

@@ -689,6 +691,7 @@ function foo($x, $y): int {
689691
return $x <=> $y;
690692
}
691693
```
694+
692695
</details>
693696

694697
<details>
@@ -715,6 +718,7 @@ function foo($x, $y): int {
715718
return $x <=> $y;
716719
}
717720
```
721+
718722
</details>
719723

720724

@@ -786,7 +790,7 @@ available:
786790

787791
By default, PHARs are `SHA1` signed.
788792

789-
The `OPENSSL` algorithm will require to provide [a key][key].
793+
The `OPENSSL` algorithm will require to provide [a key][key].
790794

791795
!!! warning
792796

@@ -846,7 +850,7 @@ With the configuration excerpt:
846850

847851
Then the `Phar::getMetadata()` will return `['application_version' => '1.0.0-dev']` array.
848852

849-
!!! warning
853+
!!! warning
850854

851855
Your callable function must be readable by your autoloader.
852856

@@ -1037,7 +1041,6 @@ The short commit hash will only be used if no tag is available.
10371041
[git-commit-short]: #short-git-commit-placeholder-git-commit-short
10381042
[git-tag-placeholder]: #git-tag-placeholder-git-tag
10391043
[git-version-placeholder]: #git-version-placeholder-git-version
1040-
[herrera-io/php-annotations]: https://github.com/herrera-io/php-annotations
10411044
[including-files]: #including-files
10421045
[intercept]: #intercept-intercept
10431046
[key-pass]: #the-private-key-password-key-pass
@@ -1055,7 +1058,6 @@ The short commit hash will only be used if no tag is available.
10551058
[phar.mapphar]: https://secure.php.net/manual/en/phar.mapphar.php
10561059
[phar.setalias]: https://secure.php.net/manual/en/phar.setalias.php
10571060
[phar.setsignaturealgorithm]: https://secure.php.net/manual/en/phar.setsignaturealgorithm.php
1058-
[phar.webphar]: https://secure.php.net/manual/en/phar.webphar.php
10591061
[php-date-format]: https://secure.php.net/manual/en/function.date.php
10601062
[php-scoper-compactor]: #php-scoper-php-scoper
10611063
[php-scoper-configuration]: https://github.com/humbug/php-scoper#configuration

‎doc/docker.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
Besides generating a PHAR, you may want to create a [Docker][docker] image for your application. To do so, you can
44
either:
55

6-
- Directly generate the `Dockerfile` when generating the PHAR with the `--with-docker` option of the Box `compile`
6+
- Directly generate the `Dockerfile` when generating the PHAR with the `--with-docker` option of the Box `compile`
77
command
88
- Generate the `Dockerfile` for a given PHAR with the Box `docker` command
99

10-
The command will attempt to generate a `Dockerfile` for your PHAR, leveraging the
11-
[requirement checker][requirement-checker]. Once the file generated, you have free hands on it: you can either use it
10+
The command will attempt to generate a `Dockerfile` for your PHAR, leveraging the
11+
[requirement checker][requirement-checker]. Once the file generated, you have free hands on it: you can either use it
1212
right away (you just need to run `$ docker build .` to create the docker image) or you can tweak it however you want.
1313

1414
In your `Dockerfile` (generated by Box), you should see the following line:
1515

1616
```Dockerfile
1717
RUN $(php -r '$extensionInstalled = array_map("strtolower", \get_loaded_extensions(false));$requiredExtensions = ["zlib", "phar", "openssl", "pcre", "tokenizer"];$extensionsToInstall = array_diff($requiredExtensions, $extensionInstalled);if ([] !== $extensionsToInstall) {echo \sprintf("docker-php-ext-install %s", implode(" ", $extensionsToInstall));}echo "echo \"No extensions\"";')
18-
```
18+
```
1919

2020
This cryptic one-liner PHP script is about installing the required extensions for your application: it compares the ones
2121
your application requires with the ones already provided by the base PHP image, and then install them using the

‎doc/faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ See [Phar::running()][phar-running] for more information.
127127
If you need to include Box as part of your dependencies and include it within your PHAR, you will probably encounter
128128
the following issue when building your PHAR:
129129

130-
```
130+
```text
131131
Could not dump the autoloader.
132132
[...]
133133
Could not scan for classes inside "/path/to/vendor/humbug/php-scoper/vendor-hotfix/" which does not appear to be a file nor a folder

‎doc/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ permissions:
4545
You can then find more advanced configuration settings in [the configuration documentation][configuration].
4646
For more information on which command or options is available, you can run:
4747

48-
```
48+
```shell
4949
box help
5050
```
5151

@@ -73,7 +73,7 @@ The text displayed by the commands (e.g. `compile` or `info`) or the content of
7373
Project originally created by: [Kevin Herrera] ([@kherge]) which has now been moved under the [Humbug umbrella][humbug].
7474

7575

76-
[box2]: https://github.com/box-project/box2
76+
[configuration]: configuration.md
7777
[Kevin Herrera]: https://github.com/kherge
7878
[@kherge]: https://github.com/kherge
7979
[humbug]: https://github.com/humbug

‎doc/installation.md

-1
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,3 @@ docker pull boxproject/box
102102
[docker-image]: https://hub.docker.com/r/boxproject/box
103103
[bamarni/composer-bin-plugin]: https://github.com/bamarni/composer-bin-plugin
104104
[phive]: https://github.com/phar-io/phive
105-
[github-release]: https://github.com/box-project/box/releases

‎doc/phar-signing.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ gpg --gen-key
113113
It will ask for some questions. It is recommended to use a passphrase (ideally generated and managed by a reputable
114114
password manager). In the end, you will end up with something like this:
115115

116-
```
116+
```shell
117117
# $ gpg --gen-key output
118118
pub ed25519 2023-10-21 [SC] [expires: 2026-10-20]
119119
96C8013A3CC293C465EE3FBB03B2F4DF7A20DF08
@@ -145,7 +145,7 @@ gpg --keyserver keys.openpgp.org --send-key 96C8013A3CC293C465EE3FBB03B2F4DF7A20
145145
```
146146

147147
[^1]:
148-
148+
149149
There is several OpenPGP Keyservers. It is recommended to push your keys to [keys.openpgp.org] _at least_, but you
150150
can also push it to other servers if you wish to.
151151

@@ -156,7 +156,7 @@ revocation certificate to the keyserver to invalidate the signing key.
156156
gpg --output revoke-96C8013A3CC293C465EE3FBB03B2F4DF7A20DF08.asc --gen-revoke 96C8013A3CC293C465EE3FBB03B2F4DF7A20DF08
157157
```
158158

159-
This will leave you with a revocation certificate in the file `revoke-96C8013A3CC293C465EE3FBB03B2F4DF7A20DF08.asc`
159+
This will leave you with a revocation certificate in the file `revoke-96C8013A3CC293C465EE3FBB03B2F4DF7A20DF08.asc`
160160
which can be added to your password manager.
161161

162162

@@ -185,7 +185,7 @@ gpg --export-secret-key --armor 96C8013A3CC293C465EE3FBB03B2F4DF7A20DF08 >> keys
185185

186186
If your goal is to save this encryption key somewhere, for example your repository, you should first encrypt it:
187187

188-
```
188+
```shell
189189
gpg --symmetric keys.asc
190190
```
191191

@@ -194,7 +194,7 @@ ideally one generated and managed by a password manager.
194194

195195
This leaves you with a file `keys.asc.gpg`. You can add this one to the repository and at this point you are probably
196196
better off **deleting the `keys.asc` file**. In order to do the actual signing, you will have to decrypt it again, but
197-
it is better to not keep that decrypted key around.
197+
it is better to not keep that decrypted key around.
198198

199199

200200
### Sign your PHAR
@@ -240,7 +240,7 @@ When publishing your archive, you should publish both `bin/command.phar` and `bi
240240
First you should check the issuer's identity, usually it is provided from where you download it as part of the
241241
documentation:
242242

243-
```
243+
```shell
244244
# If you are on the same machine as where you created the key, then this step is unnecessary.
245245
# You will need this however for when verifying a different key that you do not know of yet.
246246
gpg --keyserver hkps://keys.openpgp.org --recv-keys 96C8013A3CC293C465EE3FBB03B2F4DF7A20DF08

0 commit comments

Comments
 (0)
Please sign in to comment.