PHP Serializable interface

Code
<?php

class Foo implements Serializable
{
    private 
$foo;
    
    private 
$bar;
    
    private 
$isCreatedBySerialization false;
    
    public function 
__construct(int $fooint $bar)
    {
        
$this->foo $foo;
        
$this->bar $bar;
    }
    
    public function 
serialize()
    {
        return 
serialize([
            
'foo' => $this->foo,
            
'bar' => $this->bar,
        ]);
    }
    
    public function 
unserialize($serialized)
    {
        
$unserialized unserialize($serialized);
        
$this->foo $unserialized['foo'];
        
$this->bar $unserialized['bar'];
        
$this->isCreatedBySerialization true;
    }
}

$foo = new Foo(36);
dump($foo);

dump($serializedFoo serialize($foo));
dump(unserialize($serializedFoo));
Result
Foo {#371
-foo: 3
-bar: 6
-isCreatedBySerialization: false
}

"C:3:"Foo":34:{a:2:{s:3:"foo";i:3;s:3:"bar";i:6;}}"

Foo {#373
-foo: 3
-bar: 6
-isCreatedBySerialization: true
}
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6