di
di copied to clipboard
Cause error: Error: Cannot access trait constant self::CONTROL_FLASH_MESSAGE directly
Last change on this line cause an error.
https://github.com/nette/di/blob/f9ca71dac3701007dcdfa9a0b10c4d402d7c8965/src/DI/DependencyChecker.php#L182
Previous code works well
? is_object($tmp = Reflection::getParameterDefaultValue($param)) ? ['object' => $tmp::class] : ['value' => $tmp]
When I have a Presenter that use trait that contains the following code:
<?php
declare(strict_types=1);
namespace Interitty\FlashMessageControl;
use Nette\ComponentModel\IComponent as ComponentInterface;
use function assert;
trait FlashMessageControlHelperTrait
{
/** All available control name constants */
public const CONTROL_FLASH_MESSAGE = 'flashMessage';
/**
* Componentby name getter
*
* @param bool $throw Throw exception if component doesn't exist?
* @return ComponentInterface|null
*/
abstract public function getComponent(string $name, bool $throw = true): ?ComponentInterface;
/**
* FlashMessage control getter
*
* @param string $name [OPTIONAL]
* @return FlashMessageControl
*/
public function getComponentFlashMessage(string $name = self::CONTROL_FLASH_MESSAGE): FlashMessageControl
{
$control = $this->getComponent($name);
assert($control instanceof FlashMessageControl);
return $control;
}
}