Skip to content

Commit

Permalink
cleaned up generics in html interfaces to reflect attribute value typ…
Browse files Browse the repository at this point in the history
…e as well as valtester data type. Removed MakeVoidTag method from TagFactoryInterface
  • Loading branch information
dwilbourne committed Aug 26, 2024
1 parent 2214392 commit d08075e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/frmtr/html/FrmtrHtmlInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@

use pvc\interfaces\frmtr\FrmtrInterface;
use pvc\interfaces\frmtr\msg\FrmtrMsgInterface;
use pvc\interfaces\html\tag\TagInterface;
use pvc\interfaces\html\tag\TagVoidInterface;
use pvc\interfaces\intl\LocaleInterface;

/**
* Class FrmtrHtmlInterface
* @template AttributeValueType
* @extends FrmtrInterface<TagInterface|TagVoidInterface<AttributeValueType>>
* @template ValTesterType
* @extends FrmtrInterface<TagVoidInterface<AttributeValueType, ValTesterType>>
*/
interface FrmtrHtmlInterface extends FrmtrInterface
{
/**
* format
* @param TagInterface<AttributeValueType>|TagVoidInterface<AttributeValueType> $value
* @param TagVoidInterface<AttributeValueType, ValTesterType> $value
* @return string
*/
public function format($value): string;
Expand Down
5 changes: 3 additions & 2 deletions src/html/attribute/AttributeFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@
/**
* Class AttributeFactoryInterface
* @template ValueType
* @template ValTesterType
*/
interface AttributeFactoryInterface
{
/**
* makeAttribute
* @param string $attributeName
* @return AttributeInterface<ValueType>
* @return AttributeInterface<ValueType, ValTesterType>
*/
public function makeAttribute(string $attributeName): AttributeInterface;

/**
* makeCustomData
* @param string $name
* @param ValTesterInterface<string>|null $valueTester
* @return AttributeInterface<string>
* @return AttributeInterface<string, string>
*/
public function makeCustomData(
string $name,
Expand Down
5 changes: 3 additions & 2 deletions src/html/config/HtmlConfigInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ public function innerTextNotAllowed(string $tagName): bool;

/**
* isValidSubtag
* @param string $name
* @param string $subTagName
* @param string $parentTagName
* @return bool
*/
public function isValidSubTag(string $subTagName, $parentTagName): bool;
public function isValidSubTag(string $subTagName, string $parentTagName): bool;

/**
* isInlineTag
Expand Down
10 changes: 2 additions & 8 deletions src/html/tag/TagFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,14 @@
/**
* Class TagFactoryInterface
* @template ValueType
* @template ValTesterType
*/
interface TagFactoryInterface
{
/**
* makeTag
* @param string $tagName
* @return TagInterface<ValueType>
* @return TagInterface<ValueType, ValTesterType>
*/
public function makeTag(string $tagName): TagInterface;

/**
* makeTagVoid
* @param string $tagName
* @return TagVoidInterface<ValueType>
*/
public function makeTagVoid(string $tagName): TagVoidInterface;
}
7 changes: 4 additions & 3 deletions src/html/tag/TagInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
/**
* Class TagInterface
* @template ValueType
* @extends TagVoidInterface<ValueType>
* @template ValTesterType
* @extends TagVoidInterface<ValueType, ValTesterType>
*/
interface TagInterface extends TagVoidInterface
{
/**
* addInnerHtml
* @param TagVoidInterface<ValueType>|MsgInterface|string $innerHtml
* @param TagVoidInterface<ValueType, ValTesterType>|MsgInterface|string $innerHtml
*/
public function addInnerHtml(TagVoidInterface|TagInterface|MsgInterface|string $innerHtml): void;


/**
* getInnerHtml
* @return array<TagVoidInterface<ValueType>|TagInterface<ValueType>|MsgInterface|string>
* @return array<TagVoidInterface<ValueType, ValTesterType>|MsgInterface|string>
*/
public function getInnerHtml(): array;

Expand Down
7 changes: 4 additions & 3 deletions src/html/tag/TagVoidInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/**
* Class TagVoidInterface
* @template ValueType
* @template ValTesterType
*/
interface TagVoidInterface
{
Expand All @@ -32,7 +33,7 @@ public function setName(string $name);

/**
* setAttribute
* @param AttributeInterface $attribute
* @param AttributeInterface<ValueType, ValTesterType> $attribute
*/
public function setAttribute(AttributeInterface $attribute): void;

Expand All @@ -48,13 +49,13 @@ public function setCustomData(string $name, string $value, ValTesterInterface $t
/**
* getAttribute
* @param string $name
* @return AttributeInterface<ValueType>|null
* @return AttributeInterface<ValueType, ValTesterType>|null
*/
public function getAttribute(string $name): ?AttributeInterface;

/**
* getAttributes
* @return array<AttributeInterface<ValueType>>
* @return array<AttributeInterface<ValueType, ValTesterType>>
*/
public function getAttributes(int $attributeTypes): array;

Expand Down

0 comments on commit d08075e

Please sign in to comment.