Skip to content

Commit abf7e37

Browse files
committed
Cleanup
1 parent 1bc0a94 commit abf7e37

File tree

1 file changed

+9
-10
lines changed
  • exercises/a-safe-space-for-nulls/problem

1 file changed

+9
-10
lines changed

exercises/a-safe-space-for-nulls/problem/problem.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ With the null safe operator it is possible to access variables like so:
1010
$capitalPopulation = $country?->capital?->population;
1111
```
1212

13-
If the `capital` property is null, the variable `$capitalPopulation` will also be null. Previously, without the null safe operator, this would be achieved like so:
13+
If the `$capital` property is null, the variable `$capitalPopulation` will also be null. Previously, without the null safe operator, this would be achieved like so:
1414

1515
```php
1616
$capitalPopulation = null;
@@ -44,25 +44,24 @@ Export the `$user` data to a CSV with the following columns:
4444

4545
`First Name`, `Last Name`, `Age`, `House num`, `Addr 1`, `Addr 2`
4646

47-
* The CSV should be comma delimited
48-
* The columns should read exactly as above, any mistake will trigger a failure
49-
* There should be one row for the column headers and one for the data
50-
* Any properties which are null on the user should be printed as empty fields in the CSV
51-
* The file should be named `users.csv` and exist next to your submission file (eg in the same directory)
47+
* The CSV should be comma delimited.
48+
* The columns should read exactly as above, any mistake will trigger a failure.
49+
* There should be one row for the column headers and one for the data.
50+
* Any properties which are null on the user should be printed as empty fields in the CSV.
51+
* The file should be named `users.csv` and exist next to your submission file (eg in the same directory).
5252

5353
And finally, the most important part, all properties which may be `NULL` should be accessed using the null safe operator!
5454

5555
### Advantages of the null safe operator
5656

57-
* Much less code for simple operations where null is a valid value
57+
* Much less code for simple operations where null is a valid value.
5858
* If the operator is part of a chain anything to the right of the null will not be executed, the statements will be short-circuited.
59-
* Can be used on methods where null coalescing cannot `$user->getCreatedAt()->format() ?? null` where `getCreatedAt()` could return null or a `\DateTime` instance
59+
* Can be used on methods where null coalescing cannot `$user->getCreatedAt()->format() ?? null` where `getCreatedAt()` could return null or a `\DateTime` instance.
6060

6161
----------------------------------------------------------------------
6262
## HINTS
6363

64-
Remember your program will be passed no arguments. There will be a `User` object populated for you under the variable `$user`.
65-
It is available at the beginning of your script.
64+
Remember your program will be passed no arguments. There will be a `User` object populated for you under the variable `$user`. It is available at the beginning of your script.
6665

6766
Documentation on the Null Safe Operator can be found by pointing your browser here:
6867
[https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.nullsafe]()

0 commit comments

Comments
 (0)