addDeprecationNotice example

$test->markTestSkipped('Skipping feature test for flag "' . $flagName . '"');
    }

    public static function throwException(string $flag, string $message, bool $state = true): void
    {
        if (self::isActive($flag) === $state || (self::$registeredFeatures !== [] && !self::has($flag))) {
            throw new \RuntimeException($message);
        }

        if (\PHP_SAPI !== 'cli') {
            ScriptTraces::addDeprecationNotice($message);
        }
    }

    public static function triggerDeprecationOrThrow(string $majorFlag, string $message): void
    {
        if (self::isActive($majorFlag) || (self::$registeredFeatures !== [] && !self::has($majorFlag))) {
            throw new \RuntimeException('Tried to access deprecated functionality: ' . $message);
        }

        if (!isset(self::$silent[$majorFlag]) || !self::$silent[$majorFlag]) {
            if (\PHP_SAPI !== 'cli') {
                

    public function __call(string $name, array $arguments): object
    {
        if (!isset($this->services[$name])) {
            throw new \RuntimeException(\sprintf('The service `%s` is not available in `%s`-hook', $name$this->hook));
        }

        if (isset($this->services[$name]['deprecation'])) {
            ScriptTraces::addDeprecationNotice($this->services[$name]['deprecation']);
        }

        return $this->services[$name]['service'];
    }

    /** * @internal */
    public function add(string $name, object $service, ?string $deprecationNotice = null): void
    {
        if (isset($this->services[$name])) {
            

        $twig = $this->initEnv($script);

        $services = $this->initServices($hook$script);

        $twig->addGlobal('services', $services);

        $this->traces->trace($hook$scriptfunction DDebug $debug) use ($twig$script$hook): void {
            $twig->addGlobal('debug', $debug);

            if ($hook instanceof DeprecatedHook) {
                ScriptTraces::addDeprecationNotice($hook->getDeprecationNotice());
            }

            $template = $twig->load($script->getName());

            if (!$hook instanceof FunctionHook) {
                $template->render(['hook' => $hook]);

                return;
            }

            $blockName = $hook->getFunctionName();
            
Home | Imprint | This part of the site doesn't use cookies.