.
This commit is contained in:
commit
a5ce423afe
30 changed files with 1807 additions and 0 deletions
66
tests/Classes/ParameterTypesClass.php
Normal file
66
tests/Classes/ParameterTypesClass.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue