Skip to content

Commit 4282c7a

Browse files
committed
docs: replace empty()
Using empty() is not a good practice.
1 parent 7a2da33 commit 4282c7a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

user_guide_src/source/tutorial/news_section/005.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h2><?= esc($title) ?></h2>
22

3-
<?php if (! empty($news) && is_array($news)): ?>
3+
<?php if ($news !== []): ?>
44

55
<?php foreach ($news as $news_item): ?>
66

user_guide_src/source/tutorial/news_section/006.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function show($slug = null)
1515

1616
$data['news'] = $model->getNews($slug);
1717

18-
if (empty($data['news'])) {
18+
if ($data['news'] === null) {
1919
throw new PageNotFoundException('Cannot find the news item: ' . $slug);
2020
}
2121

0 commit comments

Comments
 (0)