[Rector] Re-run InlineIfToExplicitIfRector on Latest Rector 0.11.36

This commit is contained in:
Abdul Malik Ikhsan 2021-07-11 07:31:21 +07:00
parent 02ac2de62d
commit ac19c85ed0
No known key found for this signature in database
GPG Key ID: 69AC5BC354C89BE6
23 changed files with 150 additions and 53 deletions

View File

@ -20,10 +20,10 @@
"mikey179/vfsstream": "^1.6", "mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.1", "nexusphp/cs-config": "^3.1",
"nexusphp/tachycardia": "^1.0", "nexusphp/tachycardia": "^1.0",
"phpstan/phpstan": "0.12.90", "phpstan/phpstan": "0.12.91",
"phpunit/phpunit": "^9.1", "phpunit/phpunit": "^9.1",
"predis/predis": "^1.1", "predis/predis": "^1.1",
"rector/rector": "0.11.35", "rector/rector": "0.11.36",
"symplify/package-builder": "^9.3" "symplify/package-builder": "^9.3"
}, },
"suggest": { "suggest": {

View File

@ -61,6 +61,10 @@ return static function (ContainerConfigurator $containerConfigurator): void {
PassStrictParameterToFunctionParameterRector::class => [__DIR__ . '/tests/system/Database/Live/SelectTest.php'], PassStrictParameterToFunctionParameterRector::class => [__DIR__ . '/tests/system/Database/Live/SelectTest.php'],
JsonThrowOnErrorRector::class, JsonThrowOnErrorRector::class,
StringifyStrNeedlesRector::class, StringifyStrNeedlesRector::class,
InlineIfToExplicitIfRector::class => [
__DIR__ . '/app/Config',
__DIR__ . '/system/Test/bootstrap.php',
],
]); ]);
// auto import fully qualified class names // auto import fully qualified class names

View File

