Skip to content

Commit f08269c

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.3
2 parents f64a4e4 + a01d2dd commit f08269c

File tree

5 files changed

+67
-29
lines changed

5 files changed

+67
-29
lines changed

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
<element key="tabulate">
6565
<boolean>false</boolean>
6666
</element>
67+
<element key="collectBare">
68+
<boolean>true</boolean>
69+
</element>
6770
</array>
6871
</arguments>
6972
</extension>

system/Debug/Exceptions.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,46 @@ public function errorHandler(int $severity, string $message, ?string $file = nul
163163
}
164164

165165
if (error_reporting() & $severity) {
166+
// @TODO Remove if Faker is fixed.
167+
if ($this->isFakerDeprecationError($severity, $message, $file, $line)) {
168+
// Ignore the error.
169+
return true;
170+
}
171+
166172
throw new ErrorException($message, 0, $severity, $file, $line);
167173
}
168174

169175
return false; // return false to propagate the error to PHP standard error handler
170176
}
171177

178+
/**
179+
* Workaround for Faker deprecation errors in PHP 8.2.
180+
*
181+
* @see https://github.com/FakerPHP/Faker/issues/479
182+
*/
183+
private function isFakerDeprecationError(int $severity, string $message, ?string $file = null, ?int $line = null)
184+
{
185+
if (
186+
$severity === E_DEPRECATED
187+
&& strpos($file, VENDORPATH . 'fakerphp/faker/') !== false
188+
&& $message === 'Use of "static" in callables is deprecated'
189+
) {
190+
log_message(
191+
LogLevel::WARNING,
192+
'[DEPRECATED] {message} in {errFile} on line {errLine}.',
193+
[
194+
'message' => $message,
195+
'errFile' => clean_path($file ?? ''),
196+
'errLine' => $line ?? 0,
197+
]
198+
);
199+
200+
return true;
201+
}
202+
203+
return false;
204+
}
205+
172206
/**
173207
* Checks to see if any errors have happened during shutdown that
174208
* need to be caught and handle them.

system/Helpers/html_helper.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Generates an HTML unordered list from an single or
2323
* multi-dimensional array.
2424
*
25-
* @param mixed $attributes HTML attributes string, array, object
25+
* @param array|object|string $attributes HTML attributes string, array, object
2626
*/
2727
function ul(array $list, $attributes = ''): string
2828
{
@@ -36,7 +36,7 @@ function ul(array $list, $attributes = ''): string
3636
*
3737
* Generates an HTML ordered list from an single or multi-dimensional array.
3838
*
39-
* @param mixed $attributes HTML attributes string, array, object
39+
* @param array|object|string $attributes HTML attributes string, array, object
4040
*/
4141
function ol(array $list, $attributes = ''): string
4242
{
@@ -50,8 +50,8 @@ function ol(array $list, $attributes = ''): string
5050
*
5151
* Generates an HTML ordered list from an single or multi-dimensional array.
5252
*
53-
* @param mixed $list
54-
* @param mixed $attributes string, array, object
53+
* @param array $list
54+
* @param array|object|string $attributes string, array, object
5555
*/
5656
function _list(string $type = 'ul', $list = [], $attributes = '', int $depth = 0): string
5757
{
@@ -224,8 +224,8 @@ function script_tag($src = '', bool $indexPage = false): string
224224
*
225225
* Generates link to a CSS file
226226
*
227-
* @param mixed $href Stylesheet href or an array
228-
* @param bool $indexPage should indexPage be added to the CSS path.
227+
* @param array|string $href Stylesheet href or an array
228+
* @param bool $indexPage should indexPage be added to the CSS path.
229229
*/
230230
function link_tag($href = '', string $rel = 'stylesheet', string $type = 'text/css', string $title = '', string $media = '', bool $indexPage = false, string $hreflang = ''): string
231231
{
@@ -281,9 +281,9 @@ function link_tag($href = '', string $rel = 'stylesheet', string $type = 'text/c
281281
* Generates a video element to embed videos. The video element can
282282
* contain one or more video sources
283283
*
284-
* @param mixed $src Either a source string or an array of sources
285-
* @param string $unsupportedMessage The message to display if the media tag is not supported by the browser
286-
* @param string $attributes HTML attributes
284+
* @param array|string $src Either a source string or an array of sources
285+
* @param string $unsupportedMessage The message to display if the media tag is not supported by the browser
286+
* @param string $attributes HTML attributes
287287
*/
288288
function video($src, string $unsupportedMessage = '', string $attributes = '', array $tracks = [], bool $indexPage = false): string
289289
{
@@ -327,9 +327,9 @@ function video($src, string $unsupportedMessage = '', string $attributes = '', a
327327
*
328328
* Generates an audio element to embed sounds
329329
*
330-
* @param mixed $src Either a source string or an array of sources
331-
* @param string $unsupportedMessage The message to display if the media tag is not supported by the browser.
332-
* @param string $attributes HTML attributes
330+
* @param array|string $src Either a source string or an array of sources
331+
* @param string $unsupportedMessage The message to display if the media tag is not supported by the browser.
332+
* @param string $attributes HTML attributes
333333
*/
334334
function audio($src, string $unsupportedMessage = '', string $attributes = '', array $tracks = [], bool $indexPage = false): string
335335
{

system/Helpers/url_helper.php

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ function site_url($relativePath = '', ?string $scheme = null, ?App $config = nul
9595
* Returns the base URL as defined by the App config.
9696
* Base URLs are trimmed site URLs without the index page.
9797
*
98-
* @param mixed $relativePath URI string or array of URI segments
99-
* @param string $scheme
98+
* @param array|string $relativePath URI string or array of URI segments
10099
*/
101100
function base_url($relativePath = '', ?string $scheme = null): string
102101
{
@@ -143,7 +142,7 @@ function current_url(bool $returnObject = false, ?IncomingRequest $request = nul
143142
* If that's not available, however, we'll use a sanitized url from $_SERVER['HTTP_REFERER']
144143
* which can be set by the user so is untrusted and not set by certain browsers/servers.
145144
*
146-
* @return mixed|string|URI
145+
* @return string|URI
147146
*/
148147
function previous_url(bool $returnObject = false)
149148
{
@@ -197,10 +196,10 @@ function index_page(?App $altConfig = null): string
197196
*
198197
* Creates an anchor based on the local URL.
199198
*
200-
* @param mixed $uri URI string or array of URI segments
201-
* @param string $title The link title
202-
* @param mixed $attributes Any attributes
203-
* @param App|null $altConfig Alternate configuration to use
199+
* @param array|string $uri URI string or array of URI segments
200+
* @param string $title The link title
201+
* @param array|object|string $attributes Any attributes
202+
* @param App|null $altConfig Alternate configuration to use
204203
*/
205204
function anchor($uri = '', string $title = '', $attributes = '', ?App $altConfig = null): string
206205
{
@@ -230,10 +229,10 @@ function anchor($uri = '', string $title = '', $attributes = '', ?App $altConfig
230229
* Creates an anchor based on the local URL. The link
231230
* opens a new window based on the attributes specified.
232231
*
233-
* @param string $uri the URL
234-
* @param string $title the link title
235-
* @param mixed $attributes any attributes
236-
* @param App|null $altConfig Alternate configuration to use
232+
* @param string $uri the URL
233+
* @param string $title the link title
234+
* @param array|false|object|string $attributes any attributes
235+
* @param App|null $altConfig Alternate configuration to use
237236
*/
238237
function anchor_popup($uri = '', string $title = '', $attributes = false, ?App $altConfig = null): string
239238
{
@@ -280,9 +279,9 @@ function anchor_popup($uri = '', string $title = '', $attributes = false, ?App $
280279
/**
281280
* Mailto Link
282281
*
283-
* @param string $email the email address
284-
* @param string $title the link title
285-
* @param mixed $attributes any attributes
282+
* @param string $email the email address
283+
* @param string $title the link title
284+
* @param array|object|string $attributes any attributes
286285
*/
287286
function mailto(string $email, string $title = '', $attributes = ''): string
288287
{
@@ -300,9 +299,9 @@ function mailto(string $email, string $title = '', $attributes = ''): string
300299
*
301300
* Create a spam-protected mailto link written in Javascript
302301
*
303-
* @param string $email the email address
304-
* @param string $title the link title
305-
* @param mixed $attributes any attributes
302+
* @param string $email the email address
303+
* @param string $title the link title
304+
* @param array|object|string $attributes any attributes
306305
*/
307306
function safe_mailto(string $email, string $title = '', $attributes = ''): string
308307
{

system/Test/CIUnitTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@
2828
use Config\Modules;
2929
use Config\Services;
3030
use Exception;
31+
use Nexus\PHPUnit\Extension\Expeditable;
3132
use PHPUnit\Framework\TestCase;
3233

3334
/**
3435
* Framework test case for PHPUnit.
3536
*/
3637
abstract class CIUnitTestCase extends TestCase
3738
{
39+
use Expeditable;
3840
use ReflectionHelper;
3941

4042
/**

0 commit comments

Comments
 (0)