wolfenste / tictactoe

0 stars 0 forks source link

Value Object Mark doesn't do any validation #5

Closed flavius closed 6 years ago

flavius commented 6 years ago

The constructor:

    public function __construct (char $mark) : void {
    $this->mark = $mark;
    }

Does not do any validation: it accepts any character.

You should actually check if it's 'X' or '0' and throw an exception otherwise.

Also, constructors don't need a return type, as they never return anything, the object is already constructed by the time __construct is called. A better name for "constructor" would be "initializer".