Skip to content

Instantly share code, notes, and snippets.

@rockoo
Created April 30, 2020 19:27
Show Gist options
  • Save rockoo/7d49b083aee13b504f76925d28abdeb4 to your computer and use it in GitHub Desktop.
Save rockoo/7d49b083aee13b504f76925d28abdeb4 to your computer and use it in GitHub Desktop.
Nonesenical example for an Medium article on Stack Traces
<?php
namespace Poker;
class Deck
{
protected $deck = null;
public function __construct(int $cards = 52)
{
$this->deck = range(0, $cards);
}
private function _shuffle(): Deck
{
\shufflr($this->deck);
return $this;
}
private function _log(): bool
{
return true;
}
public function deal(): array
{
$this->_log(); // Pass
$this->_shuffle(); // Fail
}
}
(new Deck)->deal();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment