Skip to content

Commit

Permalink
better deprecation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 13, 2023
1 parent daab6a6 commit 6886892
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 28 deletions.
13 changes: 8 additions & 5 deletions src/PhpGenerator/ClassLike.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ abstract class ClassLike
VisibilityProtected = 'protected',
VisibilityPrivate = 'private';

/** @deprecated */
public const
VISIBILITY_PUBLIC = self::VisibilityPublic,
VISIBILITY_PROTECTED = self::VisibilityProtected,
VISIBILITY_PRIVATE = self::VisibilityPrivate;
/** @deprecated use ClassLike::VisibilityPublic */
public const VISIBILITY_PUBLIC = self::VisibilityPublic;

/** @deprecated use ClassLike::VisibilityProtected */
public const VISIBILITY_PROTECTED = self::VisibilityProtected;

/** @deprecated use ClassLike::VisibilityPrivate */
public const VISIBILITY_PRIVATE = self::VisibilityPrivate;

private ?PhpNamespace $namespace;
private ?string $name;
Expand Down
13 changes: 8 additions & 5 deletions src/PhpGenerator/PhpNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ final class PhpNamespace
NameFunction = 'f',
NameConstant = 'c';

/** @deprecated */
public const
NAME_NORMAL = self::NameNormal,
NAME_FUNCTION = self::NameFunction,
NAME_CONSTANT = self::NameConstant;
/** @deprecated use PhpNamespace::NameNormal */
public const NAME_NORMAL = self::NameNormal;

/** @deprecated use PhpNamespace::NameFunction */
public const NAME_FUNCTION = self::NameFunction;

/** @deprecated use PhpNamespace::NameConstant */
public const NAME_CONSTANT = self::NameConstant;

private string $name;

Expand Down
65 changes: 47 additions & 18 deletions src/PhpGenerator/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,53 @@ class Type
Parent = 'parent',
Static = 'static';

/** @deprecated */
public const
STRING = self::String,
INT = self::Int,
FLOAT = self::Float,
BOOL = self::Bool,
ARRAY = self::Array,
OBJECT = self::Object,
CALLABLE = self::Callable,
ITERABLE = self::Iterable,
VOID = self::Void,
NEVER = self::Never,
MIXED = self::Mixed,
FALSE = self::False,
NULL = self::Null,
SELF = self::Self,
PARENT = self::Parent,
STATIC = self::Static;
/** @deprecated use Type::String */
public const STRING = self::String;

/** @deprecated use Type::Int */
public const INT = self::Int;

/** @deprecated use Type::Float */
public const FLOAT = self::Float;

/** @deprecated use Type::Bool */
public const BOOL = self::Bool;

/** @deprecated use Type::Array */
public const ARRAY = self::Array;

/** @deprecated use Type::Object */
public const OBJECT = self::Object;

/** @deprecated use Type::Callable */
public const CALLABLE = self::Callable;

/** @deprecated use Type::Iterable */
public const ITERABLE = self::Iterable;

/** @deprecated use Type::Void */
public const VOID = self::Void;

/** @deprecated use Type::Never */
public const NEVER = self::Never;

/** @deprecated use Type::Mixed */
public const MIXED = self::Mixed;

/** @deprecated use Type::False */
public const FALSE = self::False;

/** @deprecated use Type::Null */
public const NULL = self::Null;

/** @deprecated use Type::Self */
public const SELF = self::Self;

/** @deprecated use Type::Parent */
public const PARENT = self::Parent;

/** @deprecated use Type::Static */
public const STATIC = self::Static;


public static function nullable(string $type, bool $state = true): string
Expand Down

0 comments on commit 6886892

Please sign in to comment.