Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: seven minus zero?
(Example: nine)

The Note You're Voting On

shaman_master at list dot ru
6 years ago
Also you may set return/arguments type declaring for abstract methods (PHP>=7.0)
<?php
declare(strict_types=1);

abstract class
Adapter
{
protected
$name;
abstract public function
getName(): string;
abstract public function
setName(string $value);
}

class
AdapterFoo extends Adapter
{
public function
getName(): string
{
return
$this->name;
}
// return type declaring not defined in abstract class, set here
public function setName(string $value): self
{
$this->name = $value;
return
$this;
}
}
?>

<< Back to user notes page

To Top