1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Fwk |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2011-2012, Julien Ballestracci <[email protected]>. |
6
|
|
|
* All rights reserved. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
12
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
13
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
14
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
15
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
16
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
17
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
18
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
19
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
20
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
21
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
22
|
|
|
* POSSIBILITY OF SUCH DAMAGE. |
23
|
|
|
* |
24
|
|
|
* PHP Version 5.3 |
25
|
|
|
* |
26
|
|
|
* @category Core |
27
|
|
|
* @package Fwk\Core |
28
|
|
|
* @author Julien Ballestracci <[email protected]> |
29
|
|
|
* @copyright 2011-2012 Julien Ballestracci <[email protected]> |
30
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
31
|
|
|
* @link http://www.phpfwk.com |
32
|
|
|
*/ |
33
|
|
|
namespace Fwk\Core; |
34
|
|
|
|
35
|
|
|
use Fwk\Events\Event; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @category Listeners |
39
|
|
|
* @package Fwk\Core |
40
|
|
|
* @author Julien Ballestracci <[email protected]> |
41
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
42
|
|
|
* @link http://www.phpfwk.com |
43
|
|
|
*/ |
44
|
|
|
class CoreEvent extends Event |
45
|
|
|
{ |
46
|
|
|
/** |
47
|
|
|
* Constructor |
48
|
|
|
* |
49
|
|
|
* @param type $name |
50
|
|
|
* @param type $data |
|
|
|
|
51
|
|
|
* @param Application $app |
|
|
|
|
52
|
|
|
* @param Context $context |
|
|
|
|
53
|
|
|
* |
54
|
|
|
* @return void |
|
|
|
|
55
|
|
|
*/ |
56
|
27 |
|
public function __construct($name, $data = array(), Application $app = null, |
57
|
|
|
Context $context = null |
58
|
|
|
) { |
59
|
27 |
|
parent::__construct($name, array_merge($data, array( |
60
|
27 |
|
'application' => $app, |
61
|
|
|
'context' => $context |
62
|
27 |
|
))); |
63
|
27 |
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* |
67
|
|
|
* @return Application |
68
|
|
|
*/ |
69
|
27 |
|
public function getApplication() |
70
|
|
|
{ |
71
|
27 |
|
return $this->application; |
|
|
|
|
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* |
76
|
|
|
* @return Context |
77
|
|
|
*/ |
78
|
26 |
|
public function getContext() |
79
|
|
|
{ |
80
|
26 |
|
return $this->context; |
|
|
|
|
81
|
|
|
} |
82
|
|
|
} |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type
array
and suggests a stricter type likearray<String>
.Most often this is a case of a parameter that can be null in addition to its declared types.