It evaluates to the left operand if the left operand is truthy, and the right operand otherwise.
In pseudocode,
foo = bar ?: baz;
roughly resolves to
foo = bar ? bar : baz;
or
if (bar) {
foo = bar;
} else {
foo = baz;
}
with the difference that bar will only be evaluated once.
You can also use this to do a "self-check" of foo as demonstrated in the code example you posted:
foo = foo ?: bar;
This will assign bar to foo if foo is null or falsey, else it will leave foo unchanged.
Some more examples:
<?php
var_dump(5 ?: 0); // 5
var_dump(false ?: 0); // 0
var_dump(null ?: 'foo'); // 'foo'
var_dump(true ?: 123); // true
var_dump('rock' ?: 'roll'); // 'rock'
var_dump('' ?: 'roll'); // 'roll'
var_dump('0' ?: 'roll'); // 'roll'
var_dump('42' ?: 'roll'); // '42'
?>
By the way, it's called the Elvis operator.

It evaluates to the left operand if the left operand is truthy, and the right operand otherwise.
In pseudocode,
foo = bar ?: baz;
roughly resolves to
foo = bar ? bar : baz;
or
if (bar) {
foo = bar;
} else {
foo = baz;
}
with the difference that bar will only be evaluated once.
You can also use this to do a "self-check" of foo as demonstrated in the code example you posted:
foo = foo ?: bar;
This will assign bar to foo if foo is null or falsey, else it will leave foo unchanged.
Some more examples:
<?php
var_dump(5 ?: 0); // 5
var_dump(false ?: 0); // 0
var_dump(null ?: 'foo'); // 'foo'
var_dump(true ?: 123); // true
var_dump('rock' ?: 'roll'); // 'rock'
var_dump('' ?: 'roll'); // 'roll'
var_dump('0' ?: 'roll'); // 'roll'
var_dump('42' ?: 'roll'); // '42'
?>
By the way, it's called the Elvis operator.

See the docs:
Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression
expr1 ?: expr3returnsexpr1ifexpr1evaluates toTRUE, andexpr3otherwise.
Using ternary and null coalescing operators in PHP
Has there been any talk of an "empty" coalesce operator?
How is the Elvis operator different from the ternary operator in PHP?
$value = $x ? $x : 'default';
The Elvis operator skips the middle part and works like this:
$value = $x ?: 'default';
It only works if the left side is both the condition and the result.Can I use the Elvis operator with function returns?
$name = getUsername($id) ?: 'Guest';
If the function returns '' or null, it switches to 'Guest'.