𧲠Relation Assertions â
toExtend() â
php
$this
->allClasses()
->fromRaw('<?php class Foo extends \Exception {}')
->should(fn(Expr $expr) => $expr->toExtend(Exception::class));toExtendsNothing() â
php
$this
->allClasses()
->fromRaw('<?php class Foo {}')
->should(fn(Expr $expr) => $expr->toExtendsNothing());toImplement() â
php
$this
->allClasses()
->fromRaw('<?php class Foo implements \ArrayAccess, \JsonSerializable {}')
->should(fn(Expr $expr) => $expr->toImplement(ArrayAccess::class));toImplementNothing() â
php
$this
->allClasses()
->fromRaw('<?php class Foo {}')
->should(fn(Expr $expr) => $expr->toImplementNothing());toOnlyImplement() â
php
$this
->allClasses()
->fromRaw('<?php class Foo implements \ArrayAccess {}')
->should(fn(Expr $expr) => $expr->toOnlyImplement(ArrayAccess::class));toUseTrait() â
php
$this
->allClasses()
->fromRaw('<?php class Foo { use Bar, Baz; }')
->should(fn(Expr $expr) => $expr->toUseTrait(Bar::class));toNotUseTrait() â
php
$this
->allClasses()
->fromRaw('<?php class Foo {}')
->should(fn(Expr $expr) => $expr->toNotUseTrait());toOnlyUseTrait() â
php
$this
->allClasses()
->fromRaw('<?php class Foo { use Bar; }')
->should(fn(Expr $expr) => $expr->toOnlyUseTrait(Bar::class));toHaveAttribute() â
php
$this
->allClasses()
->fromRaw('<?php #[\Deprecated] class Foo {}')
->should(fn(Expr $expr) => $expr->toHaveAttribute(Deprecated::class));toHaveNoAttribute() â
php
$this
->allClasses()
->fromRaw('<?php class Foo {}')
->should(fn(Expr $expr) => $expr->toHaveNoAttribute());toHaveOnlyAttribute() â
php
$this
->allClasses()
->fromRaw('<?php #[\Deprecated] class Foo {}')
->should(fn(Expr $expr) => $expr->toHaveOnlyAttribute(Deprecated::class));