Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP8 attribute compatible annotation #7

Merged
merged 5 commits into from
Jan 10, 2021
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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Akihito Koriyama
Copyright (c) 2017-2021 Akihito Koriyama

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Ray.WebParamModule

This is web context parameter annotations only package for [BEAR.Resource](https://github.com/bearsunday/BEAR.Resource).
The functon is integrated with BEAR.Package, This implemantation is no longer exist in this package.
This is web context parameter annotations/attributes only for [BEAR.Resource](https://github.com/bearsunday/BEAR.Resource).
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"keywords":[
"annotation"
],
"require": {
"php": "^5.4 || ^7.0 || ^8.0"
},
"license": "MIT",
"autoload":{
"psr-4":{
Expand Down
17 changes: 12 additions & 5 deletions src/Annotation/AbstractWebContextParam.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php
/**
* This file is part of the BEAR.Resource package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

namespace Ray\WebContextParam\Annotation;

abstract class AbstractWebContextParam
Expand All @@ -26,4 +22,15 @@ abstract class AbstractWebContextParam
* @var string
*/
public $param;

/**
* @param array $values{key?: string, param?: string}
* @param string $key
* @param string $param
*/
public function __construct(array $values = [], $key = '', $param = '')
{
$this->key = isset($values['key']) ? $values['key'] : $key;
$this->param = isset($values['param']) ? $values['param'] : $param;
}
}
9 changes: 4 additions & 5 deletions src/Annotation/CookieParam.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php
/**
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php MIT
*/

namespace Ray\WebContextParam\Annotation;

use Attribute;

/**
* @Annotation
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_PARAMETER)]
final class CookieParam extends AbstractWebContextParam
{
const GLOBAL_KEY = '_COOKIE';
Expand Down
9 changes: 4 additions & 5 deletions src/Annotation/EnvParam.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php
/**
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php MIT
*/

namespace Ray\WebContextParam\Annotation;

use Attribute;

/**
* @Annotation
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_PARAMETER)]
final class EnvParam extends AbstractWebContextParam
{
const GLOBAL_KEY = '_ENV';
Expand Down
9 changes: 4 additions & 5 deletions src/Annotation/FilesParam.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php
/**
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php MIT
*/

namespace Ray\WebContextParam\Annotation;

use Attribute;

/**
* @Annotation
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_PARAMETER)]
final class FilesParam extends AbstractWebContextParam
{
const GLOBAL_KEY = '_FILES';
Expand Down
9 changes: 4 additions & 5 deletions src/Annotation/FormParam.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php
/**
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php MIT
*/

namespace Ray\WebContextParam\Annotation;

use Attribute;

/**
* @Annotation
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_PARAMETER)]
final class FormParam extends AbstractWebContextParam
{
const GLOBAL_KEY = '_POST';
Expand Down
9 changes: 4 additions & 5 deletions src/Annotation/QueryParam.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php
/**
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php MIT
*/

namespace Ray\WebContextParam\Annotation;

use Attribute;

/**
* @Annotation
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_PARAMETER)]
final class QueryParam extends AbstractWebContextParam
{
const GLOBAL_KEY = '_GET';
Expand Down
9 changes: 4 additions & 5 deletions src/Annotation/ServerParam.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php
/**
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php MIT
*/

namespace Ray\WebContextParam\Annotation;

use Attribute;

/**
* @Annotation
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_PARAMETER)]
final class ServerParam extends AbstractWebContextParam
{
const GLOBAL_KEY = '_SERVER';
Expand Down