Skip to content

Instantly share code, notes, and snippets.

View Zayon's full-sized avatar

Pablo Godinez Zayon

  • Evaneos
  • Lyon, France
View GitHub Profile
@Zayon
Zayon / Product.php
Created December 31, 2018 13:27
Fixtures - Entities
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository")
*/
class Product
@Zayon
Zayon / FixtureContext.php
Last active November 23, 2018 17:07
Step 2 - FixtureContext
<?php
declare(strict_types=1);
use Behat\Behat\Context\Context;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Fidry\AliceDataFixtures\LoaderInterface;
class FixtureContext implements Context
{
@Zayon
Zayon / FixtureContext.php
Created November 23, 2018 15:21
Step 1 - FixtureContext.php
<?php
declare(strict_types=1);
use Behat\Behat\Context\Context;
class FixtureContext implements Context
{
// Empty for now
}
@Zayon
Zayon / Step1-FixtureContext.php
Last active November 11, 2018 19:07
Fixtures in Symfony 4
<?php
declare(strict_types=1);
use Behat\Behat\Context\Context;
class FixtureContext implements Context
{
// Empty for now
}
@Zayon
Zayon / shortlist
Last active April 10, 2018 13:02
PHP backslash function shortlist
"array_slice"
"assert"
"boolval"
"call_user_func"
"call_user_func_array"
"chr"
"count"
"defined"
"doubleval"
"floatval"
@Zayon
Zayon / solutions.md
Last active February 16, 2018 14:37
@Zayon
Zayon / pre-commit
Created October 25, 2017 14:19
pre-commit php-cs-fixer
#!/usr/bin/env bash
ROOT=$(git rev-parse --show-toplevel)
cd "$ROOT"
git --git-dir "$ROOT"/.git --work-tree "$ROOT" status --porcelain | grep -e '^[AM]\(.*\).php$' | cut -c 3- | while read line; do
bin/php-cs-fixer fix --dry-run --diff --no-ansi --verbose "$line"
if [ $? -ne 0 ]; then
exit 1
fi