Skip to content

Commit 90ddaa3

Browse files
authored
Fix #338: Fix deprecation error Using null as an array offset is deprecated, use an empty string instead
1 parent 8a3b54e commit 90ddaa3

8 files changed

+236
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Yii Framework 2 apidoc extension Change Log
44
3.0.9 under development
55
-----------------------
66

7+
- Bug #338: Fix deprecation error `Using null as an array offset is deprecated, use an empty string instead` (mspirkov)
78
- Enh #337: Log invalid tags (mspirkov)
89

910

models/Context.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,8 @@ public function updateReferences()
108108
{
109109
// update all subclass references
110110
foreach ($this->classes as $class) {
111-
if ($class->parentClass === null) {
112-
continue;
113-
}
114-
115111
$className = $class->name;
116-
while (isset($this->classes[$class->parentClass])) {
112+
while ($class->parentClass !== null && isset($this->classes[$class->parentClass])) {
117113
$class = $this->classes[$class->parentClass];
118114
$class->subclasses[] = $className;
119115
}

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__1.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
<a class="list-group-item" href="./yiiunit-apidoc-data-api-animal-cat.html">Cat</a>
4444
<a class="list-group-item" href="./yiiunit-apidoc-data-api-animal-dog.html">Dog</a>
4545
</div>
46-
<a class="list-group-item" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\base <b class="caret"></b></a><div class="submenu panel-collapse collapse"><a class="list-group-item" href="./yiiunit-apidoc-data-api-base-component.html">Component</a></div>
46+
<a class="list-group-item" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\base <b class="caret"></b></a><div class="submenu panel-collapse collapse">
47+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-base-component.html">Component</a>
48+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-base-controller.html">Controller</a>
49+
</div>
4750
</div> </div>
4851
<div class="col-md-9 api-content" role="main">
4952
<h1>Abstract Class yiiunit\apidoc\data\api\animal\Animal</h1>

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__2.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
<a class="list-group-item active" href="./yiiunit-apidoc-data-api-animal-cat.html">Cat</a>
4444
<a class="list-group-item" href="./yiiunit-apidoc-data-api-animal-dog.html">Dog</a>
4545
</div>
46-
<a class="list-group-item" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\base <b class="caret"></b></a><div class="submenu panel-collapse collapse"><a class="list-group-item" href="./yiiunit-apidoc-data-api-base-component.html">Component</a></div>
46+
<a class="list-group-item" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\base <b class="caret"></b></a><div class="submenu panel-collapse collapse">
47+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-base-component.html">Component</a>
48+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-base-controller.html">Controller</a>
49+
</div>
4750
</div> </div>
4851
<div class="col-md-9 api-content" role="main">
4952
<h1>Class yiiunit\apidoc\data\api\animal\Cat</h1>

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__3.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
<a class="list-group-item" href="./yiiunit-apidoc-data-api-animal-cat.html">Cat</a>
4444
<a class="list-group-item active" href="./yiiunit-apidoc-data-api-animal-dog.html">Dog</a>
4545
</div>
46-
<a class="list-group-item" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\base <b class="caret"></b></a><div class="submenu panel-collapse collapse"><a class="list-group-item" href="./yiiunit-apidoc-data-api-base-component.html">Component</a></div>
46+
<a class="list-group-item" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\base <b class="caret"></b></a><div class="submenu panel-collapse collapse">
47+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-base-component.html">Component</a>
48+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-base-controller.html">Controller</a>
49+
</div>
4750
</div> </div>
4851
<div class="col-md-9 api-content" role="main">
4952
<h1>Class yiiunit\apidoc\data\api\animal\Dog</h1>

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__4.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
<a class="list-group-item" href="./yiiunit-apidoc-data-api-animal-cat.html">Cat</a>
4444
<a class="list-group-item" href="./yiiunit-apidoc-data-api-animal-dog.html">Dog</a>
4545
</div>
46-
<a class="list-group-item active" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\base <b class="caret"></b></a><div class="submenu panel-collapse collapse in"><a class="list-group-item active" href="./yiiunit-apidoc-data-api-base-component.html">Component</a></div>
46+
<a class="list-group-item active" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\base <b class="caret"></b></a><div class="submenu panel-collapse collapse in">
47+
<a class="list-group-item active" href="./yiiunit-apidoc-data-api-base-component.html">Component</a>
48+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-base-controller.html">Controller</a>
49+
</div>
4750
</div> </div>
4851
<div class="col-md-9 api-content" role="main">
4952
<h1>Class yiiunit\apidoc\data\api\base\Component</h1>
@@ -60,7 +63,11 @@ <h1>Class yiiunit\apidoc\data\api\base\Component</h1>
6063
<th>Inheritance</th>
6164
<td><a href="yiiunit-apidoc-data-api-base-component.html">yiiunit\apidoc\data\api\base\Component</a></td>
6265
</tr>
63-
</table>
66+
<tr>
67+
<th>Subclasses</th>
68+
<td><a href="yiiunit-apidoc-data-api-base-controller.html">yiiunit\apidoc\data\api\base\Controller</a></td>
69+
</tr>
70+
</table>
6471

6572
<div class="class-description">
6673
<p><strong></strong></p>
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<meta name="language" content="en">
7+
8+
9+
10+
11+
12+
13+
<title>Controller, yiiunit\apidoc\data\api\base\Controller - Yii Framework 2.0 API Documentation</title>
14+
</head>
15+
<body>
16+
17+
<div class="wrap">
18+
<nav class="navbar-inverse navbar-fixed-top navbar"><div class="navbar-header">
19+
<button type="button" class="navbar-toggle" data-toggle="collapse"><span class="sr-only">Toggle navigation</span>
20+
<span class="icon-bar"></span>
21+
<span class="icon-bar"></span>
22+
<span class="icon-bar"></span></button><a class="navbar-brand" href="./index.html">Yii Framework 2.0 API Documentation</a>
23+
</div>
24+
<div class="collapse navbar-collapse">
25+
<ul class="navbar-nav nav"><li><a href="./index.html">Class reference</a></li></ul>
26+
<div class="navbar-form navbar-left" role="search">
27+
<div class="form-group">
28+
<input type="text" class="form-control" placeholder="Search">
29+
</div>
30+
</div>
31+
</div></nav>
32+
<div style="display: none;" class="modal-content">
33+
<ul>
34+
</ul>
35+
</div>
36+
37+
38+
<div class="row">
39+
<div class="col-md-3">
40+
<div class="list-group">
41+
<a class="list-group-item" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\animal <b class="caret"></b></a><div class="submenu panel-collapse collapse">
42+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-animal-animal.html">Animal</a>
43+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-animal-cat.html">Cat</a>
44+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-animal-dog.html">Dog</a>
45+
</div>
46+
<a class="list-group-item active" data-toggle="collapse" data-parent="#navigation">yiiunit\apidoc\data\api\base <b class="caret"></b></a><div class="submenu panel-collapse collapse in">
47+
<a class="list-group-item" href="./yiiunit-apidoc-data-api-base-component.html">Component</a>
48+
<a class="list-group-item active" href="./yiiunit-apidoc-data-api-base-controller.html">Controller</a>
49+
</div>
50+
</div> </div>
51+
<div class="col-md-9 api-content" role="main">
52+
<h1>Class yiiunit\apidoc\data\api\base\Controller</h1>
53+
<div class="top-nav">
54+
<a href="index">All Classes</a>
55+
</div>
56+
57+
<table class="summaryTable docClass table table-bordered">
58+
<colgroup>
59+
<col class="col-name">
60+
<col class="col-value">
61+
</colgroup>
62+
<tr>
63+
<th>Inheritance</th>
64+
<td>
65+
<a href="yiiunit-apidoc-data-api-base-controller.html">yiiunit\apidoc\data\api\base\Controller</a> &raquo;
66+
<a href="yiiunit-apidoc-data-api-base-component.html">yiiunit\apidoc\data\api\base\Component</a>
67+
</td>
68+
</tr>
69+
</table>
70+
71+
<div class="class-description">
72+
<p><strong>Controller is the base class for classes containing controller logic.</strong></p>
73+
74+
</div>
75+
76+
77+
78+
<a></a>
79+
80+
<a></a>
81+
82+
<a></a>
83+
84+
<a></a>
85+
86+
</div>
87+
</div>
88+
89+
<script type="text/javascript">
90+
/*<![CDATA[*/
91+
$('a.toggle').on('click', function () {
92+
var $this = $(this);
93+
if ($this.hasClass('properties-hidden')) {
94+
$this.text($this.text().replace(/Show/,'Hide'));
95+
$this.parents('.toggle-target-container').find('.inherited').show();
96+
$this.removeClass('properties-hidden');
97+
} else {
98+
$this.text($this.text().replace(/Hide/,'Show'));
99+
$this.parents('.toggle-target-container').find('.inherited').hide();
100+
$this.addClass('properties-hidden');
101+
}
102+
103+
return false;
104+
});
105+
/*]]>*/
106+
</script>
107+
108+
109+
</div>
110+
111+
<footer class="footer">
112+
113+
Powered by <a href="https://www.yiiframework.com/" rel="external">Yii Framework</a></footer>
114+
115+
<script>jQuery(function ($) {
116+
var shiftWindow = function () { scrollBy(0, -50) };
117+
if (location.hash) setTimeout(shiftWindow, 1);
118+
window.addEventListener("hashchange", shiftWindow);
119+
var element = document.createElement("script");
120+
element.src = "./jssearch.index.js";
121+
document.body.appendChild(element);
122+
123+
var searchBox = $('#searchbox');
124+
125+
// search when typing in search field
126+
searchBox.on("keyup", function(event) {
127+
var query = $(this).val();
128+
129+
if (query == '' || event.which == 27) {
130+
$('#search-resultbox').hide();
131+
return;
132+
} else if (event.which == 13) {
133+
var selectedLink = $('#search-resultbox a.selected');
134+
if (selectedLink.length != 0) {
135+
document.location = selectedLink.attr('href');
136+
return;
137+
}
138+
} else if (event.which == 38 || event.which == 40) {
139+
$('#search-resultbox').show();
140+
141+
var selected = $('#search-resultbox a.selected');
142+
if (selected.length == 0) {
143+
$('#search-results').find('a').first().addClass('selected');
144+
} else {
145+
var next;
146+
if (event.which == 40) {
147+
next = selected.parent().next().find('a').first();
148+
} else {
149+
next = selected.parent().prev().find('a').first();
150+
}
151+
if (next.length != 0) {
152+
var resultbox = $('#search-results');
153+
var position = next.position();
154+
155+
// TODO scrolling is buggy and jumps around
156+
// resultbox.scrollTop(Math.floor(position.top));
157+
// console.log(position.top);
158+
159+
selected.removeClass('selected');
160+
next.addClass('selected');
161+
}
162+
}
163+
164+
return;
165+
}
166+
$('#search-resultbox').show();
167+
$('#search-results').html('<li><span class="no-results">No results');
168+
169+
var result = jssearch.search(query);
170+
171+
if (result.length > 0) {
172+
var i = 0;
173+
var resHtml = '';
174+
175+
for (var key in result) {
176+
if (i++ > 20) {
177+
break;
178+
}
179+
resHtml = resHtml +
180+
'<li><a href="' + result[key].file.u.substr(3) +'"><span class="title">' + result[key].file.t + '' +
181+
'<span class="description">' + result[key].file.d + '';
182+
}
183+
$('#search-results').html(resHtml);
184+
}
185+
});
186+
187+
// hide the search results on ESC
188+
$(document).on("keyup", function(event) { if (event.which == 27) { $('#search-resultbox').hide(); } });
189+
// hide search results on click to document
190+
$(document).bind('click', function (e) { $('#search-resultbox').hide(); });
191+
// except the following:
192+
searchBox.bind('click', function(e) { e.stopPropagation(); });
193+
$('#search-resultbox').bind('click', function(e) { e.stopPropagation(); });
194+
195+
});</script>
196+
</body>
197+
</html>

tests/data/api/base/Controller.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/**
4+
* @link https://www.yiiframework.com/
5+
* @copyright Copyright (c) 2008 Yii Software LLC
6+
* @license https://www.yiiframework.com/license/
7+
*/
8+
9+
namespace yiiunit\apidoc\data\api\base;
10+
11+
/**
12+
* Controller is the base class for classes containing controller logic.
13+
*/
14+
class Controller extends Component
15+
{
16+
}

0 commit comments

Comments
 (0)