66 lines
1.3 KiB
PHP
66 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Classes;
|
|
|
|
use Tests\Aspects\TrackingAspect;
|
|
|
|
class ParameterTypesClass
|
|
{
|
|
#[TrackingAspect]
|
|
public function withNullable(?string $value): ?string
|
|
{
|
|
return $value;
|
|
}
|
|
|
|
#[TrackingAspect]
|
|
public function withVariadic(string ...$items): array
|
|
{
|
|
return $items;
|
|
}
|
|
|
|
#[TrackingAspect]
|
|
public function withReference(int &$counter): void
|
|
{
|
|
$counter++;
|
|
}
|
|
|
|
#[TrackingAspect]
|
|
public function withUnionType(int|string $value): int|string
|
|
{
|
|
return $value;
|
|
}
|
|
|
|
#[TrackingAspect]
|
|
public function withMixed(mixed $data): mixed
|
|
{
|
|
return $data;
|
|
}
|
|
|
|
#[TrackingAspect]
|
|
public function withArray(array $data): array
|
|
{
|
|
return array_merge($data, ['processed' => true]);
|
|
}
|
|
|
|
#[TrackingAspect]
|
|
public function withDefaultValues(string $name = 'default', int $age = 0): string
|
|
{
|
|
return "$name:$age";
|
|
}
|
|
|
|
#[TrackingAspect]
|
|
public function voidReturn(): void
|
|
{
|
|
}
|
|
|
|
#[TrackingAspect]
|
|
protected function protectedMethod(string $value): string
|
|
{
|
|
return strtoupper($value);
|
|
}
|
|
|
|
public function callProtected(string $value): string
|
|
{
|
|
return $this->protectedMethod($value);
|
|
}
|
|
}
|