Skip to content

Commit be7ae31

Browse files
committed
address automated feedback
1 parent 7b1e32b commit be7ae31

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

drafts/records.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ typed parameters that become public, immutable, properties.
7777
They may optionally implement an interface using the `implements` keyword.
7878
A `record` body is optional.
7979

80-
A `record` may contain a constructor with zero arguments to perform further initialization, if required.
80+
A `record` may contain a constructor with zero arguments to perform further initialization if required.
8181
If it does not have a constructor, an implicit, empty contstructor is provided.
8282

8383
A `record` body may contain property hooks, methods, and use traits (so long as they do not conflict with `record`
@@ -226,7 +226,7 @@ However, immutability and special instantiation rules will be enforced.
226226

227227
#### ReflectionClass support
228228

229-
`ReflectionClass` can be used to inspect records, their properties, and methods. Any attempt to modify record properties
229+
It can be used to inspect records, their properties, and methods. Any attempt to modify record properties
230230
via reflection will throw an exception, maintaining immutability. Attempting to create a new instance via
231231
`ReflectionClass` will cause a `ReflectionException` to be thrown.
232232

@@ -288,12 +288,12 @@ record(Point)#1 (2) {
288288
A `record` cannot be named after an existing `record`, `class` or `function`. This is because defining a `record`
289289
creates both a `class` and a `function` with the same name.
290290

291-
### Auto loading
291+
### Autoloading
292292

293293
As invoking a record value by its name looks remarkably similar to calling a function,
294-
and PHP has no function autoloader, auto loading will not be supported in this implementation.
295-
If function auto loading were to be implemented in the future, an autoloader could locate the `record` and autoload it.
296-
The author of this RFC strongly encourages someone to put forward a function auto loading RFC if auto loading is desired for records.
294+
and PHP has no function autoloader, autoloading will not be supported in this implementation.
295+
If function autoloading were to be implemented in the future, an autoloader could locate the `record` and autoload it.
296+
The author of this RFC strongly encourages someone to put forward a function autoloading RFC if autoloading is desired for records.
297297

298298
## Backward Incompatible Changes
299299

@@ -327,7 +327,7 @@ None
327327

328328
## Open Issues
329329

330-
Todo
330+
To-do
331331

332332
## Unaffected PHP Functionality
333333

published/records.ptxt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $uid = $user->id;
2626
// ...
2727
$uid = 5; // somehow accidentally sets uid to an unrelated integer
2828
// ...
29-
updateUserRole($uid, Role::ADMIN()); // accidental passing of
29+
updateUserRole($uid, Role::ADMIN()); // accidental passing of
3030
</code>
3131

3232
In this example, the uid is accidentally set to a plain integer, and updateUserRole is called with the wrong value.
@@ -64,7 +64,7 @@ This RFC proposes the introduction of a new record keyword in PHP to define immu
6464

6565
A ''%%record%%'' is defined by the word "record", followed by the name of its type, an open parenthesis containing one or more typed parameters that become public, immutable, properties. They may optionally implement an interface using the ''%%implements%%'' keyword. A ''%%record%%'' body is optional.
6666

67-
A ''%%record%%'' may contain a constructor with zero arguments to perform further initialization, if required. If it does not have a constructor, an implicit, empty contstructor is provided.
67+
A ''%%record%%'' may contain a constructor with zero arguments to perform further initialization if required. If it does not have a constructor, an implicit, empty contstructor is provided.
6868

6969
A ''%%record%%'' body may contain property hooks, methods, and use traits (so long as they do not conflict with ''%%record%%'' rules). Regular properties may also be defined, but they are immutable by default and are no different from ''%%const%%''.
7070

@@ -89,7 +89,7 @@ record PaintBucket(StockPaint ...$constituents) {
8989
public function mixIn(StockPaint $paint): PaintBucket {
9090
return $this->with(...$this->constituents, $paint);
9191
}
92-
92+
9393
public function color(): Pigment {
9494
return array_reduce($this->constituents, fn($color, $paint) => $color->mix($paint->color, $paint->volume), Pigment(0, 0, 0));
9595
}
@@ -151,7 +151,7 @@ record User(string $name, string $email) {
151151
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
152152
throw new InvalidArgumentException("Invalid email address");
153153
}
154-
154+
155155
$this->id = hash('sha256', $email);
156156
$this->name = ucwords($name);
157157
}
@@ -190,7 +190,7 @@ Records in PHP will be fully supported by the reflection API, providing access t
190190

191191
=== ReflectionClass support ===
192192

193-
''%%ReflectionClass%%'' can be used to inspect records, their properties, and methods. Any attempt to modify record properties via reflection will throw an exception, maintaining immutability. Attempting to create a new instance via ''%%ReflectionClass%%'' will cause a ''%%ReflectionException%%'' to be thrown.
193+
It can be used to inspect records, their properties, and methods. Any attempt to modify record properties via reflection will throw an exception, maintaining immutability. Attempting to create a new instance via ''%%ReflectionClass%%'' will cause a ''%%ReflectionException%%'' to be thrown.
194194

195195
<code php>
196196
$point = Point(3, 4);
@@ -249,9 +249,9 @@ record(Point)#1 (2) {
249249

250250
A ''%%record%%'' cannot be named after an existing ''%%record%%'', ''%%class%%'' or ''%%function%%''. This is because defining a ''%%record%%'' creates both a ''%%class%%'' and a ''%%function%%'' with the same name.
251251

252-
==== Auto loading ====
252+
==== Autoloading ====
253253

254-
As invoking a record value by its name looks remarkably similar to calling a function, and PHP has no function autoloader, auto loading will not be supported in this implementation. If function auto loading were to be implemented in the future, an autoloader could locate the ''%%record%%'' and autoload it. The author of this RFC strongly encourages someone to put forward a function auto loading RFC if auto loading is desired for records.
254+
As invoking a record value by its name looks remarkably similar to calling a function, and PHP has no function autoloader, autoloading will not be supported in this implementation. If function autoloading were to be implemented in the future, an autoloader could locate the ''%%record%%'' and autoload it. The author of this RFC strongly encourages someone to put forward a function autoloading RFC if autoloading is desired for records.
255255

256256
===== Backward Incompatible Changes =====
257257

@@ -285,7 +285,7 @@ None
285285

286286
===== Open Issues =====
287287

288-
Todo
288+
To-do
289289

290290
===== Unaffected PHP Functionality =====
291291

0 commit comments

Comments
 (0)