Skip to content

Commit

Permalink
Merge pull request #1 from IlicMiljan/add-sensitive-parameter-polyfill
Browse files Browse the repository at this point in the history
`#[SensitiveParameter]` Attribute Polyfill
  • Loading branch information
IlicMiljan committed Mar 8, 2024
2 parents f5a7afd + f5e62a5 commit a20e325
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"psr-4": {
"IlicMiljan\\SecureProps\\": "src/"
},
"files": ["src/Attribute/SensitiveParameter.php"],
"exclude-from-classmap": ["tests/"]
},
"autoload-dev": {
Expand Down
21 changes: 21 additions & 0 deletions src/Attribute/SensitiveParameter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace

/**
* Polyfill for the SensitiveParameter attribute introduced in PHP 8.2.
*
* This polyfill allows code targeting PHP versions earlier than 8.2 to use the
* SensitiveParameter attribute without causing syntax errors. It's a no-op in
* older PHP versions but enables forward compatibility with PHP 8.2 and newer.
*/

if (PHP_VERSION_ID < 80200) {
#[Attribute(Attribute::TARGET_PARAMETER)]
final class SensitiveParameter
{
public function __construct()
{
}
}
}

0 comments on commit a20e325

Please sign in to comment.