This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Symfony/Component/VarDumper/Caster/DateCaster.php b/src/Symfony/Component/VarDumper/Caster/DateCaster.php | |
index 61d24b1..b078ecd 100644 | |
--- a/src/Symfony/Component/VarDumper/Caster/DateCaster.php | |
+++ b/src/Symfony/Component/VarDumper/Caster/DateCaster.php | |
@@ -23,17 +23,15 @@ class DateCaster | |
public static function castDate(\DateTimeInterface $d, array $a, Stub $stub, $isNested, $filter) | |
{ | |
$prefix = Caster::PREFIX_VIRTUAL; | |
+ $location = $d->getTimezone()->getLocation(); | |
+ $fromNow = (new \DateTime())->diff($d); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | |
+++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | |
@@ -157,6 +157,16 @@ class YamlFileLoader extends FileLoader | |
if (!is_array($content['services'])) { | |
throw new InvalidArgumentException(sprintf('The "services" key should contain an array in %s. Check your YAML syntax.', $file)); | |
} | |
+ | |
+ if (isset($content['services']['_instanceof'])) { | |
+ if (!is_array($types = $content['services']['_instanceof'])) { | |
+ throw new InvalidArgumentException(sprintf('The "_instanceof" key must contain an array, "%s" given in "%s".', gettype($types), $file)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example 1: add a tag or a setter based on implemented interfaces: | |
services: | |
_instanceof: | |
Psr\Log\LoggerAwareInterface: | |
calls: | |
- [setLogger, ['@logger']] | |
Symfony\Component\EventDispatcher\EventSubscriberInterface: | |
tags: [kernel.event_subscriber] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This file is part of the Symfony package. | |
* | |
* (c) Fabien Potencier <fabien@symfony.com> | |
* | |
* For the full copyright and license information, please view the LICENSE | |
* file that was distributed with this source code. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// A proposal for a future PHP version: builtin lazy variables | |
class foo | |
{ | |
function __construct(PDO $db) { | |
$this->db = $db; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// composer require blackfire/php-sdk | |
// search for XXX in the snippet below | |
while (isset($_SERVER['HTTP_X_BLACKFIRE_QUERY'])) { | |
$probe = \BlackfireProbe::getMainInstance(); | |
if (!$probe->disable()) { | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\VarDumper\Cloner\VarCloner; | |
use Symfony\Component\VarDumper\Dumper\CliDumper; | |
function dump($var) | |
{ | |
static $handler; | |
if (null === self::$handler) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$foo = function (): foo { | |
return new foo(); | |
}; | |
$foo instanceof foo; // => true | |
$foo->toto = 123; // $foo() is evaluated and is swapped to its return value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "nicolas-grekas/debug-helpers", | |
"description": "Global Debug Helpers for PHP", | |
"require": { | |
"symfony/var-dumper": "2.8.*@dev" | |
}, | |
"authors": [ | |
{ | |
"name": "Nicolas Grekas", | |
"email": "p@tchwork.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
go_version=$1 | |
go_arch=linux-amd64 | |
export GOPATH="$HOME/go" | |
if [ ! -e $GOPATH ] | |
then | |
mkdir $GOPATH |