Skip to content

Commit f6bf3d2

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.4
2 parents f548a5e + 46a1e5e commit f6bf3d2

File tree

16 files changed

+115
-189
lines changed

16 files changed

+115
-189
lines changed

contributing/pull_request.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ as the existing code and ensures that the codebase will be as readable as possib
4444
You can fix most of the coding style violations by running this command in your terminal:
4545

4646
```console
47-
> composer cs-fix
47+
composer cs-fix
4848
```
4949

5050
You can check the coding style violations:
5151

5252
```console
53-
> composer cs
53+
composer cs
5454
```
5555

5656
### Unit Testing
@@ -213,19 +213,19 @@ so that you can fix whatever errors that pop up with your submission.
213213
PHPStan is expected to scan the entire framework by running this command in your terminal:
214214

215215
```console
216-
> vendor/bin/phpstan analyse
216+
vendor/bin/phpstan analyse
217217
```
218218

219219
Rector, on the other hand, can be run on the specific files you modified or added:
220220

221221
```console
222-
> vendor/bin/rector process --dry-run path/to/file
222+
vendor/bin/rector process --dry-run path/to/file
223223
```
224224

225225
If you run it without `--dry-run`, Rector will fix the code:
226226

227227
```console
228-
> vendor/bin/rector process path/to/file
228+
vendor/bin/rector process path/to/file
229229
```
230230

231231
[1]: https://github.com/phpstan/phpstan-src

