1 | <?php |
||
8 | class MinifyContext |
||
9 | { |
||
10 | /** |
||
11 | * @var \ArjanSchouten\HtmlMinifier\PlaceholderContainer |
||
12 | */ |
||
13 | private $placeholderContainer; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $contents; |
||
19 | |||
20 | /** |
||
21 | * @var \ArjanSchouten\HtmlMinifier\Statistics\StatisticsInterface |
||
22 | */ |
||
23 | private $statistics; |
||
24 | |||
25 | /** |
||
26 | * @param \ArjanSchouten\HtmlMinifier\PlaceholderContainer $placeholderContainer |
||
27 | */ |
||
28 | 30 | public function __construct(PlaceholderContainer $placeholderContainer, StatisticsInterface $statistics = null) |
|
33 | |||
34 | /** |
||
35 | * Get the placeholdercontainer. |
||
36 | * |
||
37 | * @return \ArjanSchouten\HtmlMinifier\PlaceholderContainer |
||
38 | */ |
||
39 | 10 | public function getPlaceholderContainer() |
|
43 | |||
44 | /** |
||
45 | * @return string |
||
46 | */ |
||
47 | 30 | public function getContents() |
|
51 | |||
52 | /** |
||
53 | * @param string $contents |
||
54 | * |
||
55 | * @return $this |
||
56 | */ |
||
57 | 30 | public function setContents($contents) |
|
63 | |||
64 | /** |
||
65 | * Add a minification step. |
||
66 | * |
||
67 | * @param string $input |
||
68 | * @param string $keyName |
||
|
|||
69 | */ |
||
70 | 3 | public function addMinificationStep($input, $keyName = null) |
|
71 | { |
||
72 | 3 | if ($this->statistics === null) { |
|
73 | 3 | $this->statistics = new Statistics($input, $keyName); |
|
74 | |||
75 | 3 | return; |
|
76 | } |
||
77 | |||
78 | 3 | $this->statistics->createReferencePoint($this->calculateInputLength($input), $keyName); |
|
79 | 3 | } |
|
80 | |||
81 | 3 | private function calculateInputLength($input) |
|
85 | |||
86 | /** |
||
87 | * Get the minification statistics. |
||
88 | * |
||
89 | * @return \ArjanSchouten\HtmlMinifier\Statistics\StatisticsInterface |
||
90 | */ |
||
91 | 1 | public function getStatistics() |
|
95 | } |
||
96 |
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.
Most often this is a case of a parameter that can be null in addition to its declared types.