File tree Expand file tree Collapse file tree 8 files changed +16
-23
lines changed
Expand file tree Collapse file tree 8 files changed +16
-23
lines changed Original file line number Diff line number Diff line change 55 " annotation"
66 ],
77 "require" : {
8- "php" : " ^5.4 || ^7.0 || ^8.0"
8+ "php" : " ^5.4 || ^7.0 || ^8.0" ,
9+ "doctrine/annotations" : " ^1.11"
910 },
1011 "license" : " MIT" ,
1112 "autoload" :{
Original file line number Diff line number Diff line change 22
33namespace Ray \WebContextParam \Annotation ;
44
5- use function is_array ;
6- use function is_string ;
5+ use Doctrine \Common \Annotations \NamedArgumentConstructorAnnotation ;
76
8- abstract class AbstractWebContextParam
7+ abstract class AbstractWebContextParam implements NamedArgumentConstructorAnnotation
98{
109 /**
1110 * Key of Super global value
@@ -22,23 +21,16 @@ abstract class AbstractWebContextParam
2221 /**
2322 * Parameter(Variable) name
2423 *
24+ * This parameter is used to specify a parameter from a method in PHP7,
25+ * and is not needed when attributing to a parameter in PHP8.
26+ *
2527 * @var string
2628 */
2729 public $ param ;
2830
29- /**
30- * @param string|array{key?: string, param?: string} $values
31- */
32- public function __construct ($ key )
31+ public function __construct (string $ key , string $ param = '' )
3332 {
34- if (is_array ($ key )) {
35- $ this ->key = $ key ['key ' ];
36- $ this ->param = $ key ['param ' ];
37-
38- return ;
39- }
40- if (is_string ($ key )) {
41- $ this ->key = $ key ;
42- }
33+ $ this ->key = $ key ;
34+ $ this ->param = $ param ;
4335 }
4436}
Original file line number Diff line number Diff line change 88 * @Annotation
99 * @Target("METHOD")
1010 */
11- #[Attribute(Attribute::TARGET_PARAMETER )]
11+ #[Attribute(Attribute::TARGET_PARAMETER | Attribute:: TARGET_METHOD | Attribute:: IS_REPEATABLE )]
1212final class CookieParam extends AbstractWebContextParam
1313{
1414 const GLOBAL_KEY = '_COOKIE ' ;
Original file line number Diff line number Diff line change 88 * @Annotation
99 * @Target("METHOD")
1010 */
11- #[Attribute(Attribute::TARGET_PARAMETER )]
11+ #[Attribute(Attribute::TARGET_PARAMETER | Attribute:: TARGET_METHOD | Attribute:: IS_REPEATABLE )]
1212final class EnvParam extends AbstractWebContextParam
1313{
1414 const GLOBAL_KEY = '_ENV ' ;
Original file line number Diff line number Diff line change 88 * @Annotation
99 * @Target("METHOD")
1010 */
11- #[Attribute(Attribute::TARGET_PARAMETER )]
11+ #[Attribute(Attribute::TARGET_PARAMETER | Attribute:: TARGET_METHOD | Attribute:: IS_REPEATABLE )]
1212final class FilesParam extends AbstractWebContextParam
1313{
1414 const GLOBAL_KEY = '_FILES ' ;
Original file line number Diff line number Diff line change 88 * @Annotation
99 * @Target("METHOD")
1010 */
11- #[Attribute(Attribute::TARGET_PARAMETER )]
11+ #[Attribute(Attribute::TARGET_PARAMETER | Attribute:: TARGET_METHOD | Attribute:: IS_REPEATABLE )]
1212final class FormParam extends AbstractWebContextParam
1313{
1414 const GLOBAL_KEY = '_POST ' ;
Original file line number Diff line number Diff line change 88 * @Annotation
99 * @Target("METHOD")
1010 */
11- #[Attribute(Attribute::TARGET_PARAMETER )]
11+ #[Attribute(Attribute::TARGET_PARAMETER | Attribute:: TARGET_METHOD | Attribute:: IS_REPEATABLE )]
1212final class QueryParam extends AbstractWebContextParam
1313{
1414 const GLOBAL_KEY = '_GET ' ;
Original file line number Diff line number Diff line change 88 * @Annotation
99 * @Target("METHOD")
1010 */
11- #[Attribute(Attribute::TARGET_PARAMETER )]
11+ #[Attribute(Attribute::TARGET_PARAMETER | Attribute:: TARGET_METHOD | Attribute:: IS_REPEATABLE )]
1212final class ServerParam extends AbstractWebContextParam
1313{
1414 const GLOBAL_KEY = '_SERVER ' ;
You can’t perform that action at this time.
0 commit comments