Skip to content

Commit

Permalink
added some deprecation notices
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 30, 2024
1 parent 092b6f9 commit f564731
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Forms/Controls/CsrfProtection.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
class CsrfProtection extends HiddenField
{
public const Protection = 'Nette\Forms\Controls\CsrfProtection::validateCsrf';

/** @deprecated use CsrfProtection::Protection */
public const PROTECTION = self::Protection;

public ?Nette\Http\Session $session = null;
Expand Down
1 change: 1 addition & 0 deletions src/Forms/Controls/MultiSelectBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function getControl(): Nette\Utils\Html
}


/** @deprecated use setOptionAttribute() */
public function addOptionAttributes(array $attributes): static
{
$this->optionAttributes = $attributes + $this->optionAttributes;
Expand Down
3 changes: 3 additions & 0 deletions src/Forms/Controls/SelectBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class SelectBox extends ChoiceControl
{
/** validation rule */
public const Valid = ':selectBoxValid';

/** @deprecated use SelectBox::Valid */
public const VALID = self::Valid;

/** of option / optgroup */
Expand Down Expand Up @@ -103,6 +105,7 @@ public function getControl(): Nette\Utils\Html
}


/** @deprecated use setOptionAttribute() */
public function addOptionAttributes(array $attributes): static
{
$this->optionAttributes = $attributes + $this->optionAttributes;
Expand Down
2 changes: 2 additions & 0 deletions src/Forms/Controls/UploadControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class UploadControl extends BaseControl
{
/** validation rule */
public const Valid = ':uploadControlValid';

/** @deprecated use UploadControl::Valid */
public const VALID = self::Valid;


Expand Down
67 changes: 67 additions & 0 deletions src/Forms/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,39 +83,106 @@ class Form extends Container implements Nette\HtmlStringable
/** @internal protection token ID */
public const ProtectorId = '_token_';

/** @deprecated use Form::Equal */
public const EQUAL = self::Equal;

/** @deprecated use Form::IsIn */
public const IS_IN = self::IsIn;

/** @deprecated use Form::NotEqual */
public const NOT_EQUAL = self::NotEqual;

/** @deprecated use Form::IsNotIn */
public const IS_NOT_IN = self::IsNotIn;

/** @deprecated use Form::Filled */
public const FILLED = self::Filled;

/** @deprecated use Form::Blank */
public const BLANK = self::Blank;

/** @deprecated use Form::Required */
public const REQUIRED = self::Required;

/** @deprecated use Form::Valid */
public const VALID = self::Valid;

/** @deprecated use Form::Submitted */
public const SUBMITTED = self::Submitted;

/** @deprecated use Form::MinLength */
public const MIN_LENGTH = self::MinLength;

/** @deprecated use Form::MaxLength */
public const MAX_LENGTH = self::MaxLength;

/** @deprecated use Form::Length */
public const LENGTH = self::Length;

/** @deprecated use Form::Email */
public const EMAIL = self::Email;

/** @deprecated use Form::Pattern */
public const PATTERN = self::Pattern;

/** @deprecated use Form::PatternCI */
public const PATTERN_ICASE = self::PatternInsensitive;

/** @deprecated use Form::Integer */
public const INTEGER = self::Integer;

/** @deprecated use Form::Numeric */
public const NUMERIC = self::Numeric;

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

/** @deprecated use Form::Min */
public const MIN = self::Min;

/** @deprecated use Form::Max */
public const MAX = self::Max;

/** @deprecated use Form::Range */
public const RANGE = self::Range;

/** @deprecated use Form::Count */
public const COUNT = self::Count;

/** @deprecated use Form::MaxFileSize */
public const MAX_FILE_SIZE = self::MaxFileSize;

/** @deprecated use Form::MimeType */
public const MIME_TYPE = self::MimeType;

/** @deprecated use Form::Image */
public const IMAGE = self::Image;

/** @deprecated use Form::MaxPostSize */
public const MAX_POST_SIZE = self::MaxPostSize;

/** @deprecated use Form::Get */
public const GET = self::Get;

/** @deprecated use Form::Post */
public const POST = self::Post;

/** @deprecated use Form::DataText */
public const DATA_TEXT = self::DataText;

/** @deprecated use Form::DataLine */
public const DATA_LINE = self::DataLine;

/** @deprecated use Form::DataFile */
public const DATA_FILE = self::DataFile;

/** @deprecated use Form::DataKeys */
public const DATA_KEYS = self::DataKeys;

/** @deprecated use Form::TrackerId */
public const TRACKER_ID = self::TrackerId;

/** @deprecated use Form::ProtectorId */
public const PROTECTOR_ID = self::ProtectorId;

/**
Expand Down
1 change: 1 addition & 0 deletions src/Forms/Rendering/DataClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class DataClassGenerator
/** @deprecated use Nette\Latte\Blueprint::dataClass() */
public function generateCode(Form $form, ?string $baseName = null): string
{
trigger_error(__METHOD__ . '() is deprecated, use ' . Blueprint::class . '::dataClass()', E_USER_DEPRECATED);
return (new Blueprint)->generateDataClass($form, $this->propertyPromotion, $baseName);
}
}
1 change: 1 addition & 0 deletions src/Forms/Rendering/LatteRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ final class LatteRenderer
/** @deprecated use Nette\Latte\Blueprint::latte() */
public function render(Form $form): string
{
trigger_error(__METHOD__ . '() is deprecated, use ' . Blueprint::class . '::latte()', E_USER_DEPRECATED);
return (new Blueprint)->generateLatte($form);
}
}

0 comments on commit f564731

Please sign in to comment.