Skip to content

Instantly share code, notes, and snippets.

Sergey Protko fesor

Block or report user

Report or block fesor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fesor
fesor / README.md
Created Jul 25, 2018
Symfony without ORM
View README.md

Удобный менеджмент миграций с Symfony и Doctrine

Мало кто знает, но что бы работал migration:diff вам не нужно ставить ORM.

Что бы это работало объявим простой сервис:

<?php
@fesor
fesor / ContainerReturnTypePlugin.php
Last active Oct 31, 2018
Phan plugins for Symfony and Doctrine
View ContainerReturnTypePlugin.php
<?php
use Phan\CodeBase;
use Phan\Language\Context;
use Phan\Language\UnionType;
use Phan\PluginV2\ReturnTypeOverrideCapability;
use Phan\Language\Element\Method;
use Phan\PluginV2;
use \Phan\Language\FQSEN\FullyQualifiedClassName;
use Phan\Language\Element\Clazz;
@fesor
fesor / pre-commit
Last active Jul 29, 2019
php-cs-fixer pre-commit hook
View pre-commit
#!/usr/bin/env bash
echo "php-cs-fixer pre commit hook start"
PHP_CS_FIXER="bin/php-cs-fixer"
PHP_CS_CONFIG=".php_cs"
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM -- '*.php')
if [ -n "$CHANGED_FILES" ]; then
$PHP_CS_FIXER fix --config "$PHP_CS_CONFIG" $CHANGED_FILES;
git add $CHANGED_FILES;
@fesor
fesor / ARTICLE.md
Created Aug 19, 2017
Возвращаясь к основам: почему юнит тесты это сложно
View ARTICLE.md

https://simpleprogrammer.com/2010/12/12/back-to-basics-why-unit-testing-is-hard/

Back to Basics: Why Unit Testing is Hard

перевод адаптирован под 2017-ый, где у нас нет проблем с mock фреймворками, и нам не обязательно создавать интерфейс дабы сделать мок.

Возвращаясь к основам: почему юнит тесты это сложно

@fesor
fesor / AppExtension.php
Created Aug 18, 2016
Symfony: Service auto registration
View AppExtension.php
<?php
namespace App\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Finder\Finder;
class AppExtension extends Extension
{
View Scope.php
<?php
namespace Fesor\Caffeine;
final class Scope
{
private $payload;
private $parent;
View DefaultMyStuffMaker.php
<?php
class DefaultMyStuffMaker implements MyStuffMaker
{
private $dependency;
public function __construct(SomeDependency $dependency)
{
$this->dependency = $dependency;
}
@fesor
fesor / LINKS.md
Last active Jun 4, 2019
Годное чтиво
View LINKS.md
@fesor
fesor / README.md
Last active Jan 29, 2019
Symfony Request Object
View README.md

Symfony Request Object

This is proof-of-concept implementation of laravel's like form requests.

Rational

Most of Symfony developers uses forms to map request data to some Data Transfer Object. This object then passes to validator and system start to work with validated data converted to be compatible with application model.

You can’t perform that action at this time.