1 | <?php |
||||
2 | /* vim: set expandtab tabstop=4 shiftwidth=4: */ |
||||
3 | |||||
4 | /** |
||||
5 | * Contains the Calendar_Month_Weeks class |
||||
6 | * |
||||
7 | * PHP versions 4 and 5 |
||||
8 | * |
||||
9 | * LICENSE: Redistribution and use in source and binary forms, with or without |
||||
10 | * modification, are permitted provided that the following conditions are met: |
||||
11 | * 1. Redistributions of source code must retain the above copyright |
||||
12 | * notice, this list of conditions and the following disclaimer. |
||||
13 | * 2. Redistributions in binary form must reproduce the above copyright |
||||
14 | * notice, this list of conditions and the following disclaimer in the |
||||
15 | * documentation and/or other materials provided with the distribution. |
||||
16 | * 3. The name of the author may not be used to endorse or promote products |
||||
17 | * derived from this software without specific prior written permission. |
||||
18 | * |
||||
19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED |
||||
20 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
||||
21 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||||
22 | * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY |
||||
23 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||||
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||||
26 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||||
28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
29 | * |
||||
30 | * @category Date and Time |
||||
31 | * @package Calendar |
||||
32 | * @author Harry Fuecks <[email protected]> |
||||
33 | * @author Lorenzo Alberton <[email protected]> |
||||
34 | * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton |
||||
35 | * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) |
||||
36 | * @version CVS: $Id$ |
||||
37 | * @link http://pear.php.net/package/Calendar |
||||
38 | */ |
||||
39 | namespace PEAR\Calendar\Month; |
||||
40 | |||||
41 | use PEAR\Calendar\Month; |
||||
42 | use PEAR\Calendar\Table\Helper; |
||||
43 | use PEAR\Calendar\Week; |
||||
44 | |||||
45 | /** |
||||
46 | * Represents a Month and builds Weeks |
||||
47 | * <code> |
||||
48 | * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Month'.DIRECTORY_SEPARATOR.'Weeks.php'; |
||||
49 | * $Month = new Calendar_Month_Weeks(2003, 10); // Oct 2003 |
||||
50 | * $Month->build(); // Build Calendar_Day objects |
||||
51 | * while ($Week = & $Month->fetch()) { |
||||
52 | * echo $Week->thisWeek().'<br />'; |
||||
53 | * } |
||||
54 | * </code> |
||||
55 | * |
||||
56 | * @category Date and Time |
||||
57 | * @package Calendar |
||||
58 | * @author Harry Fuecks <[email protected]> |
||||
59 | * @author Lorenzo Alberton <[email protected]> |
||||
60 | * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton |
||||
61 | * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) |
||||
62 | * @link http://pear.php.net/package/Calendar |
||||
63 | * @access public |
||||
64 | */ |
||||
65 | class Weeks extends Month |
||||
66 | { |
||||
67 | /** |
||||
68 | * Instance of Calendar_Table_Helper |
||||
0 ignored issues
–
show
|
|||||
69 | * @var Calendar_Table_Helper |
||||
70 | * @access private |
||||
71 | */ |
||||
72 | var $tableHelper; |
||||
73 | |||||
74 | /** |
||||
75 | * First day of the week |
||||
76 | * @access private |
||||
77 | * @var string |
||||
78 | */ |
||||
79 | var $firstDay; |
||||
80 | |||||
81 | /** |
||||
82 | * Constructs Calendar_Month_Weeks |
||||
83 | * |
||||
84 | * @param int $y year e.g. 2003 |
||||
85 | * @param int $m month e.g. 5 |
||||
86 | * @param int $firstDay (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.) |
||||
87 | * |
||||
88 | * @access public |
||||
89 | */ |
||||
90 | function __construct($y, $m, $firstDay=null) |
||||
0 ignored issues
–
show
|
|||||
91 | { |
||||
92 | parent::__construct($y, $m, $firstDay); |
||||
93 | } |
||||
94 | |||||
95 | /** |
||||
96 | * Builds Calendar_Week objects for the Month. Note that Calendar_Week |
||||
97 | * builds Calendar_Day object in tabular form (with Calendar_Day->empty) |
||||
98 | * |
||||
99 | * @param array $sDates (optional) Calendar_Week objects representing selected dates |
||||
100 | * |
||||
101 | * @return boolean |
||||
102 | * @access public |
||||
103 | */ |
||||
104 | function build($sDates = array()) |
||||
0 ignored issues
–
show
|
|||||
105 | { |
||||
106 | $this->tableHelper = new Helper($this, $this->firstDay); |
||||
0 ignored issues
–
show
It seems like
new PEAR\Calendar\Table\...$this, $this->firstDay) of type PEAR\Calendar\Table\Helper is incompatible with the declared type PEAR\Calendar\Month\Calendar_Table_Helper of property $tableHelper .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() $this->firstDay of type string is incompatible with the type integer expected by parameter $firstDay of PEAR\Calendar\Table\Helper::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
107 | $numWeeks = $this->tableHelper->getNumWeeks(); |
||||
108 | for ($i=1, $d=1; $i<=$numWeeks; $i++, |
||||
109 | $d+=$this->cE->getDaysInWeek( |
||||
110 | $this->thisYear(), |
||||
111 | $this->thisMonth(), |
||||
112 | $this->thisDay() |
||||
113 | ) |
||||
114 | ) { |
||||
115 | $this->children[$i] = new Week( |
||||
116 | $this->year, $this->month, $d, $this->tableHelper->getFirstDay()); |
||||
117 | } |
||||
118 | //used to set empty days |
||||
119 | $this->children[1]->setFirst(true); |
||||
120 | $this->children[$numWeeks]->setLast(true); |
||||
121 | |||||
122 | // Handle selected weeks here |
||||
123 | if (count($sDates) > 0) { |
||||
124 | $this->setSelection($sDates); |
||||
125 | } |
||||
126 | return true; |
||||
127 | } |
||||
128 | |||||
129 | /** |
||||
130 | * Called from build() |
||||
131 | * |
||||
132 | * @param array $sDates Calendar_Week objects representing selected dates |
||||
133 | * |
||||
134 | * @return void |
||||
135 | * @access private |
||||
136 | */ |
||||
137 | function setSelection($sDates) |
||||
0 ignored issues
–
show
|
|||||
138 | { |
||||
139 | foreach ($sDates as $sDate) { |
||||
140 | if ($this->year == $sDate->thisYear() |
||||
141 | && $this->month == $sDate->thisMonth()) |
||||
142 | { |
||||
143 | $key = $sDate->thisWeek('n_in_month'); |
||||
144 | if (isset($this->children[$key])) { |
||||
145 | $this->children[$key]->setSelected(); |
||||
146 | } |
||||
147 | } |
||||
148 | } |
||||
149 | } |
||||
150 | } |
||||
151 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths