Argument Class
AntonDPerera\PHPAttributesReader\Argument<?php
declare(strict_types=1);
#[TestAttribute11(["key1" => "key1 value"])]
#[TestAttribute12(10.13)]
#[TestAttribute13(123)]
#[TestAttribute14()]
#[TestAttribute15(["value1", "value2"])]
class Abc
{
// rest of the codes
}<?php
declare(strict_types=1);
use \AntonDPerera\PHPAttributesReader\AttributesReader;
$class = Abc::class;
$attributes_reader = AttributesReader($class);
//This will return instance of AntonDPerera\PHPAttributesReader\Attribute
$attribute = $attributes_reader->getClassAttribute("TestAttribute11");
$arguments = $attribute->getArguments();
echo $arguments[0]->getType(); // return the value of constant Argument::ARGUMENT_VALUE_TYPE_ASSOCIATIVE_ARRAY
var_dump($arguments[0]->getValue()); // return array("key1" => "key1 value")
Available functions in Argument class
Last updated