Skip to content

Instantly share code, notes, and snippets.

View paveljanda's full-sized avatar

Pavel Janda paveljanda

View GitHub Profile
@paveljanda
paveljanda / Anonymous-ElasticsearchDataSource.php
Last active February 10, 2022 13:51
new class($this->elasticClient) extends ElasticsearchDataSource
<?php
const INDEX_NAME = 'users';
$dataSource = new class($this->elasticClient) extends ElasticsearchDataSource
{
public function __construct(Client $elasticClient)
{
parent::__construct(
$elasticClient,
@paveljanda
paveljanda / this-should-not-be-working.php
Created November 15, 2019 13:00
Current Type variance changes breaks the Liskov substitution principle
<?php
interface FuelType
{
}
class Gas implements FuelType
{
public function burn(int $litres) {}
<?php
/**
* @param int $item_id
* @param int|NULL $prev_id
* @param int|NULL $next_id
* @return void
*/
public function handleSort($item_id, $prev_id, $next_id)
{

Zadání pro lektory

  1. Vem kód,
  2. forkni ho,
  3. přidej 2 chyby.

Pak forky projedu a pospojuju.

Cílem je soubor o ~100 řádcích, tak přidávej metody a třídy!

<?php
namespace App\Presenters;
use Nette\Application\UI\Form;
class HomepagePresenter extends BasePresenter
{
public function createComponentForm($name)