Skip to content

Instantly share code, notes, and snippets.

View localheinz's full-sized avatar

Andreas Möller localheinz

View GitHub Profile
<?php
interface Sleeper
{
public function sleep(int $seconds): void;
}
final class SystemSleeper implements Sleeper
{
public function sleep(int $seconds): void
@localheinz
localheinz / documentation.yml
Last active January 17, 2020 15:15
Workflow for regenerating the documentation on a push to master
name: Regenerate documentation
on:
push:
branches:
- master
jobs:
setup:
name: Regenerate documentation
@localheinz
localheinz / actual-events.md
Last active October 30, 2019 07:47
List of interesting events for the PHPUnit event sub-system

Actual Events

  • Application\Started (in Command::main())

  • Application\Configured (in Command::handleArguments())

  • Bootstrap\Finished (in Command::handleBootstrap())

  • TestSuite\Loaded (in BaseTestRunner::getTest())

  • TestSuite\Configured (in TestRunner::doRun(), after handleConfiguration())

  • TestSuite\Sorted (in TestRunner::doRun())

  • Extension\Loaded (in TestRunner::doRun())

@localheinz
localheinz / docker-after.yml
Last active September 8, 2019 09:42
GitHub Actions Feature Request: Run job only on `push` to configured branch
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
on:
push:
branch: master
name: Docker
jobs:
docker:
@localheinz
localheinz / Dominoes.php
Created February 20, 2017 11:52
Dominoes Length of Longest Chain Solution (PHP)
<?php
declare(strict_types=1);
final class Dominoes
{
public function maxLength(string $string): int
{
/** @var Tile[] $tiles */
$tiles = \array_map(function ($tile) {
@localheinz
localheinz / FullDeck.php
Created February 20, 2017 11:23
Full Decks Solution (PHP)
<?php
declare(strict_types=1);
final class FullDeck
{
public function cards(): array
{
static $cards;
@localheinz
localheinz / Meagrams.php
Created February 20, 2017 11:16
Meagram Solution (PHP)
<?php
declare(strict_types=1);
final class Meagrams
{
/**
* @var string[]
*/
private $words;
@localheinz
localheinz / keybase.md
Created April 8, 2016 15:05
keybase.md

Keybase proof

I hereby claim:

  • I am localheinz on github.
  • I am localheinz (https://keybase.io/localheinz) on keybase.
  • I have a public key ASDTAW1l_75Ox6sSn-zaqbAzJdM34x_z9HObGxv7w7cm1Ao

To claim this, I am signing this object:

@localheinz
localheinz / FooTest.php
Last active August 29, 2015 14:13
How can you mark a test as skipped if the annotated data provider returns an empty array?
<?php
namespace Foo;
class BarTest extends PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (null === $this->providerBaz()) {