@ -239,7 +239,9 @@ class CodeIgniter
$file = SYSTEMPATH . 'ThirdParty/Kint/' . implode('/', $class) . '.php'; $file = SYSTEMPATH . 'ThirdParty/Kint/' . implode('/', $class) . '.php';
file_exists($file) && require_once $file; if (file_exists($file)) {
require_once $file;
}
}); });
require_once SYSTEMPATH . 'ThirdParty/Kint/init.php'; require_once SYSTEMPATH . 'ThirdParty/Kint/init.php';
@ -476,7 +478,9 @@ class CodeIgniter
protected function detectEnvironment() protected function detectEnvironment()
{ {
// Make sure ENVIRONMENT isn't already set by other means. // Make sure ENVIRONMENT isn't already set by other means.
defined('ENVIRONMENT') || define('ENVIRONMENT', $_SERVER['CI_ENVIRONMENT'] ?? 'production'); // @codeCoverageIgnore if (!defined('ENVIRONMENT')) {
define('ENVIRONMENT', $_SERVER['CI_ENVIRONMENT'] ?? 'production');
} // @codeCoverageIgnore
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View File

@ -151,7 +151,9 @@ abstract class BaseResult implements ResultInterface
return $this->customResultObject[$className]; return $this->customResultObject[$className];
} }
$this->rowData === null || $this->dataSeek(); if ($this->rowData !== null) {
$this->dataSeek();
}
$this->customResultObject[$className] = []; $this->customResultObject[$className] = [];
while ($row = $this->fetchObject($className)) { while ($row = $this->fetchObject($className)) {
@ -196,7 +198,9 @@ abstract class BaseResult implements ResultInterface
return $this->resultArray; return $this->resultArray;
} }
$this->rowData === null || $this->dataSeek(); if ($this->rowData !== null) {
$this->dataSeek();
}
while ($row = $this->fetchAssoc()) { while ($row = $this->fetchAssoc()) {
$this->resultArray[] = $row; $this->resultArray[] = $row;
@ -235,7 +239,9 @@ abstract class BaseResult implements ResultInterface
return $this->resultObject; return $this->resultObject;
} }
$this->rowData === null || $this->dataSeek(); if ($this->rowData !== null) {
$this->dataSeek();
}
while ($row = $this->fetchObject()) { while ($row = $this->fetchObject()) {
if (! is_subclass_of($row, Entity::class) && method_exists($row, 'syncOriginal')) { if (! is_subclass_of($row, Entity::class) && method_exists($row, 'syncOriginal')) {
@ -303,7 +309,9 @@ abstract class BaseResult implements ResultInterface
*/ */
public function getCustomRowObject(int $n, string $className) public function getCustomRowObject(int $n, string $className)
{ {
isset($this->customResultObject[$className]) || $this->getCustomResultObject($className); if (!isset($this->customResultObject[$className])) {
$this->getCustomResultObject($className);
}
if (empty($this->customResultObject[$className])) { if (empty($this->customResultObject[$className])) {
return null; return null;

View File

@ -905,8 +905,9 @@ class Forge
continue; continue;
} }
// @phpstan-ignore-next-line if (isset($attributes['TYPE'])) {
isset($attributes['TYPE']) && $this->_attributeType($attributes); $this->_attributeType($attributes);
}
$field = [ $field = [
'name' => $key, 'name' => $key,
@ -921,8 +922,9 @@ class Forge
'_literal' => false, '_literal' => false,
]; ];
// @phpstan-ignore-next-line if (isset($attributes['TYPE'])) {
isset($attributes['TYPE']) && $this->_attributeUnsigned($attributes, $field); $this->_attributeUnsigned($attributes, $field);
}
if ($createTable === false) { if ($createTable === false) {
if (isset($attributes['AFTER'])) { if (isset($attributes['AFTER'])) {

View File

@ -136,8 +136,9 @@ class Connection extends BaseConnection
if (! empty($ssl)) { if (! empty($ssl)) {
if (isset($this->encrypt['ssl_verify'])) { if (isset($this->encrypt['ssl_verify'])) {
if ($this->encrypt['ssl_verify']) { if ($this->encrypt['ssl_verify']) {
defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') if (defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT')) {
&& $this->mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, 1); $this->mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, 1);
}
} }
// Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT // Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT
// to FALSE didn't do anything, so PHP 5.6.16 introduced yet another // to FALSE didn't do anything, so PHP 5.6.16 introduced yet another

View File

@ -75,7 +75,9 @@ class Connection extends BaseConnection
return false; return false;
} }
empty($this->schema) || $this->simpleQuery("SET search_path TO {$this->schema},public"); if (!empty($this->schema)) {
$this->simpleQuery("SET search_path TO {$this->schema},public");
}
if ($this->setClientEncoding($this->charset) === false) { if ($this->setClientEncoding($this->charset) === false) {
return false; return false;

View File

@ -2256,7 +2256,9 @@ class Email
*/ */
public function __destruct() public function __destruct()
{ {
is_resource($this->SMTPConnect) && $this->sendCommand('quit'); if (is_resource($this->SMTPConnect)) {
$this->sendCommand('quit');
}
} }
/** /**

View File

@ -219,7 +219,9 @@ class MemcachedHandler extends BaseHandler
public function close(): bool public function close(): bool
{ {
if (isset($this->memcached)) { if (isset($this->memcached)) {
isset($this->lockKey) && $this->memcached->delete($this->lockKey); if (isset($this->lockKey)) {
$this->memcached->delete($this->lockKey);
}
if (! $this->memcached->quit()) { if (! $this->memcached->quit()) {
return false; return false;

View File

@ -231,7 +231,9 @@ class RedisHandler extends BaseHandler
$pingReply = $this->redis->ping(); $pingReply = $this->redis->ping();
// @phpstan-ignore-next-line // @phpstan-ignore-next-line
if (($pingReply === true) || ($pingReply === '+PONG')) { if (($pingReply === true) || ($pingReply === '+PONG')) {
isset($this->lockKey) && $this->redis->del($this->lockKey); if (isset($this->lockKey)) {
$this->redis->del($this->lockKey);
}
if (! $this->redis->close()) { if (! $this->redis->close()) {
return false; return false;

View File

@ -28,8 +28,12 @@ final class CommandGeneratorTest extends CIUnitTestCase
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
$dir = dirname($file); $dir = dirname($file);
is_file($file) && unlink($file); if (is_file($file)) {
is_dir($dir) && strpos($dir, 'Commands') !== false && rmdir($dir); unlink($file);
}
if (is_dir($dir) && strpos($dir, 'Commands') !== false) {
rmdir($dir);
}
} }
protected function getFileContents(string $filepath): string protected function getFileContents(string $filepath): string

View File

@ -26,7 +26,9 @@ final class ConfigGeneratorTest extends CIUnitTestCase
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer); $result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
} }
public function testGenerateConfig() public function testGenerateConfig()

View File

@ -35,7 +35,9 @@ final class ConfigurableSortImportsTest extends CIUnitTestCase
$this->assertStringContainsString('File created: ', CITestStreamFilter::$buffer); $this->assertStringContainsString('File created: ', CITestStreamFilter::$buffer);
$this->assertFileExists($file); $this->assertFileExists($file);
$this->assertNotSame(sha1_file(SUPPORTPATH . 'Commands/Foobar.php'), sha1_file($file)); $this->assertNotSame(sha1_file(SUPPORTPATH . 'Commands/Foobar.php'), sha1_file($file));
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
} }
public function testEnabledSortImportsWillDisruptLanguageFilePublish() public function testEnabledSortImportsWillDisruptLanguageFilePublish()
@ -46,9 +48,13 @@ final class ConfigurableSortImportsTest extends CIUnitTestCase
$this->assertStringContainsString('File created: ', CITestStreamFilter::$buffer); $this->assertStringContainsString('File created: ', CITestStreamFilter::$buffer);
$this->assertFileExists($file); $this->assertFileExists($file);
$this->assertNotSame(sha1_file(SUPPORTPATH . 'Commands/Foobar.php'), sha1_file($file)); $this->assertNotSame(sha1_file(SUPPORTPATH . 'Commands/Foobar.php'), sha1_file($file));
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
$dir = dirname($file); $dir = dirname($file);
is_dir($dir) && rmdir($dir); if (is_dir($dir)) {
rmdir($dir);
}
} }
public function testDisabledSortImportsWillNotAffectLanguageFilesPublish() public function testDisabledSortImportsWillNotAffectLanguageFilesPublish()
@ -59,8 +65,12 @@ final class ConfigurableSortImportsTest extends CIUnitTestCase
$this->assertStringContainsString('File created: ', CITestStreamFilter::$buffer); $this->assertStringContainsString('File created: ', CITestStreamFilter::$buffer);
$this->assertFileExists($file); $this->assertFileExists($file);
$this->assertSame(sha1_file(SUPPORTPATH . 'Commands/Foobar.php'), sha1_file($file)); $this->assertSame(sha1_file(SUPPORTPATH . 'Commands/Foobar.php'), sha1_file($file));
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
$dir = dirname($file); $dir = dirname($file);
is_dir($dir) && rmdir($dir); if (is_dir($dir)) {
rmdir($dir);
}
} }
} }

View File

@ -26,7 +26,9 @@ final class ControllerGeneratorTest extends CIUnitTestCase
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer); $result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
} }
protected function getFileContents(string $filepath): string protected function getFileContents(string $filepath): string

View File

@ -27,8 +27,12 @@ final class EntityGeneratorTest extends CIUnitTestCase
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer); $result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
$dir = dirname($file); $dir = dirname($file);
is_file($file) && unlink($file); if (is_file($file)) {
is_dir($dir) && rmdir($dir); unlink($file);
}
if (is_dir($dir)) {
rmdir($dir);
}
} }
public function testGenerateEntity() public function testGenerateEntity()

View File

@ -26,7 +26,9 @@ final class FilterGeneratorTest extends CIUnitTestCase
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer); $result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
} }
public function testGenerateFilter() public function testGenerateFilter()

View File

@ -30,7 +30,9 @@ final class GeneratorsTest extends CIUnitTestCase
command('make:seeder categories'); command('make:seeder categories');
$this->assertStringContainsString('File created: ', CITestStreamFilter::$buffer); $this->assertStringContainsString('File created: ', CITestStreamFilter::$buffer);
$file = APPPATH . 'Database/Seeds/Categories.php'; $file = APPPATH . 'Database/Seeds/Categories.php';
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
} }
public function testGenerateFileExists() public function testGenerateFileExists()
@ -41,7 +43,9 @@ final class GeneratorsTest extends CIUnitTestCase
command('make:filter items'); command('make:filter items');
$this->assertStringContainsString('File exists: ', CITestStreamFilter::$buffer); $this->assertStringContainsString('File exists: ', CITestStreamFilter::$buffer);
$file = APPPATH . 'Filters/Items.php'; $file = APPPATH . 'Filters/Items.php';
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
} }
public function testGenerateFileOverwritten() public function testGenerateFileOverwritten()
@ -52,7 +56,9 @@ final class GeneratorsTest extends CIUnitTestCase
command('make:controller products -force'); command('make:controller products -force');
$this->assertStringContainsString('File overwritten: ', CITestStreamFilter::$buffer); $this->assertStringContainsString('File overwritten: ', CITestStreamFilter::$buffer);
$file = APPPATH . 'Controllers/Products.php'; $file = APPPATH . 'Controllers/Products.php';
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
} }
public function testGenerateFileFailsOnUnwritableDirectory() public function testGenerateFileFailsOnUnwritableDirectory()
@ -82,8 +88,12 @@ final class GeneratorsTest extends CIUnitTestCase
$dir = dirname($file); $dir = dirname($file);
$this->assertFileExists($file); $this->assertFileExists($file);
$this->assertDirectoryExists($dir); $this->assertDirectoryExists($dir);
is_file($file) && unlink($file); if (is_file($file)) {
is_dir($dir) && rmdir($dir); unlink($file);
}
if (is_dir($dir)) {
rmdir($dir);
}
} }
public function testSuffixingHasNoEffect(): void public function testSuffixingHasNoEffect(): void
@ -96,8 +106,14 @@ final class GeneratorsTest extends CIUnitTestCase
$this->assertFileExists($file1); $this->assertFileExists($file1);
$this->assertFileDoesNotExist($file2); $this->assertFileDoesNotExist($file2);
is_file($file1) && unlink($file1); if (is_file($file1)) {
is_file($file2) && unlink($file2); unlink($file1);
is_dir($dir) && rmdir($dir); }
if (is_file($file2)) {
unlink($file2);
}
if (is_dir($dir)) {
rmdir($dir);
}
} }
} }

View File

@ -26,7 +26,9 @@ final class MigrationGeneratorTest extends CIUnitTestCase
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer); $result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
file_exists($file) && unlink($file); if (file_exists($file)) {
unlink($file);
}
} }
public function testGenerateMigration() public function testGenerateMigration()

View File

@ -26,7 +26,9 @@ final class ModelGeneratorTest extends CIUnitTestCase
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer); $result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
} }
protected function getFileContent(string $filepath): string protected function getFileContent(string $filepath): string
@ -93,12 +95,18 @@ final class ModelGeneratorTest extends CIUnitTestCase
$file = APPPATH . 'Models/User.php'; $file = APPPATH . 'Models/User.php';
$this->assertFileExists($file); $this->assertFileExists($file);
$this->assertStringContainsString('protected $returnType = \'App\Entities\User\';', $this->getFileContent($file)); $this->assertStringContainsString('protected $returnType = \'App\Entities\User\';', $this->getFileContent($file));
is_file($file) && unlink($file); if (is_file($file)) {
unlink($file);
}
$file = APPPATH . 'Entities/User.php'; $file = APPPATH . 'Entities/User.php';
$this->assertFileExists($file); $this->assertFileExists($file);
$dir = dirname($file); $dir = dirname($file);
is_file($file) && unlink($file); if (is_file($file)) {
is_dir($dir) && rmdir($dir); unlink($file);
}
if (is_dir($dir)) {
rmdir($dir);
}
} }
public function testGenerateModelWithOptionSuffix() public function testGenerateModelWithOptionSuffix()

View File

@ -26,7 +26,9 @@ final class SeederGeneratorTest extends CIUnitTestCase
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer); $result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
file_exists($file) && unlink($file); if (file_exists($file)) {
unlink($file);
}
} }
public function testGenerateSeeder() public function testGenerateSeeder()

View File

@ -28,7 +28,9 @@ final class SessionsCommandsTest extends CIUnitTestCase
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer); $result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
file_exists($file) && unlink($file); if (file_exists($file)) {
unlink($file);
}
} }
public function testCreateMigrationCommand() public function testCreateMigrationCommand()

View File

@ -27,8 +27,12 @@ final class ValidationGeneratorTest extends CIUnitTestCase
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer); $result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14))); $file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
$dir = dirname($file); $dir = dirname($file);
is_file($file) && unlink($file); if (is_file($file)) {
is_dir($dir) && rmdir($dir); unlink($file);
}
if (is_dir($dir)) {
rmdir($dir);
}
} }
public function testGenerateValidation() public function testGenerateValidation()

View File

@ -71,7 +71,9 @@ final class FileMovingTest extends CIUnitTestCase
$destination = $this->destination; $destination = $this->destination;
// Create the destination if not exists // Create the destination if not exists
is_dir($destination) || mkdir($destination, 0777, true); if (!is_dir($destination)) {
mkdir($destination, 0777, true);
}
foreach ($collection->all() as $file) { foreach ($collection->all() as $file) {
$this->assertInstanceOf(UploadedFile::class, $file); $this->assertInstanceOf(UploadedFile::class, $file);
@ -121,7 +123,9 @@ final class FileMovingTest extends CIUnitTestCase
$destination = $this->destination; $destination = $this->destination;
// Create the destination if not exists // Create the destination if not exists
is_dir($destination) || mkdir($destination, 0777, true); if (!is_dir($destination)) {
mkdir($destination, 0777, true);
}
foreach ($collection->all() as $file) { foreach ($collection->all() as $file) {
$this->assertInstanceOf(UploadedFile::class, $file); $this->assertInstanceOf(UploadedFile::class, $file);
@ -157,7 +161,9 @@ final class FileMovingTest extends CIUnitTestCase
$destination = $this->destination; $destination = $this->destination;
// Create the destination if not exists // Create the destination if not exists
is_dir($destination) || mkdir($destination, 0777, true); if (!is_dir($destination)) {
mkdir($destination, 0777, true);
}
$file = $collection->getFile('userfile1'); $file = $collection->getFile('userfile1');
@ -190,7 +196,9 @@ final class FileMovingTest extends CIUnitTestCase
$destination = $this->destination; $destination = $this->destination;
// Create the destination if not exists // Create the destination if not exists
is_dir($destination) || mkdir($destination, 0777, true); if (!is_dir($destination)) {
mkdir($destination, 0777, true);
}
$file = $collection->getFile('userfile1'); $file = $collection->getFile('userfile1');
@ -222,7 +230,9 @@ final class FileMovingTest extends CIUnitTestCase
$destination = $this->destination; $destination = $this->destination;
// Create the destination if not exists // Create the destination if not exists
is_dir($destination) || mkdir($destination, 0777, true); if (!is_dir($destination)) {
mkdir($destination, 0777, true);
}
$this->expectException(HTTPException::class); $this->expectException(HTTPException::class);
@ -272,7 +282,9 @@ final class FileMovingTest extends CIUnitTestCase
$destination = $this->destination; $destination = $this->destination;
// Create the destination and make it read only // Create the destination and make it read only
is_dir($destination) || mkdir($destination, 0400, true); if (!is_dir($destination)) {
mkdir($destination, 0400, true);
}
$collection = new FileCollection(); $collection = new FileCollection();
$file = $collection->getFile('userfile'); $file = $collection->getFile('userfile');