Skip to content

Commit 0a277da

Browse files
committed
ClassType: getType() is deprecated
1 parent e602704 commit 0a277da

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

src/PhpGenerator/ClassType.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ final class ClassType extends ClassLike
2929
TYPE_TRAIT = 'trait',
3030
TYPE_ENUM = 'enum';
3131

32-
private string $type = self::TYPE_CLASS;
3332
private bool $final = false;
3433
private bool $abstract = false;
3534
private ?string $extends = null;
@@ -82,28 +81,11 @@ public function __construct(?string $name = null, ?PhpNamespace $namespace = nul
8281
}
8382

8483

85-
public function isClass(): bool
86-
{
87-
return $this->type === self::TYPE_CLASS;
88-
}
89-
90-
91-
public function isInterface(): bool
92-
{
93-
return $this->type === self::TYPE_INTERFACE;
94-
}
95-
96-
97-
public function isTrait(): bool
98-
{
99-
return $this->type === self::TYPE_TRAIT;
100-
}
101-
102-
10384
/** @deprecated */
10485
public function getType(): string
10586
{
106-
return $this->type;
87+
trigger_error(__METHOD__ . "() is deprecated, method always returns 'class'", E_USER_DEPRECATED);
88+
return self::TYPE_CLASS;
10789
}
10890

10991

src/PhpGenerator/Printer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function printClass(
233233
}
234234

235235
$line[] = match (true) {
236-
$class instanceof ClassType => $class->getName() ? $class->getType() . ' ' . $class->getName() : null,
236+
$class instanceof ClassType => $class->getName() ? 'class ' . $class->getName() : null,
237237
$class instanceof InterfaceType => 'interface ' . $class->getName(),
238238
$class instanceof TraitType => 'trait ' . $class->getName(),
239239
$class instanceof EnumType => 'enum ' . $class->getName() . ($enumType ? $this->returnTypeColon . $enumType : ''),

0 commit comments

Comments
 (0)