phpstan-baseline.php

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,71 +1176,6 @@
11761176
'count' => 1,
11771177
'path' => __DIR__ . '/system/I18n/TimeLegacy.php',
11781178
];
1179-
$ignoreErrors[] = [
1180-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forEXIFUnsupported\\(\\) has no return type specified\\.$#',
1181-
'count' => 1,
1182-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1183-
];
1184-
$ignoreErrors[] = [
1185-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forFileNotSupported\\(\\) has no return type specified\\.$#',
1186-
'count' => 1,
1187-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1188-
];
1189-
$ignoreErrors[] = [
1190-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forImageProcessFailed\\(\\) has no return type specified\\.$#',
1191-
'count' => 1,
1192-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1193-
];
1194-
$ignoreErrors[] = [
1195-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidDirection\\(\\) has no return type specified\\.$#',
1196-
'count' => 1,
1197-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1198-
];
1199-
$ignoreErrors[] = [
1200-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidImageCreate\\(\\) has no return type specified\\.$#',
1201-
'count' => 1,
1202-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1203-
];
1204-
$ignoreErrors[] = [
1205-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidImageLibraryPath\\(\\) has no return type specified\\.$#',
1206-
'count' => 1,
1207-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1208-
];
1209-
$ignoreErrors[] = [
1210-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidPath\\(\\) has no return type specified\\.$#',
1211-
'count' => 1,
1212-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1213-
];
1214-
$ignoreErrors[] = [
1215-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forMissingAngle\\(\\) has no return type specified\\.$#',
1216-
'count' => 1,
1217-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1218-
];
1219-
$ignoreErrors[] = [
1220-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forMissingImage\\(\\) has no return type specified\\.$#',
1221-
'count' => 1,
1222-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1223-
];
1224-
$ignoreErrors[] = [
1225-
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forSaveFailed\\(\\) has no return type specified\\.$#',
1226-
'count' => 1,
1227-
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
1228-
];
1229-
$ignoreErrors[] = [
1230-
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:_text\\(\\) has no return type specified\\.$#',
1231-
'count' => 1,
1232-
'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php',
1233-
];
1234-
$ignoreErrors[] = [
1235-
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:ensureResource\\(\\) has no return type specified\\.$#',
1236-
'count' => 1,
1237-
'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php',
1238-
];
1239-
$ignoreErrors[] = [
1240-
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:reproportion\\(\\) has no return type specified\\.$#',
1241-
'count' => 1,
1242-
'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php',
1243-
];
12441179
$ignoreErrors[] = [
12451180
'message' => '#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#',
12461181
'count' => 1,
@@ -1251,21 +1186,6 @@
12511186
'count' => 2,
12521187
'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php',
12531188
];
1254-
$ignoreErrors[] = [
1255-
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:_text\\(\\) has no return type specified\\.$#',
1256-
'count' => 1,
1257-
'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php',
1258-
];
1259-
$ignoreErrors[] = [
1260-
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:ensureResource\\(\\) has no return type specified\\.$#',
1261-
'count' => 1,
1262-
'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php',
1263-
];
1264-
$ignoreErrors[] = [
1265-
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:supportedFormatCheck\\(\\) has no return type specified\\.$#',
1266-
'count' => 1,
1267-
'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php',
1268-
];
12691189
$ignoreErrors[] = [
12701190
'message' => '#^PHPDoc type string\\|null of property CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:\\$resource is not covariant with PHPDoc type resource\\|null of overridden property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$resource\\.$#',
12711191
'count' => 1,
@@ -1301,61 +1221,6 @@
13011221
'count' => 1,
13021222
'path' => __DIR__ . '/system/Model.php',
13031223
];
1304-
$ignoreErrors[] = [
1305-
'message' => '#^Method CodeIgniter\\\\Pager\\\\Exceptions\\\\PagerException\\:\\:forInvalidPaginationGroup\\(\\) has no return type specified\\.$#',
1306-
'count' => 1,
1307-
'path' => __DIR__ . '/system/Pager/Exceptions/PagerException.php',
1308-
];
1309-
$ignoreErrors[] = [
1310-
'message' => '#^Method CodeIgniter\\\\Pager\\\\Exceptions\\\\PagerException\\:\\:forInvalidTemplate\\(\\) has no return type specified\\.$#',
1311-
'count' => 1,
1312-
'path' => __DIR__ . '/system/Pager/Exceptions/PagerException.php',
1313-
];
1314-
$ignoreErrors[] = [
1315-
'message' => '#^Method CodeIgniter\\\\Pager\\\\Pager\\:\\:calculateCurrentPage\\(\\) has no return type specified\\.$#',
1316-
'count' => 1,
1317-
'path' => __DIR__ . '/system/Pager/Pager.php',
1318-
];
1319-
$ignoreErrors[] = [
1320-
'message' => '#^Method CodeIgniter\\\\Pager\\\\Pager\\:\\:ensureGroup\\(\\) has no return type specified\\.$#',
1321-
'count' => 1,
1322-
'path' => __DIR__ . '/system/Pager/Pager.php',
1323-
];
1324-
$ignoreErrors[] = [
1325-
'message' => '#^Method CodeIgniter\\\\Pager\\\\PagerRenderer\\:\\:updatePages\\(\\) has no return type specified\\.$#',
1326-
'count' => 1,
1327-
'path' => __DIR__ . '/system/Pager/PagerRenderer.php',
1328-
];
1329-
$ignoreErrors[] = [
1330-
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forCollision\\(\\) has no return type specified\\.$#',
1331-
'count' => 1,
1332-
'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php',
1333-
];
1334-
$ignoreErrors[] = [
1335-
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forDestinationNotAllowed\\(\\) has no return type specified\\.$#',
1336-
'count' => 1,
1337-
'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php',
1338-
];
1339-
$ignoreErrors[] = [
1340-
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forFileNotAllowed\\(\\) has no return type specified\\.$#',
1341-
'count' => 1,
1342-
'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php',
1343-
];
1344-
$ignoreErrors[] = [
1345-
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Publisher\\:\\:verifyAllowed\\(\\) has no return type specified\\.$#',
1346-
'count' => 1,
1347-
'path' => __DIR__ . '/system/Publisher/Publisher.php',
1348-
];
1349-
$ignoreErrors[] = [
1350-
'message' => '#^Method CodeIgniter\\\\RESTful\\\\BaseResource\\:\\:initController\\(\\) has no return type specified\\.$#',
1351-
'count' => 1,
1352-
'path' => __DIR__ . '/system/RESTful/BaseResource.php',
1353-
];
1354-
$ignoreErrors[] = [
1355-
'message' => '#^Method CodeIgniter\\\\RESTful\\\\BaseResource\\:\\:setModel\\(\\) has no return type specified\\.$#',
1356-
'count' => 1,
1357-
'path' => __DIR__ . '/system/RESTful/BaseResource.php',
1358-
];
13591224
$ignoreErrors[] = [
13601225
'message' => '#^Method CodeIgniter\\\\Router\\\\AutoRouter\\:\\:setDirectory\\(\\) has no return type specified\\.$#',
13611226
'count' => 1,

rector.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
3939
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
4040
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
41-
use Rector\PHPUnit\Rector\MethodCall\AssertPropertyExistsRector;
4241
use Rector\PHPUnit\Set\PHPUnitSetList;
4342
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
4443
use Rector\Set\ValueObject\LevelSetList;
@@ -78,8 +77,6 @@
7877
__DIR__ . '/tests/_support',
7978
JsonThrowOnErrorRector::class,
8079
StringifyStrNeedlesRector::class,
81-
// assertObjectHasAttribute() is deprecated
82-
AssertPropertyExistsRector::class,
8380

8481
RemoveUnusedPrivateMethodRector::class => [
8582
// private method called via getPrivateMethodInvoker

system/BaseModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ public function insert($data = null, bool $returnID = true)
760760

761761
// Must be called first, so we don't
762762
// strip out created_at values.
763-
$data = $this->doProtectFields($data);
763+
$data = $this->doProtectFieldsForInsert($data);
764764

765765
// doProtectFields() can further remove elements from
766766
// $data so we need to check for empty dataset again

system/Images/Exceptions/ImageException.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,101 @@
1616

1717
class ImageException extends FrameworkException implements ExceptionInterface
1818
{
19+
/**
20+
* Thrown when the image is not found.
21+
*
22+
* @return static
23+
*/
1924
public static function forMissingImage()
2025
{
2126
return new static(lang('Images.sourceImageRequired'));
2227
}
2328

29+
/**
30+
* Thrown when the file specific is not following the role.
31+
*
32+
* @return static
33+
*/
2434
public static function forFileNotSupported()
2535
{
2636
return new static(lang('Images.fileNotSupported'));
2737
}
2838

39+
/**
40+
* Thrown when the angle is undefined.
41+
*
42+
* @return static
43+
*/
2944
public static function forMissingAngle()
3045
{
3146
return new static(lang('Images.rotationAngleRequired'));
3247
}
3348

49+
/**
50+
* Thrown when the direction property is invalid.
51+
*
52+
* @return static
53+
*/
3454
public static function forInvalidDirection(?string $dir = null)
3555
{
3656
return new static(lang('Images.invalidDirection', [$dir]));
3757
}
3858

59+
/**
60+
* Thrown when the path property is invalid.
61+
*
62+
* @return static
63+
*/
3964
public static function forInvalidPath()
4065
{
4166
return new static(lang('Images.invalidPath'));
4267
}
4368

69+
/**
70+
* Thrown when the EXIF function is not supported.
71+
*
72+
* @return static
73+
*/
4474
public static function forEXIFUnsupported()
4575
{
4676
return new static(lang('Images.exifNotSupported'));
4777
}
4878

79+
/**
80+
* Thrown when the image specific is invalid.
81+
*
82+
* @return static
83+
*/
4984
public static function forInvalidImageCreate(?string $extra = null)
5085
{
5186
return new static(lang('Images.unsupportedImageCreate') . ' ' . $extra);
5287
}
5388

89+
/**
90+
* Thrown when the image save failed.
91+
*
92+
* @return static
93+
*/
5494
public static function forSaveFailed()
5595
{
5696
return new static(lang('Images.saveFailed'));
5797
}
5898

99+
/**
100+
* Thrown when the image library path is invalid.
101+
*
102+
* @return static
103+
*/
59104
public static function forInvalidImageLibraryPath(?string $path = null)
60105
{
61106
return new static(lang('Images.libPathInvalid', [$path]));
62107
}
63108

109+
/**
110+
* Thrown when the image process failed.
111+
*
112+
* @return static
113+
*/
64114
public static function forImageProcessFailed()
65115
{
66116
return new static(lang('Images.imageProcessFailed'));

system/Images/Handlers/BaseHandler.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ public function withFile(string $path)
156156

157157
/**
158158
* Make the image resource object if needed
159+
*
160+
* @return void
159161
*/
160162
abstract protected function ensureResource();
161163

@@ -422,6 +424,8 @@ public function text(string $text, array $options = [])
422424

423425
/**
424426
* Handler-specific method for overlaying text on an image.
427+
*
428+
* @return void
425429
*/
426430
abstract protected function _text(string $text, array $options = []);
427431

@@ -722,6 +726,8 @@ public function __call(string $name, array $args = [])
722726
*
723727
* This function lets us re-proportion the width/height
724728
* if users choose to maintain the aspect ratio when resizing.
729+
*
730+
* @return void
725731
*/
726732
protected function reproportion()
727733
{

system/Images/Handlers/ImageMagickHandler.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ protected function getResourcePath()
290290
/**
291291
* Make the image resource object if needed
292292
*
293+
* @return void
294+
*
293295
* @throws Exception
294296
*/
295297
protected function ensureResource()
@@ -302,6 +304,8 @@ protected function ensureResource()
302304
/**
303305
* Check if given image format is supported
304306
*
307+
* @return void
308+
*
305309
* @throws ImageException
306310
*/
307311
protected function supportedFormatCheck()
@@ -318,6 +322,8 @@ protected function supportedFormatCheck()
318322
/**
319323
* Handler-specific method for overlaying text on an image.
320324
*
325+
* @return void
326+
*
321327
* @throws Exception
322328
*/
323329
protected function _text(string $text, array $options = [])

0 commit comments

Comments
 (0)