Skip to content

Commit

Permalink
feature #1027 Fix ComponentAttributes constructor typehint and remove…
Browse files Browse the repository at this point in the history
… ``@internal`` (norkunas)

This PR was merged into the 2.x branch.

Discussion
----------

Fix ComponentAttributes constructor typehint and remove ``@internal``

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Tickets       | Fix #304
| License       | MIT

I heavily rely on ComponentAttributes instantiation in components to be able to use same logic on all component elements, for example:

```twig
<div{{ attributes.defaults({ ... })>
  <img{{ imageAttributes.defaults({ ... })>
</div>
```

In the issue it was proposed to rename ComponentAttributes but I don't see the point to break the code for people now 🙂

Commits
-------

70d3a78 Fix ComponentAttributes constructor typehint and remove internal
  • Loading branch information
weaverryan committed Aug 15, 2023
2 parents b9d42be + 70d3a78 commit ced15b6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/TwigComponent/src/ComponentAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
final class ComponentAttributes
{
/**
* @internal
*
* @param array<string, string> $attributes
* @param array<string, string|bool> $attributes
*/
public function __construct(private array $attributes)
{
Expand Down Expand Up @@ -53,7 +51,7 @@ function (string $carry, string $key) {
}

/**
* @return array<string, string>
* @return array<string, string|bool>
*/
public function all(): array
{
Expand Down

0 comments on commit ced15b6

Please sign in to comment.