Skip to content

Commit cd3013b

Browse files
authored
refactor: remove deprecated static constructors of FrameworkException and child classes (#9977)
1 parent 4c69f68 commit cd3013b

File tree

15 files changed

+38
-109
lines changed

15 files changed

+38
-109
lines changed

system/Exceptions/DownloadException.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ public static function forNotFoundDownloadSource()
4444
return new static(lang('HTTP.notFoundDownloadSource'));
4545
}
4646

47-
/**
48-
* @deprecated Since v4.5.6
49-
*
50-
* @return static
51-
*/
52-
public static function forCannotSetCache()
53-
{
54-
return new static(lang('HTTP.cannotSetCache'));
55-
}
56-
5747
/**
5848
* @return static
5949
*/

system/Exceptions/FrameworkException.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,6 @@ public static function forCopyError(string $path)
5555
return new static(lang('Core.copyError', [$path]));
5656
}
5757

58-
/**
59-
* @return static
60-
*
61-
* @deprecated 4.5.0 No longer used.
62-
*/
63-
public static function forMissingExtension(string $extension)
64-
{
65-
if (str_contains($extension, 'intl')) {
66-
// @codeCoverageIgnoreStart
67-
$message = sprintf(
68-
'The framework needs the following extension(s) installed and loaded: %s.',
69-
$extension,
70-
);
71-
// @codeCoverageIgnoreEnd
72-
} else {
73-
$message = lang('Core.missingExtension', [$extension]);
74-
}
75-
76-
return new static($message);
77-
}
78-
7958
/**
8059
* @return static
8160
*/

system/HTTP/Exceptions/HTTPException.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -217,20 +217,6 @@ public static function forMoveFailed(string $source, string $target, string $err
217217
return new static(lang('HTTP.moveFailed', [$source, $target, $error]));
218218
}
219219

220-
/**
221-
* For Invalid SameSite attribute setting
222-
*
223-
* @return HTTPException
224-
*
225-
* @deprecated Use `CookieException::forInvalidSameSite()` instead.
226-
*
227-
* @codeCoverageIgnore
228-
*/
229-
public static function forInvalidSameSiteSetting(string $samesite)
230-
{
231-
return new static(lang('Security.invalidSameSiteSetting', [$samesite]));
232-
}
233-
234220
/**
235221
* Thrown when the JSON format is not supported.
236222
* This is specifically for cases where data validation is expected to work with key-value structures.

system/Honeypot/Exceptions/HoneypotException.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ public static function forNoNameField()
3737
return new static(lang('Honeypot.noNameField'));
3838
}
3939

40-
/**
41-
* Thrown when the hidden value of config is false.
42-
*
43-
* @return static
44-
*
45-
* @deprecated 4.6.4 Never used.
46-
*/
47-
public static function forNoHiddenValue()
48-
{
49-
return new static(lang('Honeypot.noHiddenValue'));
50-
}
51-
5240
/**
5341
* Thrown when there are no data in the request of honeypot field.
5442
*

system/Images/Handlers/ImageMagickHandler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use ImagickException;
2222
use ImagickPixel;
2323
use ImagickPixelException;
24+
use RuntimeException;
2425

2526
/**
2627
* Image handler for Imagick extension.
@@ -46,7 +47,10 @@ public function __construct($config = null)
4647
parent::__construct($config);
4748

4849
if (! extension_loaded('imagick')) {
49-
throw ImageException::forMissingExtension('IMAGICK'); // @codeCoverageIgnore
50+
throw new RuntimeException(sprintf(
51+
'The "%s" handler requires the "imagick" PHP extension.',
52+
static::class,
53+
));
5054
}
5155
}
5256

system/Language/en/Core.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@
1818
'invalidFile' => 'Invalid file: "{0}"',
1919
'invalidDirectory' => 'Directory does not exist: "{0}"',
2020
'invalidPhpVersion' => 'Your PHP version must be {0} or higher to run CodeIgniter. Current version: {1}',
21-
'missingExtension' => 'The framework needs the following extension(s) installed and loaded: "{0}".',
2221
'noHandlers' => '"{0}" must provide at least one Handler.',
2322
];

system/Language/en/HTTP.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
'cannotSetBinary' => 'When setting filepath cannot set binary.',
3838
'cannotSetFilepath' => 'When setting binary cannot set filepath: "{0}"',
3939
'notFoundDownloadSource' => 'Not found download body source.',
40-
'cannotSetCache' => 'It does not support caching for downloading.',
4140
'cannotSetStatusCode' => 'It does not support change status code for downloading. code: {0}, reason: {1}',
4241

4342
// Response
@@ -76,8 +75,4 @@
7675
'uploadErrNoTmpDir' => 'File could not be uploaded: missing temporary directory.',
7776
'uploadErrExtension' => 'File upload was stopped by a PHP extension.',
7877
'uploadErrUnknown' => 'The file "%s" was not uploaded due to an unknown error.',
79-
80-
// SameSite setting
81-
// @deprecated
82-
'invalidSameSiteSetting' => 'The SameSite setting must be None, Lax, Strict, or a blank string. Given: {0}',
8378
];

system/Language/en/Security.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@
1515
return [
1616
'disallowedAction' => 'The action you requested is not allowed.',
1717
'insecureCookie' => 'Attempted to send a secure cookie over a non-secure connection.',
18-
19-
// @deprecated
20-
'invalidSameSite' => 'The SameSite value must be None, Lax, Strict, or a blank string. Given: "{0}"',
2118
];

system/Language/en/Session.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,4 @@
1818
'writeProtectedSavePath' => 'Session: Configured save path "{0}" is not writable by the PHP process.',
1919
'emptySavePath' => 'Session: No save path configured.',
2020
'invalidSavePathFormat' => 'Session: Invalid Redis save path format: "{0}"',
21-
22-
// @deprecated
23-
'invalidSameSiteSetting' => 'Session: The SameSite setting must be None, Lax, Strict, or a blank string. Given: "{0}"',
2421
];

system/Security/Exceptions/SecurityException.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,4 @@ public static function forInvalidControlChars(string $source, string $string)
6969
400,
7070
);
7171
}
72-
73-
/**
74-
* @deprecated Use `CookieException::forInvalidSameSite()` instead.
75-
*
76-
* @codeCoverageIgnore
77-
*
78-
* @return static
79-
*/
80-
public static function forInvalidSameSite(string $samesite)
81-
{
82-
return new static(lang('Security.invalidSameSite', [$samesite]));
83-
}
8472
}

0 commit comments

Comments
 (0)