From 0d55e1784252321d48b1cdff42d0ebb7842a15a1 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 4 Feb 2019 22:30:05 +0100 Subject: [PATCH] Use global namespace+minor fixes --- Account/Group.php | 3 +++ DataStorage/Database/DataMapperAbstract.php | 10 ++++++++++ Localization/Money.php | 8 ++++---- Math/Matrix/Matrix.php | 6 +++--- Message/Http/Request.php | 4 +--- Message/ResponseAbstract.php | 2 +- Model/Message/FormValidation.php | 3 +++ Model/Message/Notify.php | 3 +++ Model/Message/Redirect.php | 3 +++ Model/Message/Reload.php | 3 +++ System/File/FileUtils.php | 4 ++-- System/File/Ftp/FtpStorage.php | 2 +- System/File/Local/Directory.php | 4 ++-- System/File/Local/File.php | 4 ++-- System/File/Local/LocalStorage.php | 2 +- Utils/Excel/Excel.php | 2 +- Validation/Base/Json.php | 2 +- Validation/Validator.php | 4 ++-- .../Connection/FileCacheJsonSerializable.php | 3 +++ .../Database/TestModel/BaseModelMapper.php | 14 ++++++++++++-- tests/Localization/Defaults/CityMapperTest.php | 2 +- .../Localization/Defaults/CountryMapperTest.php | 2 +- .../Localization/Defaults/CurrencyMapperTest.php | 2 +- tests/Localization/Defaults/IbanMapperTest.php | 2 +- .../Localization/Defaults/LanguageMapperTest.php | 2 +- tests/Module/InfoManagerTest.php | 2 +- tests/Module/PackageManagerTest.php | 16 ++++++++-------- tests/System/File/Ftp/DirectoryTest.php | 2 +- tests/System/File/Ftp/FileTest.php | 2 +- tests/System/File/Ftp/FtpStorageTest.php | 4 ++-- tests/System/File/Local/DirectoryTest.php | 2 +- tests/System/File/Local/FileTest.php | 2 +- tests/System/File/Local/LocalStorageTest.php | 4 ++-- tests/Utils/Git/RepositoryTest.php | 2 +- tests/Utils/Parser/Markdown/MarkdownTest.php | 2 +- tests/Validation/Base/JsonTest.php | 10 +++++----- 36 files changed, 90 insertions(+), 54 deletions(-) diff --git a/Account/Group.php b/Account/Group.php index 402391c5c..633726081 100644 --- a/Account/Group.php +++ b/Account/Group.php @@ -213,6 +213,9 @@ class Group implements ArrayableInterface, \JsonSerializable * * @since 1.0.0 */ + /** + * {@inheritdoc} + */ public function jsonSerialize() { return $this->toArray(); diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index 3fcb4a4f5..277a06efe 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -89,6 +89,11 @@ class DataMapperAbstract implements DataMapperInterface * * @var string[] * @since 1.0.0 + */ /** + * Has many relation. + * + * @var array> + * @since 1.0.0 */ protected static $hasMany = []; @@ -109,6 +114,11 @@ class DataMapperAbstract implements DataMapperInterface * * @var string[] * @since 1.0.0 + */ /** + * Belongs to. + * + * @var array> + * @since 1.0.0 */ protected static $belongsTo = []; diff --git a/Localization/Money.php b/Localization/Money.php index b79421ed2..d3aaa2dff 100644 --- a/Localization/Money.php +++ b/Localization/Money.php @@ -86,7 +86,7 @@ final class Money implements \Serializable */ public function __construct($value = 0, string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0) { - $this->value = is_int($value) ? $value : self::toInt((string) $value); + $this->value = \is_int($value) ? $value : self::toInt((string) $value); $this->thousands = $thousands; $this->decimal = $decimal; $this->symbol = $symbol; @@ -273,7 +273,7 @@ final class Money implements \Serializable */ public function mult($value) : self { - if (\is_float($value) || is_int($value)) { + if (\is_float($value) || \is_int($value)) { $this->value = (int) ($this->value * $value); } @@ -291,7 +291,7 @@ final class Money implements \Serializable */ public function div($value) : self { - if (\is_float($value) || is_int($value)) { + if (\is_float($value) || \is_int($value)) { $this->value = (int) ($this->value / $value); } @@ -323,7 +323,7 @@ final class Money implements \Serializable */ public function pow($value) : self { - if (\is_float($value) || is_int($value)) { + if (\is_float($value) || \is_int($value)) { $this->value = (int) ($this->value ** $value); } diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index 6d348f72e..126c8b52f 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -402,7 +402,7 @@ class Matrix implements \ArrayAccess, \Iterator { if ($value instanceof self) { return $this->add($value->mult(-1)); - } elseif (!is_string($value) && is_numeric($value)) { + } elseif (!\is_string($value) && is_numeric($value)) { return $this->add(-$value); } @@ -424,7 +424,7 @@ class Matrix implements \ArrayAccess, \Iterator { if ($value instanceof self) { return $this->addMatrix($value); - } elseif (!is_string($value) && is_numeric($value)) { + } elseif (!\is_string($value) && is_numeric($value)) { return $this->addScalar($value); } @@ -529,7 +529,7 @@ class Matrix implements \ArrayAccess, \Iterator { if ($value instanceof self) { return $this->multMatrix($value); - } elseif (!is_string($value) && is_numeric($value)) { + } elseif (!\is_string($value) && is_numeric($value)) { return $this->multScalar($value); } diff --git a/Message/Http/Request.php b/Message/Http/Request.php index b722dc646..9f0e0d9c5 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -122,8 +122,6 @@ final class Request extends RequestAbstract $this->header->getL11n()->setLanguage($this->loadRequestLanguage()); $this->initNonGetData(); - - $this->uri = $this->uri ?? new Http(Http::getCurrent()); } /** @@ -483,7 +481,7 @@ final class Request extends RequestAbstract if ($this->getMethod() === RequestMethod::GET && !empty($this->data)) { return $this->uri->__toString() . (\parse_url($this->uri->__toString(), PHP_URL_QUERY) ? '&' : '?') - . http_build_query($this->data); + . \http_build_query($this->data); } return parent::__toString(); diff --git a/Message/ResponseAbstract.php b/Message/ResponseAbstract.php index d4fd04a39..c23203f8b 100644 --- a/Message/ResponseAbstract.php +++ b/Message/ResponseAbstract.php @@ -67,7 +67,7 @@ abstract class ResponseAbstract implements MessageInterface, \JsonSerializable */ public function set($key, $response, bool $overwrite = true) : void { - // This is not working since the key kontains :: from http:// + // This is not working since the key contains :: from http:// //$this->response = ArrayUtils::setArray((string) $key, $this->response, $response, ':', $overwrite); $this->response[$key] = $response; } diff --git a/Model/Message/FormValidation.php b/Model/Message/FormValidation.php index 2cf5bc402..e2fb7fe73 100644 --- a/Model/Message/FormValidation.php +++ b/Model/Message/FormValidation.php @@ -74,6 +74,9 @@ class FormValidation implements \Serializable, ArrayableInterface, \JsonSerializ * * @since 1.0.0 */ + /** + * {@inheritdoc} + */ public function jsonSerialize() { return $this->toArray(); diff --git a/Model/Message/Notify.php b/Model/Message/Notify.php index 502c05720..523b19d5b 100644 --- a/Model/Message/Notify.php +++ b/Model/Message/Notify.php @@ -178,6 +178,9 @@ class Notify implements \Serializable, ArrayableInterface, \JsonSerializable * * @since 1.0.0 */ + /** + * {@inheritdoc} + */ public function jsonSerialize() { return $this->toArray(); diff --git a/Model/Message/Redirect.php b/Model/Message/Redirect.php index 603c75ac4..4b9e0c7b6 100644 --- a/Model/Message/Redirect.php +++ b/Model/Message/Redirect.php @@ -120,6 +120,9 @@ class Redirect implements \Serializable, ArrayableInterface, \JsonSerializable * * @since 1.0.0 */ + /** + * {@inheritdoc} + */ public function jsonSerialize() { return $this->toArray(); diff --git a/Model/Message/Reload.php b/Model/Message/Reload.php index 92e3f11a7..9381a2932 100644 --- a/Model/Message/Reload.php +++ b/Model/Message/Reload.php @@ -125,6 +125,9 @@ class Reload implements \Serializable, ArrayableInterface, \JsonSerializable * * @since 1.0.0 */ + /** + * {@inheritdoc} + */ public function jsonSerialize() { return $this->toArray(); diff --git a/System/File/FileUtils.php b/System/File/FileUtils.php index bd984329d..6e8a267c9 100644 --- a/System/File/FileUtils.php +++ b/System/File/FileUtils.php @@ -132,8 +132,8 @@ final class FileUtils { $content = \file_get_contents($file); - if ($content !== false && preg_match('!!u', $content)) { - \file_put_contents($file, \mb_convert_encoding($content, 'UTF-8', mb_list_encodings())); + if ($content !== false && \preg_match('!!u', $content)) { + \file_put_contents($file, \mb_convert_encoding($content, 'UTF-8', \mb_list_encodings())); } } } diff --git a/System/File/Ftp/FtpStorage.php b/System/File/Ftp/FtpStorage.php index 9d3399619..20a2d9c78 100644 --- a/System/File/Ftp/FtpStorage.php +++ b/System/File/Ftp/FtpStorage.php @@ -48,7 +48,7 @@ class FtpStorage extends StorageAbstract protected static function getClassType(string $path) : string { - return \is_dir($path) || (!is_file($path) && \stripos($path, '.') === false) ? Directory::class : File::class; + return \is_dir($path) || (!\is_file($path) && \stripos($path, '.') === false) ? Directory::class : File::class; } /** diff --git a/System/File/Local/Directory.php b/System/File/Local/Directory.php index 7b940d87f..c2d577bba 100644 --- a/System/File/Local/Directory.php +++ b/System/File/Local/Directory.php @@ -329,7 +329,7 @@ final class Directory extends FileAbstract implements DirectoryInterface */ public static function copy(string $from, string $to, bool $overwrite = false) : bool { - if (!is_dir($from)) { + if (!\is_dir($from)) { throw new PathException($from); } @@ -360,7 +360,7 @@ final class Directory extends FileAbstract implements DirectoryInterface */ public static function move(string $from, string $to, bool $overwrite = false) : bool { - if (!is_dir($from)) { + if (!\is_dir($from)) { throw new PathException($from); } diff --git a/System/File/Local/File.php b/System/File/Local/File.php index 6a196f95c..c43e9bbde 100644 --- a/System/File/Local/File.php +++ b/System/File/Local/File.php @@ -343,7 +343,7 @@ final class File extends FileAbstract implements FileInterface */ public function getDirPath() : string { - return dirname($this->path); + return \dirname($this->path); } /** @@ -364,7 +364,7 @@ final class File extends FileAbstract implements FileInterface Directory::create(\dirname($path), 0755, true); } - if (!is_writable(\dirname($path))) { + if (!\is_writable(\dirname($path))) { return false; } diff --git a/System/File/Local/LocalStorage.php b/System/File/Local/LocalStorage.php index 7506d86cf..3d15ad395 100644 --- a/System/File/Local/LocalStorage.php +++ b/System/File/Local/LocalStorage.php @@ -58,7 +58,7 @@ class LocalStorage extends StorageAbstract */ protected static function getClassType(string $path) : string { - return \is_dir($path) || (!is_file($path) && \stripos($path, '.') === false) ? Directory::class : File::class; + return \is_dir($path) || (!\is_file($path) && \stripos($path, '.') === false) ? Directory::class : File::class; } /** diff --git a/Utils/Excel/Excel.php b/Utils/Excel/Excel.php index 44ed53327..43fb10c18 100644 --- a/Utils/Excel/Excel.php +++ b/Utils/Excel/Excel.php @@ -15,7 +15,7 @@ declare(strict_types=1); namespace phpOMS\Utils\Excel; /** @noinspection PhpIncludeInspection */ -require_once realpath(__DIR__ . '/../../../Resources/phpexcel/Classes/PHPExcel.php'); +require_once \realpath(__DIR__ . '/../../../Resources/phpexcel/Classes/PHPExcel.php'); /** * Excel class. diff --git a/Validation/Base/Json.php b/Validation/Base/Json.php index 9038f9c7a..b1ac46492 100644 --- a/Validation/Base/Json.php +++ b/Validation/Base/Json.php @@ -171,7 +171,7 @@ abstract class Json extends ValidatorAbstract } } - return count($completePaths) === 0; + return \count($completePaths) === 0; } /** diff --git a/Validation/Validator.php b/Validation/Validator.php index 9524bf49b..1c9764941 100644 --- a/Validation/Validator.php +++ b/Validation/Validator.php @@ -75,12 +75,12 @@ final class Validator extends ValidatorAbstract */ public static function isType($var, $constraint) : bool { - if (!is_array($constraint)) { + if (!\is_array($constraint)) { $constraint = [$constraint]; } foreach ($constraint as $key => $value) { - if (!is_a($var, $value)) { + if (!\is_a($var, $value)) { return false; } } diff --git a/tests/DataStorage/Cache/Connection/FileCacheJsonSerializable.php b/tests/DataStorage/Cache/Connection/FileCacheJsonSerializable.php index ccb7fb7a2..277ea6d9b 100644 --- a/tests/DataStorage/Cache/Connection/FileCacheJsonSerializable.php +++ b/tests/DataStorage/Cache/Connection/FileCacheJsonSerializable.php @@ -17,6 +17,9 @@ class FileCacheJsonSerializable implements \JsonSerializable { public $val = 'asdf'; + /** + * {@inheritdoc} + */ public function jsonSerialize() { return 'abc'; diff --git a/tests/DataStorage/Database/TestModel/BaseModelMapper.php b/tests/DataStorage/Database/TestModel/BaseModelMapper.php index e7582f9f4..7c00b0b82 100644 --- a/tests/DataStorage/Database/TestModel/BaseModelMapper.php +++ b/tests/DataStorage/Database/TestModel/BaseModelMapper.php @@ -38,6 +38,12 @@ class BaseModelMapper extends DataMapperAbstract 'test_base_belongs_to_one' => ['name' => 'test_base_belongs_to_one', 'type' => 'int', 'internal' => 'belongsToOne'], ]; + /** + * Belongs to. + * + * @var array> + * @since 1.0.0 + */ protected static $belongsTo = [ 'belongsToOne' => [ 'mapper' => BelongsToModelMapper::class, @@ -50,8 +56,12 @@ class BaseModelMapper extends DataMapperAbstract 'mapper' => OwnsOneModelMapper::class, 'dest' => 'test_base_owns_one_self', ], - ]; - + ]; /** + * Has many relation. + * + * @var array> + * @since 1.0.0 + */ protected static $hasMany = [ 'hasManyDirect' => [ 'mapper' => ManyToManyDirectModelMapper::class, diff --git a/tests/Localization/Defaults/CityMapperTest.php b/tests/Localization/Defaults/CityMapperTest.php index a47d9f5b8..3c7966ba5 100644 --- a/tests/Localization/Defaults/CityMapperTest.php +++ b/tests/Localization/Defaults/CityMapperTest.php @@ -26,7 +26,7 @@ class CityMapperTest extends \PHPUnit\Framework\TestCase $con = new SqliteConnection([ 'prefix' => '', 'db' => 'sqlite', - 'database' => realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), + 'database' => \realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), ]); DataMapperAbstract::setConnection($con); diff --git a/tests/Localization/Defaults/CountryMapperTest.php b/tests/Localization/Defaults/CountryMapperTest.php index 13fb6e8cb..ccfc366ad 100644 --- a/tests/Localization/Defaults/CountryMapperTest.php +++ b/tests/Localization/Defaults/CountryMapperTest.php @@ -26,7 +26,7 @@ class CountryMapperTest extends \PHPUnit\Framework\TestCase $con = new SqliteConnection([ 'prefix' => '', 'db' => 'sqlite', - 'database' => realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), + 'database' => \realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), ]); DataMapperAbstract::setConnection($con); diff --git a/tests/Localization/Defaults/CurrencyMapperTest.php b/tests/Localization/Defaults/CurrencyMapperTest.php index 73301c020..09e0419d0 100644 --- a/tests/Localization/Defaults/CurrencyMapperTest.php +++ b/tests/Localization/Defaults/CurrencyMapperTest.php @@ -26,7 +26,7 @@ class CurrencyMapperTest extends \PHPUnit\Framework\TestCase $con = new SqliteConnection([ 'prefix' => '', 'db' => 'sqlite', - 'database' => realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), + 'database' => \realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), ]); DataMapperAbstract::setConnection($con); diff --git a/tests/Localization/Defaults/IbanMapperTest.php b/tests/Localization/Defaults/IbanMapperTest.php index 331827aff..bde0b499c 100644 --- a/tests/Localization/Defaults/IbanMapperTest.php +++ b/tests/Localization/Defaults/IbanMapperTest.php @@ -26,7 +26,7 @@ class IbanMapperTest extends \PHPUnit\Framework\TestCase $con = new SqliteConnection([ 'prefix' => '', 'db' => 'sqlite', - 'database' => realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), + 'database' => \realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), ]); DataMapperAbstract::setConnection($con); diff --git a/tests/Localization/Defaults/LanguageMapperTest.php b/tests/Localization/Defaults/LanguageMapperTest.php index 516d2d979..c3187b798 100644 --- a/tests/Localization/Defaults/LanguageMapperTest.php +++ b/tests/Localization/Defaults/LanguageMapperTest.php @@ -26,7 +26,7 @@ class LanguageMapperTest extends \PHPUnit\Framework\TestCase $con = new SqliteConnection([ 'prefix' => '', 'db' => 'sqlite', - 'database' => realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), + 'database' => \realpath(__DIR__ . '/../../../Localization/Defaults/localization.sqlite'), ]); DataMapperAbstract::setConnection($con); diff --git a/tests/Module/InfoManagerTest.php b/tests/Module/InfoManagerTest.php index 6aa437d6f..c23eb2232 100644 --- a/tests/Module/InfoManagerTest.php +++ b/tests/Module/InfoManagerTest.php @@ -24,7 +24,7 @@ class InfoManagerTest extends \PHPUnit\Framework\TestCase $info = new InfoManager(__DIR__ . '/info-test.json'); $info->load(); - $jarray = \json_decode(file_get_contents(__DIR__ . '/info-test.json'), true); + $jarray = \json_decode(\file_get_contents(__DIR__ . '/info-test.json'), true); self::assertEquals($jarray, $info->get()); self::assertEquals($jarray['name']['id'], $info->getId()); diff --git a/tests/Module/PackageManagerTest.php b/tests/Module/PackageManagerTest.php index 7e0297a9d..09ce29bdc 100644 --- a/tests/Module/PackageManagerTest.php +++ b/tests/Module/PackageManagerTest.php @@ -23,17 +23,17 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase { public static function setUpBeforeClass() : void { - if (file_exists(__DIR__ . '/testPackage.zip')) { + if (\file_exists(__DIR__ . '/testPackage.zip')) { unlink(__DIR__ . '/testPackage.zip'); } - if (file_exists(__DIR__ . '/testPackageExtracted')) { + if (\file_exists(__DIR__ . '/testPackageExtracted')) { \array_map('unlink', \glob(__DIR__ . '/testPackageExtracted/testSubPackage/*')); \rmdir(__DIR__ . '/testPackageExtracted/testSubPackage'); \array_map('unlink', \glob(__DIR__ . '/testPackageExtracted/*')); } - if (file_exists(__DIR__ . '/public.key')) { + if (\file_exists(__DIR__ . '/public.key')) { unlink(__DIR__ . '/public.key'); } @@ -126,24 +126,24 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase $package->extract(__DIR__ . '/testPackageExtracted'); $package->cleanup(); - self::assertFalse(file_exists(__DIR__ . '/testPackage.zip')); - self::assertFalse(file_exists(__DIR__ . '/testPackageExtracted')); + self::assertFalse(\file_exists(__DIR__ . '/testPackage.zip')); + self::assertFalse(\file_exists(__DIR__ . '/testPackageExtracted')); } public static function tearDownAfterClass() : void { - if (file_exists(__DIR__ . '/testPackage.zip')) { + if (\file_exists(__DIR__ . '/testPackage.zip')) { unlink(__DIR__ . '/testPackage.zip'); } - if (file_exists(__DIR__ . '/testPackageExtracted')) { + if (\file_exists(__DIR__ . '/testPackageExtracted')) { \array_map('unlink', \glob(__DIR__ . '/testPackageExtracted/testSubPackage/*')); \rmdir(__DIR__ . '/testPackageExtracted/testSubPackage'); \array_map('unlink', \glob(__DIR__ . '/testPackageExtracted/*')); \rmdir(__DIR__ . '/testPackageExtracted'); } - if (file_exists(__DIR__ . '/public.key')) { + if (\file_exists(__DIR__ . '/public.key')) { unlink(__DIR__ . '/public.key'); } diff --git a/tests/System/File/Ftp/DirectoryTest.php b/tests/System/File/Ftp/DirectoryTest.php index 64f1727b0..48003cf0b 100644 --- a/tests/System/File/Ftp/DirectoryTest.php +++ b/tests/System/File/Ftp/DirectoryTest.php @@ -38,7 +38,7 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase self::assertEquals('test', Directory::name($dirPath)); self::assertEquals('test', Directory::basename($dirPath)); self::assertEquals('test', Directory::dirname($dirPath)); - self::assertEquals(\str_replace('\\', '/', realpath($dirPath . '/../')), Directory::parent($dirPath)); + self::assertEquals(\str_replace('\\', '/', \realpath($dirPath . '/../')), Directory::parent($dirPath)); self::assertEquals($dirPath, Directory::dirpath($dirPath)); $now = new \DateTime('now'); diff --git a/tests/System/File/Ftp/FileTest.php b/tests/System/File/Ftp/FileTest.php index 862cd8cb6..6fded8bf2 100644 --- a/tests/System/File/Ftp/FileTest.php +++ b/tests/System/File/Ftp/FileTest.php @@ -44,7 +44,7 @@ class FileTest extends \PHPUnit\Framework\TestCase self::assertTrue(File::prepend($testFile, 'test5')); self::assertEquals('test5test3test4', File::get($testFile)); - self::assertEquals(\str_replace('\\', '/', realpath(\dirname($testFile) . '/../')), File::parent($testFile)); + self::assertEquals(\str_replace('\\', '/', \realpath(\dirname($testFile) . '/../')), File::parent($testFile)); self::assertEquals('txt', File::extension($testFile)); self::assertEquals('test', File::name($testFile)); self::assertEquals('test.txt', File::basename($testFile)); diff --git a/tests/System/File/Ftp/FtpStorageTest.php b/tests/System/File/Ftp/FtpStorageTest.php index a4f61f77e..b35005114 100644 --- a/tests/System/File/Ftp/FtpStorageTest.php +++ b/tests/System/File/Ftp/FtpStorageTest.php @@ -44,7 +44,7 @@ class FtpStorageTest extends \PHPUnit\Framework\TestCase self::assertTrue(FtpStorage::prepend($testFile, 'test5')); self::assertEquals('test5test3test4', FtpStorage::get($testFile)); - self::assertEquals(\str_replace('\\', '/', realpath(\dirname($testFile) . '/../')), FtpStorage::parent($testFile)); + self::assertEquals(\str_replace('\\', '/', \realpath(\dirname($testFile) . '/../')), FtpStorage::parent($testFile)); self::assertEquals('txt', FtpStorage::extension($testFile)); self::assertEquals('test', FtpStorage::name($testFile)); self::assertEquals('test.txt', FtpStorage::basename($testFile)); @@ -103,7 +103,7 @@ class FtpStorageTest extends \PHPUnit\Framework\TestCase self::assertEquals('test', FtpStorage::name($dirPath)); self::assertEquals('test', FtpStorage::basename($dirPath)); self::assertEquals('test', FtpStorage::dirname($dirPath)); - self::assertEquals(\str_replace('\\', '/', realpath($dirPath . '/../')), FtpStorage::parent($dirPath)); + self::assertEquals(\str_replace('\\', '/', \realpath($dirPath . '/../')), FtpStorage::parent($dirPath)); self::assertEquals($dirPath, FtpStorage::dirpath($dirPath)); $now = new \DateTime('now'); diff --git a/tests/System/File/Local/DirectoryTest.php b/tests/System/File/Local/DirectoryTest.php index 114408317..9ca64d80a 100644 --- a/tests/System/File/Local/DirectoryTest.php +++ b/tests/System/File/Local/DirectoryTest.php @@ -30,7 +30,7 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase self::assertEquals('test', Directory::name($dirPath)); self::assertEquals('test', Directory::basename($dirPath)); self::assertEquals('test', Directory::dirname($dirPath)); - self::assertEquals(\str_replace('\\', '/', realpath($dirPath . '/../')), Directory::parent($dirPath)); + self::assertEquals(\str_replace('\\', '/', \realpath($dirPath . '/../')), Directory::parent($dirPath)); self::assertEquals($dirPath, Directory::dirpath($dirPath)); $now = new \DateTime('now'); diff --git a/tests/System/File/Local/FileTest.php b/tests/System/File/Local/FileTest.php index 0e68e5b7b..b39d928cd 100644 --- a/tests/System/File/Local/FileTest.php +++ b/tests/System/File/Local/FileTest.php @@ -36,7 +36,7 @@ class FileTest extends \PHPUnit\Framework\TestCase self::assertTrue(File::prepend($testFile, 'test5')); self::assertEquals('test5test3test4', File::get($testFile)); - self::assertEquals(\str_replace('\\', '/', realpath(\dirname($testFile) . '/../')), File::parent($testFile)); + self::assertEquals(\str_replace('\\', '/', \realpath(\dirname($testFile) . '/../')), File::parent($testFile)); self::assertEquals('txt', File::extension($testFile)); self::assertEquals('test', File::name($testFile)); self::assertEquals('test.txt', File::basename($testFile)); diff --git a/tests/System/File/Local/LocalStorageTest.php b/tests/System/File/Local/LocalStorageTest.php index 5841c1876..06da99ccc 100644 --- a/tests/System/File/Local/LocalStorageTest.php +++ b/tests/System/File/Local/LocalStorageTest.php @@ -36,7 +36,7 @@ class LocalStorageTest extends \PHPUnit\Framework\TestCase self::assertTrue(LocalStorage::prepend($testFile, 'test5')); self::assertEquals('test5test3test4', LocalStorage::get($testFile)); - self::assertEquals(\str_replace('\\', '/', realpath(\dirname($testFile) . '/../')), LocalStorage::parent($testFile)); + self::assertEquals(\str_replace('\\', '/', \realpath(\dirname($testFile) . '/../')), LocalStorage::parent($testFile)); self::assertEquals('txt', LocalStorage::extension($testFile)); self::assertEquals('test', LocalStorage::name($testFile)); self::assertEquals('test.txt', LocalStorage::basename($testFile)); @@ -91,7 +91,7 @@ class LocalStorageTest extends \PHPUnit\Framework\TestCase self::assertEquals('test', LocalStorage::name($dirPath)); self::assertEquals('test', LocalStorage::basename($dirPath)); self::assertEquals('test', LocalStorage::dirname($dirPath)); - self::assertEquals(\str_replace('\\', '/', realpath($dirPath . '/../')), LocalStorage::parent($dirPath)); + self::assertEquals(\str_replace('\\', '/', \realpath($dirPath . '/../')), LocalStorage::parent($dirPath)); self::assertEquals($dirPath, LocalStorage::dirpath($dirPath)); $now = new \DateTime('now'); diff --git a/tests/Utils/Git/RepositoryTest.php b/tests/Utils/Git/RepositoryTest.php index bbc02248e..8b80963dd 100644 --- a/tests/Utils/Git/RepositoryTest.php +++ b/tests/Utils/Git/RepositoryTest.php @@ -21,7 +21,7 @@ class RepositoryTest extends \PHPUnit\Framework\TestCase { $repo = new Repository(\realpath(__DIR__ . '/../../../')); self::assertTrue('phpOMS' === $repo->getName() || 'build' === $repo->getName()); - self::assertEquals(\str_replace('\\', '/', realpath(__DIR__ . '/../../../.git')), \str_replace('\\', '/', $repo->getDirectoryPath())); + self::assertEquals(\str_replace('\\', '/', \realpath(__DIR__ . '/../../../.git')), \str_replace('\\', '/', $repo->getDirectoryPath())); self::assertEquals(\realpath(__DIR__ . '/../../../'), $repo->getPath()); } } diff --git a/tests/Utils/Parser/Markdown/MarkdownTest.php b/tests/Utils/Parser/Markdown/MarkdownTest.php index bafefbf49..b98eec906 100644 --- a/tests/Utils/Parser/Markdown/MarkdownTest.php +++ b/tests/Utils/Parser/Markdown/MarkdownTest.php @@ -28,7 +28,7 @@ class MarkdownTest extends \PHPUnit\Framework\TestCase if ($data[1] === 'md') { self::assertEquals( \file_get_contents(__DIR__ . '/data/' . $data[0] . '.html'), - Markdown::parse(file_get_contents(__DIR__ . '/data/' . $data[0] . '.md')), + Markdown::parse(\file_get_contents(__DIR__ . '/data/' . $data[0] . '.md')), $file ); } diff --git a/tests/Validation/Base/JsonTest.php b/tests/Validation/Base/JsonTest.php index a92221182..eea24c08c 100644 --- a/tests/Validation/Base/JsonTest.php +++ b/tests/Validation/Base/JsonTest.php @@ -19,20 +19,20 @@ class JsonTest extends \PHPUnit\Framework\TestCase { public function testJson() : void { - $template = \json_decode(file_get_contents(__DIR__ . '/json/template.json'), true); + $template = \json_decode(\file_get_contents(__DIR__ . '/json/template.json'), true); - $valid = \json_decode(file_get_contents(__DIR__ . '/json/valid.json'), true); + $valid = \json_decode(\file_get_contents(__DIR__ . '/json/valid.json'), true); self::assertTrue(Json::validateTemplate($template, $valid)); self::assertTrue(Json::validateTemplate($template, $valid, true)); - $additional = \json_decode(file_get_contents(__DIR__ . '/json/additional.json'), true); + $additional = \json_decode(\file_get_contents(__DIR__ . '/json/additional.json'), true); self::assertTrue(Json::validateTemplate($template, $additional)); self::assertFalse(Json::validateTemplate($template, $additional, true)); - $incomplete = \json_decode(file_get_contents(__DIR__ . '/json/incomplete.json'), true); + $incomplete = \json_decode(\file_get_contents(__DIR__ . '/json/incomplete.json'), true); self::assertFalse(Json::validateTemplate($template, $incomplete)); - $invalid = \json_decode(file_get_contents(__DIR__ . '/json/invalid.json'), true); + $invalid = \json_decode(\file_get_contents(__DIR__ . '/json/invalid.json'), true); self::assertFalse(Json::validateTemplate($template, $invalid)); } }