Re-add syntax highlighting to daily emails and
...ATDC lessons
This commit is contained in:
parent
0d9bb37503
commit
5fbf48d9ac
48 changed files with 186 additions and 165 deletions
|
@ -14,7 +14,7 @@ In PHP, this is done by throwing an Exception if a condition is met.
|
|||
|
||||
For example:
|
||||
|
||||
```php
|
||||
```language-php
|
||||
if (!is_array(false)) {
|
||||
throw new \Exception('Not an array');
|
||||
}
|
||||
|
@ -22,13 +22,13 @@ if (!is_array(false)) {
|
|||
|
||||
There's also the `assert` construct which, since PHP 8.0, throws an Exception by default:
|
||||
|
||||
```php
|
||||
```language-php
|
||||
assert(is_array(false));
|
||||
```
|
||||
|
||||
You can also use an assertion library, such as `webmozart/assert` or `beberlei/assert` which provide assertions and guard methods:
|
||||
|
||||
```php
|
||||
```language-php
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
Assert::isArray(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue