Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80

[*.md]
trim_trailing_whitespace = false
trim_trailing_whitespace = true
75 changes: 75 additions & 0 deletions Template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# A template for an attribute definition

```php
<?php

declare(strict_types=1);

namespace Fig\Attributes;

/**
* One-Line summary of what the attribute does (PLAIN TEXT!)
*
* ## Target audience.
*
* Implementors
* : Who should handle this attribute? Example: "static analysis tools"
* Users
* : Who adds this attribute to their code? Example: "packages that want to
* safeguard their functions via static analysis"
*
* ## Purpose
*
* Long explanation of what the attribute does and why it is relevant.
*
* Use citations[^citation] or [Links](https://example.com) in your text to make
* sure people understand the relevance and where you got your ideas from.
*
* ## When should the attribute be applied?
*
* If your Attribute has preconditions for usage you MUST use the keywords
* described in [RFC 2119](https://datatracker.ietf.org/doc/html/rfc2119).
* You SHOULD list them prominently.
*
* **Note:** DocBlock content MUST be Markdown formatted. Check out the
* [Markdown-Guide](https://www.markdownguide.org/) for possible formatting
* and keep in mind that the short description should not contain markdown.
*
* Keep your lines at a maximum of 80 Characters. It increases readability on
* smaller windows.
*
* Please also use code-snippets where appropriate
*
* ```php
* <?php
* echo 'Hello World';
* ```
*
* [^citation] https://en.wikipedia.org/wiki/Citation
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
class Template
{
/**
* Describe your methods extensively.
*
* You also MUST describe parameters to your Attribute extensively! You
* SHOULD use the DocBlock-format as described in PSR-5 for that.
*
* @param string $name
* The name of this template.
*
* Parameter descriptions can span multiple lines. Make sure to
* separate the subject from the text by a blank line.
* @param boolean $expose
* Whether to expose this as an example or not.
* @param int[] $luckyNumbers
* The lucky numbers of this week.
*/
public function __construct(
public readonly string $name,
public readonly bool $expose,
public readonly array $luckyNumbers
) {}
}
```