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 | |
// 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 | |
/* | |
* 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
# 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
--- 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
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
<?php | |
// Very early draft. Not applicable yet. | |
// TODO: specify behavior for __destruct() | |
// Only public methods/properties can be intercepted, final ones also | |
// Magic methods are intercepted as regular ones | |
// Undefined properties/methods access are excluded from interception | |
// method_exists()/property_exists()/isset() are excluded from interception |
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 | |
error_reporting(-1); | |
require 'vendor/autoload.php'; | |
/** | |
* This is the core interface. It already allows building dispatchers *and middlewareHandlers*. | |
*/ | |
interface MessageBusInterface | |
{ |
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/Compiler/AutowirePass.php | |
+++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php | |
@@ -193,7 +193,7 @@ class AutowirePass extends AbstractRecursivePass | |
continue; | |
} | |
- $type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, true); | |
+ $type = ltrim(ProxyHelper::getTypeHint($reflectionMethod, $parameter, false), '\\'); | |
if (!$type) { |
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
parameters: | |
env(SECRETS_FILE): .secrets.php | |
services: | |
# default configuration for services in *this* file | |
_defaults: | |
autowire: true # Automatically injects dependencies in your services. | |
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. | |
bind: | |
$someSecret: '%env(key:KEY3:require:SECRETS_FILE)%' |