Flaw in the documentation about content from database example

In the documentation about creating virtual pages out of content from database, there is the code for an example model comment.php containing the class CommentPage. In this class, there is a method writeContent() which does not work as expected. It is unable to insert new content into the database. IMHO it should rather read

    public function writeContent(array $data, string $languageCode = null): bool {
        unset($data['title']);
        
        if ($comment = Db::first('comments', '*', ['slug' => $this->slug()])) {
            return Db::update('comments', $data, ['slug' => $this->slug()]);
        } else {
            $data['slug'] = $this->slug();
            return Db::insert('comments', $data) !== 0; // instead of just return Db::insert('comments', $data)
        }        
    }

Just for clarification:

In an “oldschool” PHP environment, the code snippet mentioned should work anyway, because the int return value would be interpreted as (bool) false.

In my environment, I’m using the directive declare(strict_types = 1); in every php file in order to protect myself from inadvertendly introducing error-prone type juggling. Consequently, running the code snippet as in the documentation, I got an error saying "returned int, expected bool".

This was not meant to be offensive. Not being aware that many users obviously do not employ that strict_types option, I thought the code snippet was erroneous.

Hm, there is an inconsistency in the return values between Db::insert() (returns 0 instead of false on failure) and the underlying db::table($table)->insert($data) method.

That’s why I ran into an error and felt the necessity to document that behavior. But as I sad: in many environments that don’t check strictly, that kind of error goes unnoticed.