Skip to content

Commit b8d1745

Browse files
authored
Merge pull request #3285 from briannesbitt/job/update-documentation
Update documentation
2 parents d2af725 + 64a46d7 commit b8d1745

File tree

8 files changed

+678
-678
lines changed

8 files changed

+678
-678
lines changed

docs/develop/changelog.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[Complete commits list](https://github.com/CarbonPHP/carbon/compare/3.10.2...3.10.3)
1212

1313
New contributors:
14-
* @sammyaxe made their first contribution in https://github.com/briannesbitt/Carbon/pull/3215
14+
* @sammyaxe made their first contribution in [briannesbitt/Carbon#3215](https://github.com/briannesbitt/Carbon/pull/3215)
1515

1616

1717
#### 3.10.3 (2 August 2025)
@@ -22,8 +22,8 @@ New contributors:
2222
[Complete commits list](https://github.com/CarbonPHP/carbon/compare/3.10.1...3.10.2)
2323

2424
New contributors:
25-
* @Disservin made their first contribution in https://github.com/briannesbitt/Carbon/pull/3213
26-
* @Joeb454 made their first contribution in https://github.com/briannesbitt/Carbon/pull/3218
25+
* @Disservin made their first contribution in [briannesbitt/Carbon#3213](https://github.com/briannesbitt/Carbon/pull/3213)
26+
* @Joeb454 made their first contribution in [briannesbitt/Carbon#3218](https://github.com/briannesbitt/Carbon/pull/3218)
2727

2828

2929
#### 3.10.2 (21 June 2025)
@@ -48,8 +48,8 @@ New contributors:
4848
[Complete commits list](https://github.com/CarbonPHP/carbon/compare/3.9.1...3.10.0)
4949

5050
New contributors:
51-
* @nesl247 made their first contribution in https://github.com/CarbonPHP/carbon/pull/42
52-
* @aavtukhovich made their first contribution in https://github.com/CarbonPHP/carbon/pull/45
51+
* @nesl247 made their first contribution in [CarbonPHP/carbon#42](https://github.com/CarbonPHP/carbon/pull/42)
52+
* @aavtukhovich made their first contribution in [CarbonPHP/carbon#45](https://github.com/CarbonPHP/carbon/pull/45)
5353

5454

5555
#### 3.10.0 (1 May 2025)
@@ -68,9 +68,9 @@ New contributors:
6868
[Complete commits list](https://github.com/CarbonPHP/carbon/compare/3.9.0...3.9.1)
6969

7070
New contributors:
71-
* @daniser made their first contribution in https://github.com/briannesbitt/Carbon/pull/3169
72-
* @liamduckett made their first contribution in https://github.com/briannesbitt/Carbon/pull/3174
73-
* @riesjart made their first contribution in https://github.com/briannesbitt/Carbon/pull/3176
71+
* @daniser made their first contribution in [briannesbitt/Carbon#3169](https://github.com/briannesbitt/Carbon/pull/3169)
72+
* @liamduckett made their first contribution in [briannesbitt/Carbon#3174](https://github.com/briannesbitt/Carbon/pull/3174)
73+
* @riesjart made their first contribution in [briannesbitt/Carbon#3176](https://github.com/briannesbitt/Carbon/pull/3176)
7474

7575

7676
#### 3.9.1 (27 March 2025)
@@ -80,8 +80,8 @@ New contributors:
8080
[Complete commits list](https://github.com/CarbonPHP/carbon/compare/3.8.6...3.9.0)
8181

8282
New contributors:
83-
* @cdburgess made their first contribution in https://github.com/CarbonPHP/carbon/pull/22
84-
* @AndrewMast made their first contribution in https://github.com/CarbonPHP/carbon/pull/27
83+
* @cdburgess made their first contribution in [CarbonPHP/carbon#22](https://github.com/CarbonPHP/carbon/pull/22)
84+
* @AndrewMast made their first contribution in [CarbonPHP/carbon#27](https://github.com/CarbonPHP/carbon/pull/27)
8585

8686

8787
#### 3.9.0 (20 February 2025)
@@ -98,7 +98,7 @@ New contributors:
9898
[Complete commits list](https://github.com/briannesbitt/Carbon/compare/3.8.4...3.8.5)
9999

100100
New contributors:
101-
* @novruzrhmv made their first contribution in https://github.com/briannesbitt/Carbon/pull/3144
101+
* @novruzrhmv made their first contribution in [briannesbitt/Carbon#3144](https://github.com/briannesbitt/Carbon/pull/3144)
102102

103103

104104
#### 3.8.5 (27 December 2024)
@@ -116,9 +116,9 @@ New contributors:
116116
[Complete commits list](https://github.com/briannesbitt/Carbon/compare/3.8.2...3.8.3)
117117

118118
New contributors:
119-
* @c-Rolland made their first contribution in https://github.com/briannesbitt/Carbon/pull/3110
120-
* @Mejans made their first contribution in https://github.com/briannesbitt/Carbon/pull/3115
121-
* @koprivan made their first contribution in https://github.com/briannesbitt/Carbon/pull/3122
119+
* @c-Rolland made their first contribution in [briannesbitt/Carbon#3110](https://github.com/briannesbitt/Carbon/pull/3110)
120+
* @Mejans made their first contribution in [briannesbitt/Carbon#3115](https://github.com/briannesbitt/Carbon/pull/3115)
121+
* @koprivan made their first contribution in [briannesbitt/Carbon#3122](https://github.com/briannesbitt/Carbon/pull/3122)
122122

123123

124124
#### 3.8.3 (7 November 2024)
@@ -152,7 +152,7 @@ New contributors:
152152
[Complete commits list](https://github.com/briannesbitt/Carbon/compare/3.7.0...3.8.0)
153153

154154
New contributors:
155-
* @DannyJJK made their first contribution in https://github.com/briannesbitt/Carbon/pull/3060
155+
* @DannyJJK made their first contribution in [briannesbitt/Carbon#3060](https://github.com/briannesbitt/Carbon/pull/3060)
156156

157157

158158
#### 3.8.0 (16 July 2024)
@@ -164,9 +164,9 @@ New contributors:
164164
[Complete commits list](https://github.com/briannesbitt/Carbon/compare/3.6.0...3.7.0)
165165

166166
New contributors:
167-
* @faissaloux made their first contribution in https://github.com/briannesbitt/Carbon/pull/3043
168-
* @philbates35 made their first contribution in https://github.com/briannesbitt/Carbon/pull/3047
169-
* @marcheffels made their first contribution in https://github.com/briannesbitt/Carbon/pull/3045
167+
* @faissaloux made their first contribution in [briannesbitt/Carbon#3043](https://github.com/briannesbitt/Carbon/pull/3043)
168+
* @philbates35 made their first contribution in [briannesbitt/Carbon#3047](https://github.com/briannesbitt/Carbon/pull/3047)
169+
* @marcheffels made their first contribution in [briannesbitt/Carbon#3045](https://github.com/briannesbitt/Carbon/pull/3045)
170170

171171

172172
#### 3.7.0 (20 June 2024)

releases.json

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

tools/check.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
$documentation = implode("\n", array_map(
2020
file_get_contents(...),
2121
[
22-
...glob(__DIR__ . '/../docs/guide/**/*.md'),
23-
...glob(__DIR__ . '/../docs/parts/**/*.md'),
22+
...glob(__DIR__.'/../docs/guide/**/*.md'),
23+
...glob(__DIR__.'/../docs/parts/**/*.md'),
2424
],
2525
));
2626

tools/generate-api.php

Lines changed: 89 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@
1414

1515
use function Carbon\Doc\Methods\methods;
1616

17-
require __DIR__ . '/../vendor/autoload.php';
18-
require __DIR__ . '/methods.php';
17+
require __DIR__.'/../vendor/autoload.php';
18+
require __DIR__.'/methods.php';
1919

20-
$destination_file = __DIR__ . '/../docs/develop/reference.md';
20+
$destination_file = __DIR__.'/../docs/develop/reference.md';
2121

2222
trait MacroExposer
2323
{
24-
public function getMacros()
25-
{
26-
$class = get_called_class();
24+
public function getMacros()
25+
{
26+
$class = get_called_class();
2727

28-
return $class::$global_macros ?? FactoryImmutable::getDefaultInstance()->getSettings()['macros'];
29-
}
28+
return $class::$global_macros ?? FactoryImmutable::getDefaultInstance()->getSettings()['macros'];
29+
}
3030
}
3131

3232
class BusinessTimeCarbon extends Carbon
3333
{
34-
use MacroExposer;
34+
use MacroExposer;
3535
}
3636

3737
function history_line($event, $version, $ref): array
@@ -57,11 +57,11 @@ function table_markdown(array $table, ?array $header = null): string
5757
);
5858

5959
return implode("\n", array_map(
60-
static fn (array $row) => '|' . (str_starts_with($row[0], '--') ? ':' : ' ') . implode(' | ', array_map(
60+
static fn (array $row) => '|'.(str_starts_with($row[0], '--') ? ':' : ' ').implode(' | ', array_map(
6161
static fn (string $cell, int $size) => str_pad($cell, $size),
6262
$row,
6363
$sizes,
64-
)) . ' |',
64+
)).' |',
6565
[
6666
$header,
6767
array_map(static fn (int $size) => str_repeat('-', $size), $sizes),
@@ -72,73 +72,72 @@ function table_markdown(array $table, ?array $header = null): string
7272

7373
function get_classes(): Generator
7474
{
75-
if (class_exists(Carbon::class)) {
76-
yield [
77-
new Carbon(),
78-
new DateTime(),
75+
if (class_exists(Carbon::class)) {
76+
yield [
77+
new Carbon(),
78+
new DateTime(),
7979
];
8080

81-
if (class_exists(BusinessTime::class)) {
82-
yield [
83-
BusinessTime::enable(BusinessTimeCarbon::class),
84-
new Carbon(),
85-
Carbon::class,
86-
'Requires <a href="https://github.com/kylekatarnls/business-time">cmixin/business-time</a>',
87-
new BusinessTimeCarbon(),
81+
if (class_exists(BusinessTime::class)) {
82+
yield [
83+
BusinessTime::enable(BusinessTimeCarbon::class),
84+
new Carbon(),
85+
Carbon::class,
86+
'Requires <a href="https://github.com/kylekatarnls/business-time">cmixin/business-time</a>',
87+
new BusinessTimeCarbon(),
8888
];
89-
}
90-
91-
if (trait_exists(SeasonMixin::class)) {
92-
BusinessTimeCarbon::mixin(SeasonMixin::class);
93-
94-
yield [
95-
new BusinessTimeCarbon(),
96-
new Carbon(),
97-
Carbon::class,
98-
'Requires <a href="https://github.com/kylekatarnls/season">cmixin/season</a>',
99-
new class() extends BusinessTimeCarbon
100-
{
101-
use SeasonMixin;
102-
},
103-
SeasonMixin::class,
89+
}
90+
91+
if (trait_exists(SeasonMixin::class)) {
92+
BusinessTimeCarbon::mixin(SeasonMixin::class);
93+
94+
yield [
95+
new BusinessTimeCarbon(),
96+
new Carbon(),
97+
Carbon::class,
98+
'Requires <a href="https://github.com/kylekatarnls/season">cmixin/season</a>',
99+
new class() extends BusinessTimeCarbon {
100+
use SeasonMixin;
101+
},
102+
SeasonMixin::class,
104103
];
105-
}
106-
}
104+
}
105+
}
107106

108-
if (class_exists(CarbonInterval::class)) {
109-
yield [
110-
new CarbonInterval(0, 0, 0, 1),
111-
new DateInterval('P1D'),
107+
if (class_exists(CarbonInterval::class)) {
108+
yield [
109+
new CarbonInterval(0, 0, 0, 1),
110+
new DateInterval('P1D'),
112111
];
113-
}
112+
}
114113

115-
if (class_exists(CarbonPeriod::class)) {
116-
yield [
117-
new CarbonPeriod(),
118-
new stdClass(),
114+
if (class_exists(CarbonPeriod::class)) {
115+
yield [
116+
new CarbonPeriod(),
117+
new stdClass(),
119118
];
120-
}
119+
}
121120

122-
if (class_exists(CarbonTimeZone::class)) {
123-
yield [
124-
new CarbonTimeZone('Europe/Paris'),
125-
new DateTimeZone('Europe/Paris'),
121+
if (class_exists(CarbonTimeZone::class)) {
122+
yield [
123+
new CarbonTimeZone('Europe/Paris'),
124+
new DateTimeZone('Europe/Paris'),
126125
];
127-
}
126+
}
128127

129-
if (class_exists(Translator::class)) {
130-
yield [
131-
new Translator('en'),
132-
new SymfonyTranslator('en'),
128+
if (class_exists(Translator::class)) {
129+
yield [
130+
new Translator('en'),
131+
new SymfonyTranslator('en'),
133132
];
134-
}
133+
}
135134

136-
if (class_exists(Language::class)) {
137-
yield [
138-
new Language('en'),
139-
new stdClass(),
135+
if (class_exists(Language::class)) {
136+
yield [
137+
new Language('en'),
138+
new stdClass(),
140139
];
141-
}
140+
}
142141
}
143142

144143
function get_doc_blocks(): array
@@ -154,7 +153,7 @@ function get_doc_blocks(): array
154153
foreach (methods(false, false) as [$carbon_object, $class_name, $method, $parameters, $return, $description, $dateTimeObject, $info]) {
155154
$classes[$class_name] ??= new ReflectionClass($class_name);
156155

157-
$name = $classes[$class_name]->getShortName() . '::' . $method;
156+
$name = $classes[$class_name]->getShortName().'::'.$method;
158157

159158
try {
160159
$doc_comment = $classes[$class_name]->getMethod($method)->getDocComment();
@@ -177,7 +176,7 @@ function get_doc_blocks(): array
177176
$global_history = @json_decode(file_get_contents('history.json'), true);
178177

179178
foreach (get_doc_blocks() as $name => $docblock) {
180-
$markdown .= "#### $name\n\n";
179+
$markdown .= "#### $name\n\n";
181180

182181
if (is_array($docblock)) {
183182
[$description, $parameters, $return, $info] = $docblock;
@@ -217,55 +216,55 @@ function get_doc_blocks(): array
217216
}
218217
}
219218

220-
$deprecated = $docblock->getTagsByName('deprecated');
219+
$deprecated = $docblock->getTagsByName('deprecated');
221220

222221
foreach ($deprecated as $tag) {
223222
$markdown .= "::: warning Deprectated \n$tag\n:::\n";
224223
}
225224

226-
$parameters = $docblock->getTagsByName('param');
225+
$parameters = $docblock->getTagsByName('param');
227226

228-
if ($parameters !== []) {
229-
$markdown .= "##### Parameters\n";
227+
if ($parameters !== []) {
228+
$markdown .= "##### Parameters\n";
230229

231-
foreach ($parameters as $tag) {
232-
$markdown .= "- \${$tag->getVariableName()} `{$tag->getType()}`";
233-
$description = trim($tag->getDescription());
230+
foreach ($parameters as $tag) {
231+
$markdown .= "- \${$tag->getVariableName()} `{$tag->getType()}`";
232+
$description = trim($tag->getDescription());
234233

235-
// if description is multiline, indent lines
234+
// if description is multiline, indent lines
236235
$description = str_contains($description, "\n")
237-
? "\n " . str_replace("\n", "\n ", $description)
236+
? "\n ".str_replace("\n", "\n ", $description)
238237
: " $description";
239-
$markdown .= "$description\n";
240-
}
238+
$markdown .= "$description\n";
239+
}
241240

242241
$markdown .= "\n";
243-
}
242+
}
244243

245-
$return = $docblock->getTagsByName('return');
244+
$return = $docblock->getTagsByName('return');
246245

247246
foreach ($return as $tag) {
248247
$markdown .= "returns `$tag`\n\n";
249248
}
250249

251-
$examples = $docblock->getTagsByName('example');
250+
$examples = $docblock->getTagsByName('example');
252251

253-
if ($examples !== []) {
254-
$markdown .= "##### Examples\n";
252+
if ($examples !== []) {
253+
$markdown .= "##### Examples\n";
255254

256-
foreach ($examples as $tag) {
257-
$value = trim($tag->__toString());
255+
foreach ($examples as $tag) {
256+
$value = trim($tag->__toString());
258257

259-
// add ```php` if not specified
260-
$markdown .= preg_replace('/^```(?!\w)/m', '```php', $value, 1) . "\n";
261-
}
258+
// add ```php` if not specified
259+
$markdown .= preg_replace('/^```(?!\w)/m', '```php', $value, 1)."\n";
260+
}
262261

263262
$markdown .= "\n";
264-
}
263+
}
265264

266265
$history = [];
267266
[$class_name, $method] = explode('::', $name);
268-
$fqcn = 'Carbon\\' . $class_name;
267+
$fqcn = 'Carbon\\'.$class_name;
269268

270269
$key = class_exists($fqcn) ? "$fqcn::$method" : $name;
271270
$parameters = implode(', ', $parameters ?: []);
@@ -290,7 +289,7 @@ function get_doc_blocks(): array
290289
}
291290

292291
if ($history !== []) {
293-
$markdown .= table_markdown($history, ['History', 'Version', 'Description']) . "\n\n";
292+
$markdown .= table_markdown($history, ['History', 'Version', 'Description'])."\n\n";
294293
}
295294

296295
$markdown .= "----------\n\n";

0 commit comments

Comments
 (0)