class Flight {
// ...
public function bookSeat($seatNumber) {
// mark the seat as booked
}
// ...
}
class Flight {
// ...
/** @var string $seatNumber **/
public function bookSeat($seatNumber) {
// mark the seat as booked
}
// ...
}
class Flight {
// ...
public function bookSeat(string $seatNumber) {
// mark the seat as booked
}
// ...
}
class Flight {
// ...
public function bookSeat(string $seatNumber) {
// mark the seat as booked
}
// ...
}
class Flight {
// ...
public function bookSeat(string $seatNumber) {
// mark the seat as booked
}
// ...
}
$flight->bookSeat('A12');
class Flight {
// ...
public function bookSeat(string $seatNumber) {
// mark the seat as booked
}
// ...
}
$flight->bookSeat('Z23');
class Flight {
// ...
public function bookSeat(string $seatNumber) {
// mark the seat as booked
}
// ...
}
$flight->bookSeat('');
class Flight {
// ...
public function bookSeat(string $seatNumber) {
// mark the seat as booked
if (preg_match('/[A-C][1-9]{2}/', $seatNumber){
throw new \Exception('Invalid seat number');
}
}
// ...
}
class Flight {
// ...
public function bookSeat(string $seatNumber) {
// mark the seat as booked
if (preg_match('/[A-C][1-9]{2}/', $seatNumber){
throw new \Exception('Invalid seat number');
}
}
// ...
}
class Flight {
// ...
public function bookSeat(string $seatNumber) {
if (preg_match('/[A-C][1-9]{2}/', $seatNumber){
throw new \Exception('Invalid seat number');
}
// mark the seat as booked
}
// ...
}
class Purchase {
// ...
public function bookSeat(string $seatNumber) {
if (preg_match('/[A-C][1-9]{2}/', $seatNumber){
throw new \Exception('Invalid seat number');
}
// mark the seat as booked
}
// ...
}
mixed
string
?
seat-number
class Flight {
// ...
public function bookSeat(seat-number $seatNumber) {
// mark the seat as booked
}
}