From ab2f39b4ce7f9984579bce5826555d042cb35450 Mon Sep 17 00:00:00 2001 From: kristijorgji Date: Wed, 18 Apr 2018 16:32:27 +0000 Subject: [PATCH 1/6] working on allowing entities to track changes, error if selected table does not exist. First step toward incremental data mapping orm --- dbToPhp.cfg.php | 3 +- src/Console/Commands/AbstractCommand.php | 4 +- src/Data/AbstractEntity.php | 94 ++++++++++++++++ .../Php/Configs/PhpEntityGeneratorConfig.php | 18 ++- .../Php/Configs/PhpSetterGeneratorConfig.php | 1 - src/Generators/Php/PhpEntityGenerator.php | 11 +- src/Generators/Php/PhpSetterGenerator.php | 18 ++- .../Exceptions/TableDoesNotExistException.php | 30 +++++ src/Managers/Php/AbstractPhpManager.php | 32 +++++- src/Managers/Php/PhpEntityManager.php | 31 +++++- src/helpers.php | 12 ++ tests/integration/MySql/Php/config.php | 3 +- tests/unit/Data/AbstractEntityTest.php | 28 +++++ tests/unit/Data/TestPseudoModelEntity.php | 104 ++++++++++++++++++ .../Generators/Php/PhpEntityGeneratorTest.php | 32 +++++- .../Php/expected/entity_generator.txt | 104 ++++++++++++++++++ tests/unit/HelpersTest.php | 34 ++++++ .../Managers/Php/AbstractPhpManagerTest.php | 35 +++++- .../Managers/Php/PhpEntityManagerTest.php | 5 +- 19 files changed, 571 insertions(+), 28 deletions(-) create mode 100644 src/Data/AbstractEntity.php create mode 100644 src/Managers/Exceptions/TableDoesNotExistException.php create mode 100644 tests/unit/Data/AbstractEntityTest.php create mode 100644 tests/unit/Data/TestPseudoModelEntity.php diff --git a/dbToPhp.cfg.php b/dbToPhp.cfg.php index 8998bc1..e31706c 100644 --- a/dbToPhp.cfg.php +++ b/dbToPhp.cfg.php @@ -23,7 +23,8 @@ 'fluentSetters' => true, 'properties' => [ 'accessModifier' => \kristijorgji\DbToPhp\Rules\Php\PhpAccessModifiers::PRIVATE - ] + ], + 'trackChangesFor' => [] ], 'factories' => [ 'includeTables' => ['*'], diff --git a/src/Console/Commands/AbstractCommand.php b/src/Console/Commands/AbstractCommand.php index 87fde3e..b0749a6 100644 --- a/src/Console/Commands/AbstractCommand.php +++ b/src/Console/Commands/AbstractCommand.php @@ -8,7 +8,6 @@ use kristijorgji\DbToPhp\Managers\GenerateResponse; use kristijorgji\DbToPhp\Managers\ManagerContract; use kristijorgji\DbToPhp\Managers\ManagerFactory; -use kristijorgji\DbToPhp\Mappers\Types\Php\PhpTypeMapperFactory; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -98,8 +97,7 @@ protected function getConfig() : ?array protected function loadManager() : ManagerContract { return (new ManagerFactory( - new DatabaseAdapterFactory(), - new PhpTypeMapperFactory() + new DatabaseAdapterFactory() ))->get($this->getConfig()); } diff --git a/src/Data/AbstractEntity.php b/src/Data/AbstractEntity.php new file mode 100644 index 0000000..7a9ac63 --- /dev/null +++ b/src/Data/AbstractEntity.php @@ -0,0 +1,94 @@ +original)) { + $this->original[$key] = $value; + } + + $this->attributes[$key] = $value; + } + + /** + * @param string $key + * @return mixed + */ + protected function get(string $key) + { + return $this->attributes[$key]; + } + + /** + * @return bool + */ + public function isDirty() : bool + { + if (count($this->original) < count($this->attributes)) { + return true; + } + + foreach ($this->original as $key => $value) { + if ($this->attributes[$key] !== $value) { + return true; + } + } + + return false; + } + + /** + * @return array + */ + public function getDirty() : array + { + $dirty = []; + + foreach ($this->original as $property => $originalValue) { + $currentValue = $this->attributes[$property]; + + if ($currentValue !== $originalValue) { + $dirty[camelToSnakeCase($property)] = $currentValue; + } + } + + return $dirty; + } + + public function completeBuild() + { + + } + + /** + * @return void + */ + public function reset() + { + $this->original = []; + } +} diff --git a/src/Generators/Php/Configs/PhpEntityGeneratorConfig.php b/src/Generators/Php/Configs/PhpEntityGeneratorConfig.php index d06d9ec..7dadf4a 100644 --- a/src/Generators/Php/Configs/PhpEntityGeneratorConfig.php +++ b/src/Generators/Php/Configs/PhpEntityGeneratorConfig.php @@ -34,6 +34,11 @@ class PhpEntityGeneratorConfig */ private $phpPropertyGeneratorConfig; + /** + * @var bool + */ + private $shouldTrackChanges; + /** * @param PhpClassGeneratorConfig $phpClassGeneratorConfig * @param bool $includeSetters @@ -41,6 +46,7 @@ class PhpEntityGeneratorConfig * @param PhpSetterGeneratorConfig $phpSetterGeneratorConfig * @param PhpGetterGeneratorConfig $phpGetterGeneratorConfig * @param PhpPropertyGeneratorConfig $phpPropertyGeneratorConfig + * @param bool $shouldTrackChanges */ public function __construct( PhpClassGeneratorConfig $phpClassGeneratorConfig, @@ -48,7 +54,8 @@ public function __construct( bool $includeGetters, PhpSetterGeneratorConfig $phpSetterGeneratorConfig, PhpGetterGeneratorConfig $phpGetterGeneratorConfig, - PhpPropertyGeneratorConfig $phpPropertyGeneratorConfig + PhpPropertyGeneratorConfig $phpPropertyGeneratorConfig, + bool $shouldTrackChanges ) { $this->phpClassGeneratorConfig = $phpClassGeneratorConfig; $this->includeSetters = $includeSetters; @@ -56,6 +63,7 @@ public function __construct( $this->phpSetterGeneratorConfig = $phpSetterGeneratorConfig; $this->phpGetterGeneratorConfig = $phpGetterGeneratorConfig; $this->phpPropertyGeneratorConfig = $phpPropertyGeneratorConfig; + $this->shouldTrackChanges = $shouldTrackChanges; } /** @@ -105,4 +113,12 @@ public function getPhpPropertyGeneratorConfig(): PhpPropertyGeneratorConfig { return $this->phpPropertyGeneratorConfig; } + + /** + * @return bool + */ + public function shouldTrackChanges() : bool + { + return $this->shouldTrackChanges; + } } diff --git a/src/Generators/Php/Configs/PhpSetterGeneratorConfig.php b/src/Generators/Php/Configs/PhpSetterGeneratorConfig.php index 851cac4..06397c7 100644 --- a/src/Generators/Php/Configs/PhpSetterGeneratorConfig.php +++ b/src/Generators/Php/Configs/PhpSetterGeneratorConfig.php @@ -20,7 +20,6 @@ class PhpSetterGeneratorConfig private $isFluent; /** - * PhpSetterGeneratorConfig constructor. * @param bool $includeAnnotations * @param bool $typeHint * @param bool $isFluent diff --git a/src/Generators/Php/PhpEntityGenerator.php b/src/Generators/Php/PhpEntityGenerator.php index 45e6aeb..29fbb91 100644 --- a/src/Generators/Php/PhpEntityGenerator.php +++ b/src/Generators/Php/PhpEntityGenerator.php @@ -5,7 +5,6 @@ use kristijorgji\DbToPhp\Generators\Php\Configs\PhpEntityGeneratorConfig; use kristijorgji\DbToPhp\Rules\Php\PhpPropertiesCollection; use kristijorgji\DbToPhp\Rules\Php\PhpProperty; -use kristijorgji\DbToPhp\Support\TextBuffer; class PhpEntityGenerator extends PhpClassGenerator { @@ -95,8 +94,16 @@ private function addSettersAndGetters() */ private function addSetter(PhpProperty $property) { + $extraLines = []; + if ($this->config->shouldTrackChanges()) { + $extraLines[] = '$this->set(\'[%propertyName%]\', $[%propertyName%]);'; + } $this->output->addLine( - (new PhpSetterGenerator($property, $this->config->getPhpSetterGeneratorConfig()))->generate() + (new PhpSetterGenerator( + $property, + $this->config->getPhpSetterGeneratorConfig(), + $extraLines + ))->generate() ); } diff --git a/src/Generators/Php/PhpSetterGenerator.php b/src/Generators/Php/PhpSetterGenerator.php index b2e060f..a27e070 100644 --- a/src/Generators/Php/PhpSetterGenerator.php +++ b/src/Generators/Php/PhpSetterGenerator.php @@ -23,15 +23,22 @@ class PhpSetterGenerator */ private $output; + /** + * @var array + */ + private $extraLines; + /** * @param PhpProperty $property * @param PhpSetterGeneratorConfig $config + * @param array $extraLines */ - public function __construct(PhpProperty $property, PhpSetterGeneratorConfig $config) + public function __construct(PhpProperty $property, PhpSetterGeneratorConfig $config, array $extraLines = []) { $this->property = $property; $this->config = $config; $this->output = new TextBuffer(); + $this->extraLines = $extraLines; } public function generate() : string @@ -95,9 +102,18 @@ private function addBody() sprintf('$this->%s = $%s;', $this->property->getName(), $this->property->getName()), 8 ); + + foreach ($this->extraLines as $extraLine) { + $this->output->addLine( + str_replace('[%propertyName%]', $this->property->getName(), $extraLine), + 8 + ); + } + if ($this->config->isFluent()) { $this->output->addLine('return $this;', 8); } + $this->output->add('}', 4); } } diff --git a/src/Managers/Exceptions/TableDoesNotExistException.php b/src/Managers/Exceptions/TableDoesNotExistException.php new file mode 100644 index 0000000..05319dc --- /dev/null +++ b/src/Managers/Exceptions/TableDoesNotExistException.php @@ -0,0 +1,30 @@ +tableName = $tableName; + } + + /** + * @return string + */ + public function getTableName(): string + { + return $this->tableName; + } +} diff --git a/src/Managers/Php/AbstractPhpManager.php b/src/Managers/Php/AbstractPhpManager.php index c371f01..aa7378a 100644 --- a/src/Managers/Php/AbstractPhpManager.php +++ b/src/Managers/Php/AbstractPhpManager.php @@ -5,6 +5,7 @@ use kristijorgji\DbToPhp\Db\Adapters\DatabaseAdapterInterface; use kristijorgji\DbToPhp\Db\TablesCollection; use kristijorgji\DbToPhp\FileSystem\FileSystemInterface; +use kristijorgji\DbToPhp\Managers\Exceptions\TableDoesNotExistException; use kristijorgji\DbToPhp\Mappers\Types\Php\PhpTypeMapperInterface; class AbstractPhpManager @@ -59,23 +60,42 @@ public function stripClassName(string $qualifiedClassName) : string /** * @param TablesCollection $tables - * @param array $filter + * @param string[] $selectedTableNames * @return TablesCollection + * @throws TableDoesNotExistException */ - public function filterTables(TablesCollection $tables, array $filter) : TablesCollection + public function filterTables(TablesCollection $tables, array $selectedTableNames) : TablesCollection { - if ($filter[0] === '*') { + if ($selectedTableNames[0] === '*') { return $tables; } + $tablesMap = $this->formTablesMap($tables); $selectedTables = []; - foreach ($tables->all() as $table) { - if (in_array($table->getName(), $filter)) { - $selectedTables[] = $table; + foreach ($selectedTableNames as $selectedTableName) { + if (! array_key_exists($selectedTableName, $tablesMap)) { + throw new TableDoesNotExistException($selectedTableName); } + + $selectedTables[] = $tablesMap[$selectedTableName]; } return new TablesCollection(...$selectedTables); } + + /** + * @param TablesCollection $tablesCollection + * @return array + */ + protected function formTablesMap(TablesCollection $tablesCollection) : array + { + $tablesMap = []; + + foreach ($tablesCollection->all() as $table) { + $tablesMap[$table->getName()] = $table; + } + + return $tablesMap; + } } diff --git a/src/Managers/Php/PhpEntityManager.php b/src/Managers/Php/PhpEntityManager.php index 5983a88..e9f0701 100644 --- a/src/Managers/Php/PhpEntityManager.php +++ b/src/Managers/Php/PhpEntityManager.php @@ -2,6 +2,7 @@ namespace kristijorgji\DbToPhp\Managers\Php; +use kristijorgji\DbToPhp\Data\AbstractEntity; use kristijorgji\DbToPhp\Db\Adapters\DatabaseAdapterInterface; use kristijorgji\DbToPhp\Db\Fields\Field; use kristijorgji\DbToPhp\Db\Fields\FieldsCollection; @@ -80,12 +81,21 @@ public function generateEntity(string $tableName) : string $fields = $this->databaseAdapter->getFields($tableName); $properties = $this->formProperties($fields); + $shouldTrackChanges = $this->shouldTrackChanges($tableName); + $extends = null; + $uses = []; + + if ($shouldTrackChanges) { + $extends = $this->stripClassName(AbstractEntity::class); + $uses[] = AbstractEntity::class; + } + $entityGeneratorConfig = new PhpEntityGeneratorConfig( new PhpClassGeneratorConfig( $this->config['namespace'], $className, - new StringCollection(... []), - null, + new StringCollection(... $uses), + $extends, $this->config['includeAnnotations'] ), $this->config['includeSetters'], @@ -101,7 +111,8 @@ public function generateEntity(string $tableName) : string ), new PhpPropertyGeneratorConfig( $this->config['includeAnnotations'] - ) + ), + $shouldTrackChanges ); $entityGenerator = new PhpEntityGenerator( @@ -126,6 +137,20 @@ public function generateEntity(string $tableName) : string return $outputPath; } + /** + * @param string $tableName + * @return bool + */ + protected function shouldTrackChanges(string $tableName) : bool + { + return $this->config['trackChangesFor'] === '*' + || ( + array_key_exists(0, $this->config['trackChangesFor']) + && $this->config['trackChangesFor'][0] === '*' + ) + || array_key_exists($tableName, $this->config['trackChangesFor']); + } + /** * @param FieldsCollection $fields * @return PhpPropertiesCollection diff --git a/src/helpers.php b/src/helpers.php index 6cf8972..40107fd 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -29,6 +29,18 @@ function snakeToPascalCase(string $input) : string } } +if (!function_exists('camelToSnakeCase')) { + + /** + * @param string $input + * @return string + */ + function camelToSnakeCase(string $input) : string + { + return strtolower(preg_replace('/(? true, 'properties' => [ 'accessModifier' => \kristijorgji\DbToPhp\Rules\Php\PhpAccessModifiers::PRIVATE - ] + ], + 'trackChangesFor' => [] ], 'factories' => [ 'includeTables' => ['*'], diff --git a/tests/unit/Data/AbstractEntityTest.php b/tests/unit/Data/AbstractEntityTest.php new file mode 100644 index 0000000..2378da4 --- /dev/null +++ b/tests/unit/Data/AbstractEntityTest.php @@ -0,0 +1,28 @@ +assertFalse($testEntity->isDirty()); + $this->assertEmpty($testEntity->getDirty()); + + $testEntity->setId(3); + $testEntity->setIsWorking(true); + $this->assertTrue($testEntity->isDirty()); + $this->assertEquals( + [ + 'id' => 3, + 'is_working' => true + ], + $testEntity->getDirty() + ); + } +} diff --git a/tests/unit/Data/TestPseudoModelEntity.php b/tests/unit/Data/TestPseudoModelEntity.php new file mode 100644 index 0000000..cc77500 --- /dev/null +++ b/tests/unit/Data/TestPseudoModelEntity.php @@ -0,0 +1,104 @@ +id = $id; + $this->set('id', $id); + return $this; + } + + /** + * @return int + */ + public function getId() : int + { + return $this->id; + } + + /** + * @param string|null $name + * @return $this + */ + public function setName(?string $name) + { + $this->name = $name; + $this->set('name', $name); + return $this; + } + + /** + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + + /** + * @param string|null $surname + * @return $this + */ + public function setSurname(?string $surname) + { + $this->surname = $surname; + $this->set('surname', $surname); + return $this; + } + + /** + * @return string|null + */ + public function getSurname() : ?string + { + return $this->surname; + } + + /** + * @param bool $isWorking + * @return $this + */ + public function setIsWorking(bool $isWorking) + { + $this->isWorking = $isWorking; + $this->set('isWorking', $isWorking); + return $this; + } + + /** + * @return bool + */ + public function getIsWorking() : bool + { + return $this->isWorking; + } +} diff --git a/tests/unit/Generators/Php/PhpEntityGeneratorTest.php b/tests/unit/Generators/Php/PhpEntityGeneratorTest.php index 7ab81f4..c9d740d 100644 --- a/tests/unit/Generators/Php/PhpEntityGeneratorTest.php +++ b/tests/unit/Generators/Php/PhpEntityGeneratorTest.php @@ -52,7 +52,8 @@ public function generateProvider() new PhpPropertyGeneratorConfig( true, new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) - ) + ), + false ), $expected['no_setters_no_getters'] ], @@ -66,7 +67,8 @@ public function generateProvider() new PhpPropertyGeneratorConfig( true, new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) - ) + ), + false ), $expected['with_getters_and_setters'] ], @@ -80,7 +82,8 @@ public function generateProvider() new PhpPropertyGeneratorConfig( true, new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) - ) + ), + false ), $expected['only_getters'] ], @@ -94,9 +97,30 @@ public function generateProvider() new PhpPropertyGeneratorConfig( true, new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) - ) + ), + false ), $expected['only_setters'] + ], + 'track_changes' => [ + new PhpEntityGeneratorConfig( + new PhpClassGeneratorConfig( + 'MyApp\Entities', + 'TestEntity', + new StringCollection(...[]), + null + ), + true, + true, + new PhpSetterGeneratorConfig(true, true, true), + new PhpGetterGeneratorConfig(true, true), + new PhpPropertyGeneratorConfig( + true, + new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) + ), + true + ), + $expected['track_changes_no_properties'] ] ]; } diff --git a/tests/unit/Generators/Php/expected/entity_generator.txt b/tests/unit/Generators/Php/expected/entity_generator.txt index adea8b5..d4ffcab 100644 --- a/tests/unit/Generators/Php/expected/entity_generator.txt +++ b/tests/unit/Generators/Php/expected/entity_generator.txt @@ -254,3 +254,107 @@ class TestEntity } } +##[track_changes_no_properties]## +salary = $salary; + $this->set('salary', $salary); + return $this; + } + + /** + * @return float|null + */ + public function getSalary() : ?float + { + return $this->salary; + } + + /** + * @param bool $active + * @return $this + */ + public function setActive(bool $active) + { + $this->active = $active; + $this->set('active', $active); + return $this; + } + + /** + * @return bool + */ + public function getActive() : bool + { + return $this->active; + } + + /** + * @param string|null $name + * @return $this + */ + public function setName(?string $name) + { + $this->name = $name; + $this->set('name', $name); + return $this; + } + + /** + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + + /** + * @param int|null $year + * @return $this + */ + public function setYear(?int $year) + { + $this->year = $year; + $this->set('year', $year); + return $this; + } + + /** + * @return int|null + */ + public function getYear() : ?int + { + return $this->year; + } +} + diff --git a/tests/unit/HelpersTest.php b/tests/unit/HelpersTest.php index 519ce2f..b24e1d9 100644 --- a/tests/unit/HelpersTest.php +++ b/tests/unit/HelpersTest.php @@ -13,4 +13,38 @@ public function testGetBasePath() preg_match('#\/src\/\.\.\/$#', $actual) == true ); } + + /** + * @dataProvider camelToSnakeCaseProvider + * @param string $input + * @param string $expected + */ + public function testCamelToSnakeCase( + string $input, + string $expected + ) + { + $this->assertEquals( + $expected, + camelToSnakeCase($input) + ); + } + + public function camelToSnakeCaseProvider() + { + return [ + [ + 'iAmCamelCase', + 'i_am_camel_case' + ], + [ + 'allUsers', + 'all_users' + ], + [ + 'AAA', + 'a_a_a' + ] + ]; + } } diff --git a/tests/unit/Managers/Php/AbstractPhpManagerTest.php b/tests/unit/Managers/Php/AbstractPhpManagerTest.php index 345e412..b0e5729 100644 --- a/tests/unit/Managers/Php/AbstractPhpManagerTest.php +++ b/tests/unit/Managers/Php/AbstractPhpManagerTest.php @@ -3,6 +3,7 @@ namespace kristijorgji\UnitTests\Managers\Php; use kristijorgji\DbToPhp\Db\TablesCollection; +use kristijorgji\DbToPhp\Managers\Exceptions\TableDoesNotExistException; use kristijorgji\DbToPhp\Managers\Php\AbstractPhpManager; use kristijorgji\Tests\Factories\Db\TablesCollectionFactory; @@ -56,15 +57,41 @@ public function testFilterTables_only_some() $this->createManager(); - $filterTablesMethod = $this->getPrivateMethod($this->manager, 'filterTables'); - $filteredTables = $filterTablesMethod->invokeArgs($this->manager, [ + $actualFilteredTables = $this->manager->filterTables( $tables, $this->config['entities']['includeTables'] - ]); + ); $expectedTables = new TablesCollection(... $expectedTables); - $this->assertEquals($expectedTables, $filteredTables); + $this->assertEquals($expectedTables, $actualFilteredTables); + } + + public function testFilterTables_non_existing() + { + $nrTotalTables = 2; + $tables = TablesCollectionFactory::make($nrTotalTables); + + $nonExistingTable = self::randomString() . microtime(true); + $this->config['entities']['includeTables'] = [ + $tables->getAt(0)->getName(), + $nonExistingTable + ]; + + $this->createManager(); + + $thrownException = null; + try { + $this->manager->filterTables( + $tables, + $this->config['entities']['includeTables'] + ); + } catch (\Exception $e) { + $thrownException = $e; + } + + $this->assertTrue($thrownException instanceof TableDoesNotExistException); + $this->assertEquals($nonExistingTable, $thrownException->getTableName()); } private function createManager() diff --git a/tests/unit/Managers/Php/PhpEntityManagerTest.php b/tests/unit/Managers/Php/PhpEntityManagerTest.php index b3df21b..f5a83a0 100644 --- a/tests/unit/Managers/Php/PhpEntityManagerTest.php +++ b/tests/unit/Managers/Php/PhpEntityManagerTest.php @@ -130,7 +130,10 @@ public function testGenerateEntity() $this->fileSystem->expects($this->once()) ->method('write') - ->with($this->config['outputDirectory'] . '/TestTableEntity.php', $this->anything()); + ->with( + $this->config['outputDirectory'] . '/TestTableEntity.php', + $this->anything() + ); $this->manager->generateEntity($tableName); } From 8eb9d46eec8b9e5dbf83836a2ffd58ae76688f87 Mon Sep 17 00:00:00 2001 From: kristijorgji Date: Thu, 19 Apr 2018 14:47:17 +0000 Subject: [PATCH 2/6] refactor pseudomodel entity and tests --- src/Data/AbstractEntity.php | 61 +++------ src/Generators/Php/PhpEntityGenerator.php | 2 +- src/Managers/Php/PhpEntityManager.php | 57 ++++---- tests/unit/Data/AbstractEntityTest.php | 26 +++- tests/unit/Data/TestPseudoModelEntity.php | 8 +- .../Php/expected/entity_generator.txt | 8 +- .../Managers/Php/PhpEntityManagerTest.php | 125 ++++++++++++++++++ 7 files changed, 206 insertions(+), 81 deletions(-) diff --git a/src/Data/AbstractEntity.php b/src/Data/AbstractEntity.php index 7a9ac63..e24c9ab 100644 --- a/src/Data/AbstractEntity.php +++ b/src/Data/AbstractEntity.php @@ -2,45 +2,27 @@ namespace kristijorgji\DbToPhp\Data; -// TODO - abstract class AbstractEntity { /** * @var array */ - protected $attributes = []; - - /** - * @var array - */ - protected $original = []; - - /** - * @var bool - */ - protected $booted = false; + private $__original = []; - /** - * @param string $key - * @param $value - */ - protected function set(string $key, $value) + public function __construct() { - if (! array_key_exists($key, $this->original)) { - $this->original[$key] = $value; - } - - $this->attributes[$key] = $value; + $this->sync(); } /** * @param string $key - * @return mixed + * @param $value */ - protected function get(string $key) + protected function track(string $key, $value) { - return $this->attributes[$key]; + if (! array_key_exists($key, $this->__original)) { + $this->__original[$key] = $value; + } } /** @@ -48,12 +30,8 @@ protected function get(string $key) */ public function isDirty() : bool { - if (count($this->original) < count($this->attributes)) { - return true; - } - - foreach ($this->original as $key => $value) { - if ($this->attributes[$key] !== $value) { + foreach ($this->__original as $key => $value) { + if ($this->{$key} !== $value) { return true; } } @@ -64,12 +42,12 @@ public function isDirty() : bool /** * @return array */ - public function getDirty() : array + public function dirtyFields() : array { $dirty = []; - foreach ($this->original as $property => $originalValue) { - $currentValue = $this->attributes[$property]; + foreach ($this->__original as $property => $originalValue) { + $currentValue = $this->{$property}; if ($currentValue !== $originalValue) { $dirty[camelToSnakeCase($property)] = $currentValue; @@ -79,16 +57,15 @@ public function getDirty() : array return $dirty; } - public function completeBuild() - { - - } - /** * @return void */ - public function reset() + public function sync() { - $this->original = []; + foreach ($this as $key => $value) { + if ($key !== '__original') { + $this->__original[$key] = $value; + } + } } } diff --git a/src/Generators/Php/PhpEntityGenerator.php b/src/Generators/Php/PhpEntityGenerator.php index 29fbb91..df05be0 100644 --- a/src/Generators/Php/PhpEntityGenerator.php +++ b/src/Generators/Php/PhpEntityGenerator.php @@ -96,7 +96,7 @@ private function addSetter(PhpProperty $property) { $extraLines = []; if ($this->config->shouldTrackChanges()) { - $extraLines[] = '$this->set(\'[%propertyName%]\', $[%propertyName%]);'; + $extraLines[] = '$this->track(\'[%propertyName%]\', $[%propertyName%]);'; } $this->output->addLine( (new PhpSetterGenerator( diff --git a/src/Managers/Php/PhpEntityManager.php b/src/Managers/Php/PhpEntityManager.php index e9f0701..339493d 100644 --- a/src/Managers/Php/PhpEntityManager.php +++ b/src/Managers/Php/PhpEntityManager.php @@ -77,10 +77,40 @@ public function generateEntities() : GenerateResponse */ public function generateEntity(string $tableName) : string { - $className = $this->formClassName($tableName); $fields = $this->databaseAdapter->getFields($tableName); $properties = $this->formProperties($fields); + $entityGeneratorConfig = $this->parseConfigForEntity($tableName); + + $entityGenerator = new PhpEntityGenerator( + $entityGeneratorConfig, + $properties + ); + + $entityFileAsString = $entityGenerator->generate(); + $entityFileName = $entityGeneratorConfig->getPhpClassGeneratorConfig()->getClassName() . '.php'; + + if (!$this->fileSystem->exists($this->config['outputDirectory'])) { + $this->fileSystem->createDirectory($this->config['outputDirectory'], true); + } + + $outputPath = $this->config['outputDirectory'] . '/' . $entityFileName; + + $this->fileSystem->write( + $outputPath, + $entityFileAsString + ); + + return $outputPath; + } + + /** + * @param string $tableName + * @return PhpEntityGeneratorConfig + */ + protected function parseConfigForEntity(string $tableName) : PhpEntityGeneratorConfig + { + $className = $this->formClassName($tableName); $shouldTrackChanges = $this->shouldTrackChanges($tableName); $extends = null; $uses = []; @@ -90,7 +120,7 @@ public function generateEntity(string $tableName) : string $uses[] = AbstractEntity::class; } - $entityGeneratorConfig = new PhpEntityGeneratorConfig( + return new PhpEntityGeneratorConfig( new PhpClassGeneratorConfig( $this->config['namespace'], $className, @@ -114,27 +144,6 @@ public function generateEntity(string $tableName) : string ), $shouldTrackChanges ); - - $entityGenerator = new PhpEntityGenerator( - $entityGeneratorConfig, - $properties - ); - - $entityFileAsString = $entityGenerator->generate(); - $entityFileName = $className . '.php'; - - if (!$this->fileSystem->exists($this->config['outputDirectory'])) { - $this->fileSystem->createDirectory($this->config['outputDirectory'], true); - } - - $outputPath = $this->config['outputDirectory'] . '/' . $entityFileName; - - $this->fileSystem->write( - $outputPath, - $entityFileAsString - ); - - return $outputPath; } /** @@ -148,7 +157,7 @@ protected function shouldTrackChanges(string $tableName) : bool array_key_exists(0, $this->config['trackChangesFor']) && $this->config['trackChangesFor'][0] === '*' ) - || array_key_exists($tableName, $this->config['trackChangesFor']); + || in_array($tableName, $this->config['trackChangesFor']); } /** diff --git a/tests/unit/Data/AbstractEntityTest.php b/tests/unit/Data/AbstractEntityTest.php index 2378da4..bd315db 100644 --- a/tests/unit/Data/AbstractEntityTest.php +++ b/tests/unit/Data/AbstractEntityTest.php @@ -6,23 +6,37 @@ class AbstractEntityTest extends TestCase { - public function testGetDirty() + public function testAll() { - // TODO - $testEntity = new TestPseudoModelEntity(); $this->assertFalse($testEntity->isDirty()); - $this->assertEmpty($testEntity->getDirty()); + $this->assertEmpty($testEntity->dirtyFields()); $testEntity->setId(3); + $testEntity->setId(4); $testEntity->setIsWorking(true); $this->assertTrue($testEntity->isDirty()); $this->assertEquals( [ - 'id' => 3, + 'id' => 4, 'is_working' => true ], - $testEntity->getDirty() + $testEntity->dirtyFields() + ); + + $testEntity->sync(); + $this->assertFalse($testEntity->isDirty()); + $this->assertEmpty($testEntity->dirtyFields()); + + $testEntity->setIsWorking(false); + $testEntity->setSurname('Jorgji'); + $this->assertTrue($testEntity->isDirty()); + $this->assertEquals( + [ + 'is_working' => false, + 'surname' => 'Jorgji' + ], + $testEntity->dirtyFields() ); } } diff --git a/tests/unit/Data/TestPseudoModelEntity.php b/tests/unit/Data/TestPseudoModelEntity.php index cc77500..2b79003 100644 --- a/tests/unit/Data/TestPseudoModelEntity.php +++ b/tests/unit/Data/TestPseudoModelEntity.php @@ -33,7 +33,7 @@ class TestPseudoModelEntity extends AbstractEntity public function setId(int $id) { $this->id = $id; - $this->set('id', $id); + $this->track('id', $id); return $this; } @@ -52,7 +52,7 @@ public function getId() : int public function setName(?string $name) { $this->name = $name; - $this->set('name', $name); + $this->track('name', $name); return $this; } @@ -71,7 +71,7 @@ public function getName() : ?string public function setSurname(?string $surname) { $this->surname = $surname; - $this->set('surname', $surname); + $this->track('surname', $surname); return $this; } @@ -90,7 +90,7 @@ public function getSurname() : ?string public function setIsWorking(bool $isWorking) { $this->isWorking = $isWorking; - $this->set('isWorking', $isWorking); + $this->track('isWorking', $isWorking); return $this; } diff --git a/tests/unit/Generators/Php/expected/entity_generator.txt b/tests/unit/Generators/Php/expected/entity_generator.txt index d4ffcab..f0560d1 100644 --- a/tests/unit/Generators/Php/expected/entity_generator.txt +++ b/tests/unit/Generators/Php/expected/entity_generator.txt @@ -288,7 +288,7 @@ class TestEntity public function setSalary(?float $salary) { $this->salary = $salary; - $this->set('salary', $salary); + $this->track('salary', $salary); return $this; } @@ -307,7 +307,7 @@ class TestEntity public function setActive(bool $active) { $this->active = $active; - $this->set('active', $active); + $this->track('active', $active); return $this; } @@ -326,7 +326,7 @@ class TestEntity public function setName(?string $name) { $this->name = $name; - $this->set('name', $name); + $this->track('name', $name); return $this; } @@ -345,7 +345,7 @@ class TestEntity public function setYear(?int $year) { $this->year = $year; - $this->set('year', $year); + $this->track('year', $year); return $this; } diff --git a/tests/unit/Managers/Php/PhpEntityManagerTest.php b/tests/unit/Managers/Php/PhpEntityManagerTest.php index f5a83a0..b5ca8dd 100644 --- a/tests/unit/Managers/Php/PhpEntityManagerTest.php +++ b/tests/unit/Managers/Php/PhpEntityManagerTest.php @@ -2,15 +2,22 @@ namespace kristijorgji\UnitTests\Managers\Php; +use kristijorgji\DbToPhp\Data\AbstractEntity; use kristijorgji\DbToPhp\Db\Fields\FieldsCollection; use kristijorgji\DbToPhp\Db\Table; use kristijorgji\DbToPhp\Db\TablesCollection; +use kristijorgji\DbToPhp\Generators\Php\Configs\PhpClassGeneratorConfig; +use kristijorgji\DbToPhp\Generators\Php\Configs\PhpEntityGeneratorConfig; +use kristijorgji\DbToPhp\Generators\Php\Configs\PhpGetterGeneratorConfig; +use kristijorgji\DbToPhp\Generators\Php\Configs\PhpPropertyGeneratorConfig; +use kristijorgji\DbToPhp\Generators\Php\Configs\PhpSetterGeneratorConfig; use kristijorgji\DbToPhp\Managers\Exceptions\GenerateException; use kristijorgji\DbToPhp\Managers\GenerateResponse; use kristijorgji\DbToPhp\Managers\Php\PhpEntityManager; use kristijorgji\DbToPhp\Rules\Php\PhpAccessModifiers; use kristijorgji\DbToPhp\Rules\Php\PhpPropertiesCollection; use kristijorgji\DbToPhp\Rules\Php\PhpProperty; +use kristijorgji\DbToPhp\Support\StringCollection; use kristijorgji\Tests\Factories\Db\Fields\FieldFactory; use kristijorgji\Tests\Factories\Db\Fields\FieldsCollectionFactory; use kristijorgji\Tests\Factories\Db\TablesCollectionFactory; @@ -138,6 +145,124 @@ public function testGenerateEntity() $this->manager->generateEntity($tableName); } + /** + * @dataProvider parseConfigForEntityProvider + * @param array $config + * @param string $tableName + * @param PhpEntityGeneratorConfig $expected + */ + public function testParseConfigForEntity( + array $config, + string $tableName, + PhpEntityGeneratorConfig $expected + ) { + + $this->config = $config; + $this->createManager(); + + $method = $this->getPrivateMethod($this->manager, 'parseConfigForEntity'); + $actual = $method->invokeArgs( + $this->manager, + [ + $tableName + ] + ); + + $this->assertEquals($expected, $actual); + } + + public function parseConfigForEntityProvider() + { + return [ + 'should_not_track_changes' => [ + [ + 'includeTables' => ['*'], + 'tableToEntityClassName' => [ + 'test' => 'SuperEntity' + ], + 'outputDirectory' => 'Entities', + 'namespace' => 'Entities', + 'includeAnnotations' => true, + 'includeSetters' => true, + 'includeGetters' => true, + 'fluentSetters' => true, + 'properties' => [ + 'accessModifier' => \kristijorgji\DbToPhp\Rules\Php\PhpAccessModifiers::PRIVATE + ], + 'trackChangesFor' => [] + ], + 'test', + new PhpEntityGeneratorConfig( + new PhpClassGeneratorConfig( + 'Entities', + 'SuperEntity', + new StringCollection(... []), + null, + true + ), + true, + true, + new PhpSetterGeneratorConfig( + true, + true, + true + ), + new PhpGetterGeneratorConfig( + true, + true + ), + new PhpPropertyGeneratorConfig( + true + ), + false + ) + ], + 'should_track_changes' => [ + [ + 'includeTables' => ['*'], + 'tableToEntityClassName' => [ + 'test' => 'SuperEntity' + ], + 'outputDirectory' => 'Entities', + 'namespace' => 'Entities', + 'includeAnnotations' => true, + 'includeSetters' => true, + 'includeGetters' => true, + 'fluentSetters' => true, + 'properties' => [ + 'accessModifier' => \kristijorgji\DbToPhp\Rules\Php\PhpAccessModifiers::PRIVATE + ], + 'trackChangesFor' => ['test'] + ], + 'test', + new PhpEntityGeneratorConfig( + new PhpClassGeneratorConfig( + 'Entities', + 'SuperEntity', + new StringCollection(... [AbstractEntity::class]), + 'AbstractEntity', + true + ), + true, + true, + new PhpSetterGeneratorConfig( + true, + true, + true + ), + new PhpGetterGeneratorConfig( + true, + true + ), + new PhpPropertyGeneratorConfig( + true + ), + true + ) + ] + ]; + } + public function testFormProperties() { $fields = new FieldsCollection(... array_map(function () { From 6c4abd371abb91f0493b30b41c8f7a0ad64743aa Mon Sep 17 00:00:00 2001 From: Kristi Jorgji <=> Date: Fri, 27 Nov 2020 17:24:13 +0100 Subject: [PATCH 3/6] change getter style --- src/Generators/Php/PhpGetterGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generators/Php/PhpGetterGenerator.php b/src/Generators/Php/PhpGetterGenerator.php index 696f042..da1fa73 100644 --- a/src/Generators/Php/PhpGetterGenerator.php +++ b/src/Generators/Php/PhpGetterGenerator.php @@ -62,7 +62,7 @@ private function addDeclaration() $type = $this->property->getType(); $returnType = ''; if ($this->config->shouldTypeHint()) { - $returnType = ' : ' . ($type->isNullable() === true ? '?' : '') . (string) $type->getType(); + $returnType = ': ' . ($type->isNullable() === true ? '?' : '') . (string) $type->getType(); } $functionName = 'get' . ucfirst($this->property->getName()); From fd3f492433be900612c73252da436937a5ddc06d Mon Sep 17 00:00:00 2001 From: kristijorgji Date: Fri, 27 Nov 2020 19:15:44 +0100 Subject: [PATCH 4/6] change generated getters style --- .env.dist | 5 + README.md | 26 +- composer.json | 3 +- composer.lock | 953 ++++++++++++++---- dbToPhp.cfg.php | 4 +- phpunit.xml | 2 +- .../Commands/GenerateEntitiesCommand.php | 6 +- .../Commands/GenerateFactoriesCommand.php | 6 +- src/Console/Commands/InitCommand.php | 8 +- .../Php/PhpEntityFactoryGenerator.php | 6 +- src/Generators/Php/PhpGetterGenerator.php | 2 +- tests/bootstrap.php | 6 + tests/helpers/MySqlTestCase.php | 21 +- tests/integration/MySql/Php/config.php | 8 +- .../entities/expected/BinariusEntity.php | 4 +- .../output/entities/expected/SuperEntity.php | 24 +- .../output/entities/expected/Test2Entity.php | 20 +- .../output/entities/expected/TimesEntity.php | 10 +- .../expected/BinariusEntityFactory.php | 6 +- .../factories/expected/SuperEntityFactory.php | 6 +- .../factories/expected/Test2EntityFactory.php | 6 +- .../factories/expected/TimesEntityFactory.php | 6 +- .../Db/Adapters/MySql/MySqlAdapterTest.php | 5 +- .../unit/Db/Adapters/MySql/test-mysql-db.sql | 56 +- .../Php/expected/entity_factory_generator.txt | 12 +- .../Php/expected/entity_generator.txt | 24 +- .../Php/expected/getter_generator.txt | 4 +- 27 files changed, 946 insertions(+), 293 deletions(-) create mode 100644 .env.dist create mode 100644 tests/bootstrap.php diff --git a/.env.dist b/.env.dist new file mode 100644 index 0000000..a9af8f0 --- /dev/null +++ b/.env.dist @@ -0,0 +1,5 @@ +MYSQL_DB_HOST=192.168.66.7 +MYSQL_DB_PORT=3306 +MYSQL_DB_DATABASE=test_db_to_php +MYSQL_DB_USERNAME=root +MYSQL_DB_PASSWORD=Test123@ diff --git a/README.md b/README.md index 0eea761..a0bc1f4 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ Example with ```typehint=true```: * @param array $data * @return TestEntity */ -public static function make(array $data = []) : TestEntity +public static function make(array $data = []): TestEntity { return self::makeFromData(self::makeData($data)); } @@ -257,7 +257,7 @@ class UsersDemoEntity /** * @return int */ - public function getId() : int + public function getId(): int { return $this->id; } @@ -275,7 +275,7 @@ class UsersDemoEntity /** * @return string */ - public function getName() : string + public function getName(): string { return $this->name; } @@ -293,7 +293,7 @@ class UsersDemoEntity /** * @return string */ - public function getSurname() : string + public function getSurname(): string { return $this->surname; } @@ -311,7 +311,7 @@ class UsersDemoEntity /** * @return string|null */ - public function getPreferences() : ?string + public function getPreferences(): ?string { return $this->preferences; } @@ -329,7 +329,7 @@ class UsersDemoEntity /** * @return int */ - public function getBirthYear() : int + public function getBirthYear(): int { return $this->birthYear; } @@ -347,7 +347,7 @@ class UsersDemoEntity /** * @return int */ - public function getNrCars() : int + public function getNrCars(): int { return $this->nrCars; } @@ -365,7 +365,7 @@ class UsersDemoEntity /** * @return float */ - public function getSalary() : float + public function getSalary(): float { return $this->salary; } @@ -383,7 +383,7 @@ class UsersDemoEntity /** * @return bool */ - public function getActive() : bool + public function getActive(): bool { return $this->active; } @@ -401,7 +401,7 @@ class UsersDemoEntity /** * @return string */ - public function getCreatedAt() : string + public function getCreatedAt(): string { return $this->createdAt; } @@ -482,7 +482,7 @@ class UsersDemoEntityFactory extends AbstractEntityFactory * @param array $data * @return UsersDemoEntity */ - public static function make(array $data = []) : UsersDemoEntity + public static function make(array $data = []): UsersDemoEntity { return self::makeFromData(self::makeData($data)); } @@ -491,7 +491,7 @@ class UsersDemoEntityFactory extends AbstractEntityFactory * @param array $data * @return UsersDemoEntity */ - public static function makeFromData(array $data) : UsersDemoEntity + public static function makeFromData(array $data): UsersDemoEntity { return self::mapArrayToEntity($data, UsersDemoEntity::class); } @@ -500,7 +500,7 @@ class UsersDemoEntityFactory extends AbstractEntityFactory * @param array $data * @return array */ - public static function makeData(array $data = []) : array + public static function makeData(array $data = []): array { return [ 'id' => $data['id'] ?? self::randomInt64(), diff --git a/composer.json b/composer.json index 6a6ccb5..205bd73 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ ], "require": { "php": ">=7.1", - "symfony/console": ">=3.3" + "symfony/console": ">=3.3", + "vlucas/phpdotenv": "^5.2" }, "require-dev": { "fzaninotto/faker": "~1.7", diff --git a/composer.lock b/composer.lock index 46b975a..8a1a746 100644 --- a/composer.lock +++ b/composer.lock @@ -1,23 +1,130 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "541d1b70e13cd2d13f92605ad3bf928a", + "content-hash": "04ad3932f539c8bd44384bdfcf171807", "packages": [ { - "name": "psr/log", - "version": "1.0.2", + "name": "graham-campbell/result-type", + "version": "v1.0.1", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/7e279d2cd5d7fbb156ce46daada972355cea27bb", + "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0", + "phpoption/phpoption": "^1.7.3" + }, + "require-dev": { + "phpunit/phpunit": "^6.5|^7.5|^8.5|^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "time": "2020-04-13T13:17:36+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.7.5", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/994ecccd8f3283ecf5ac33254543eb0ac946d525", + "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "time": "2020-07-20T17:29:33+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "shasum": "" }, "require": { @@ -31,7 +138,7 @@ }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Container\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -44,57 +151,65 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "log", - "psr", - "psr-3" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "symfony/console", - "version": "v3.3.13", + "version": "v5.1.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "63cd7960a0a522c3537f6326706d7f3b8de65805" + "reference": "e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/63cd7960a0a522c3537f6326706d7f3b8de65805", - "reference": "63cd7960a0a522c3537f6326706d7f3b8de65805", + "url": "https://api.github.com/repos/symfony/console/zipball/e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e", + "reference": "e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.15", + "symfony/service-contracts": "^1.1|^2", + "symfony/string": "^5.1" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3", - "symfony/dependency-injection": "~3.3", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", - "symfony/filesystem": "", + "symfony/lock": "", "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -119,44 +234,106 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-11-16T15:24:32+00:00" + "time": "2020-10-24T12:01:57+00:00" }, { - "name": "symfony/debug", - "version": "v3.3.13", + "name": "symfony/polyfill-ctype", + "version": "v1.20.0", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "74557880e2846b5c84029faa96b834da37e29810" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/74557880e2846b5c84029faa96b834da37e29810", - "reference": "74557880e2846b5c84029faa96b834da37e29810", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", + "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" + "php": ">=7.1" }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "suggest": { + "ext-ctype": "For best performance" }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2020-10-23T14:02:19+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c", + "reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -165,34 +342,109 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "time": "2020-10-23T14:02:19+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "727d1096295d807c309fb01a851577302394c897" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/727d1096295d807c309fb01a851577302394c897", + "reference": "727d1096295d807c309fb01a851577302394c897", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Debug Component", + "description": "Symfony polyfill for intl's Normalizer class and related functions", "homepage": "https://symfony.com", - "time": "2017-11-10T16:38:39+00:00" + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "time": "2020-10-23T14:02:19+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531", + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-mbstring": "For best performance" @@ -200,7 +452,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -234,40 +490,359 @@ "portable", "shim" ], - "time": "2017-10-11T12:05:26+00:00" + "time": "2020-10-23T14:02:19+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "8ff431c517be11c78c48a39a66d37431e26a6bed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/8ff431c517be11c78c48a39a66d37431e26a6bed", + "reference": "8ff431c517be11c78c48a39a66d37431e26a6bed", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2020-10-23T14:02:19+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/e70aa8b064c5b72d3df2abd5ab1e90464ad009de", + "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2020-10-23T14:02:19+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2020-09-07T11:33:47+00:00" + }, + { + "name": "symfony/string", + "version": "v5.1.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "a97573e960303db71be0dd8fda9be3bca5e0feea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/a97573e960303db71be0dd8fda9be3bca5e0feea", + "reference": "a97573e960303db71be0dd8fda9be3bca5e0feea", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0", + "symfony/http-client": "^4.4|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "files": [ + "Resources/functions.php" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony String component", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "time": "2020-10-24T12:01:57+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v5.2.0", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "fba64139db67123c7a57072e5f8d3db10d160b66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/fba64139db67123c7a57072e5f8d3db10d160b66", + "reference": "fba64139db67123c7a57072e5f8d3db10d160b66", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "graham-campbell/result-type": "^1.0.1", + "php": "^7.1.3 || ^8.0", + "phpoption/phpoption": "^1.7.4", + "symfony/polyfill-ctype": "^1.17", + "symfony/polyfill-mbstring": "^1.17", + "symfony/polyfill-php80": "^1.17" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-filter": "*", + "phpunit/phpunit": "^7.5.20 || ^8.5.2 || ^9.0" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.2-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "homepage": "https://gjcampbell.co.uk/" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://vancelucas.com/" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "time": "2020-09-14T15:57:31+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -281,29 +856,29 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "time": "2020-11-10T18:47:58+00:00" }, { "name": "fzaninotto/faker", - "version": "v1.7.1", + "version": "v1.9.1", "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d" + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", - "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f", + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f", "shasum": "" }, "require": { @@ -311,13 +886,13 @@ }, "require-dev": { "ext-intl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", - "squizlabs/php_codesniffer": "^1.5" + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^2.9.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -340,29 +915,33 @@ "faker", "fixtures" ], - "time": "2017-08-15T16:48:10+00:00" + "abandoned": true, + "time": "2019-12-12T13:22:17+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.7.0", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { @@ -385,39 +964,34 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "time": "2020-11-13T09:40:50+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-2.x": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -439,38 +1013,41 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.1.1", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "mockery/mockery": "~1.3.2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -481,44 +1058,45 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-30T18:51:59+00:00" + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -531,42 +1109,43 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.7.2", + "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpspec/phpspec": "^2.5 || ^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -594,7 +1173,7 @@ "spy", "stub" ], - "time": "2017-09-04T11:05:03+00:00" + "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpunit/php-code-coverage", @@ -661,16 +1240,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -704,7 +1283,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -798,16 +1377,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0" + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9a02332089ac48e704c70f6cefed30c224e3c0b0", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { @@ -843,20 +1422,21 @@ "keywords": [ "tokenizer" ], - "time": "2017-08-20T05:47:52+00:00" + "abandoned": true, + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.25", + "version": "5.7.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4b1c822a68ae6577df38a59eb49b046712ec0f6a" + "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4b1c822a68ae6577df38a59eb49b046712ec0f6a", - "reference": "4b1c822a68ae6577df38a59eb49b046712ec0f6a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", "shasum": "" }, "require": { @@ -880,7 +1460,7 @@ "sebastian/global-state": "^1.1", "sebastian/object-enumerator": "~2.0", "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0.3|~2.0", + "sebastian/version": "^1.0.6|^2.0.1", "symfony/yaml": "~2.1|~3.0|~4.0" }, "conflict": { @@ -925,7 +1505,7 @@ "testing", "xunit" ], - "time": "2017-11-14T14:50:51+00:00" + "time": "2018-02-01T05:50:59+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -984,6 +1564,7 @@ "mock", "xunit" ], + "abandoned": true, "time": "2017-06-30T09:13:00+00:00" }, { @@ -1501,33 +2082,32 @@ }, { "name": "symfony/yaml", - "version": "v3.3.13", + "version": "v4.4.16", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "0938408c4faa518d95230deabb5f595bf0de31b9" + "reference": "543cb4dbd45ed803f08a9a65f27fb149b5dd20c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/0938408c4faa518d95230deabb5f595bf0de31b9", - "reference": "0938408c4faa518d95230deabb5f595bf0de31b9", + "url": "https://api.github.com/repos/symfony/yaml/zipball/543cb4dbd45ed803f08a9a65f27fb149b5dd20c2", + "reference": "543cb4dbd45ed803f08a9a65f27fb149b5dd20c2", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "~2.8|~3.0" + "symfony/console": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" @@ -1552,35 +2132,34 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-11-10T18:26:04+00:00" + "time": "2020-10-24T11:50:19+00:00" }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -1602,7 +2181,7 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], diff --git a/dbToPhp.cfg.php b/dbToPhp.cfg.php index e31706c..857795d 100644 --- a/dbToPhp.cfg.php +++ b/dbToPhp.cfg.php @@ -4,9 +4,9 @@ 'typeHint' => true, 'databaseDriver' => kristijorgji\DbToPhp\DatabaseDrivers::MYSQL, 'connection' => [ - 'host' => '127.0.0.1', + 'host' => '192.168.66.7', 'port' => 3306, - 'database' => 'db_to_php', + 'database' => 'test_db_to_php', 'username' => 'root', 'password' => 'Test123@', ], diff --git a/phpunit.xml b/phpunit.xml index 6a5dc47..e1d4b06 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,7 @@ bootstrap($input, $output); @@ -40,5 +40,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->outputGenerationResult($output, $e->getPartialResponse()); throw $e->getPrevious(); } + + return 0; } } diff --git a/src/Console/Commands/GenerateFactoriesCommand.php b/src/Console/Commands/GenerateFactoriesCommand.php index 2da9a37..cf158a3 100644 --- a/src/Console/Commands/GenerateFactoriesCommand.php +++ b/src/Console/Commands/GenerateFactoriesCommand.php @@ -27,10 +27,10 @@ protected function configure() /** * @param InputInterface $input * @param OutputInterface $output - * @return void + * @return int * @throws \Exception */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->bootstrap($input, $output); @@ -40,5 +40,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->outputGenerationResult($output, $e->getPartialResponse()); throw $e->getPrevious(); } + + return 0; } } diff --git a/src/Console/Commands/InitCommand.php b/src/Console/Commands/InitCommand.php index bdd661e..0ee83b1 100644 --- a/src/Console/Commands/InitCommand.php +++ b/src/Console/Commands/InitCommand.php @@ -29,11 +29,9 @@ protected function configure() /** * @param InputInterface $input * @param OutputInterface $output - * @throws \RuntimeException - * @throws \InvalidArgumentException - * @return void + * @return int */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $path = $input->getArgument('path'); @@ -69,5 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $output->writeln('created .' . str_replace(getcwd(), '', $filePath)); + + return 0; } } diff --git a/src/Generators/Php/PhpEntityFactoryGenerator.php b/src/Generators/Php/PhpEntityFactoryGenerator.php index 2a778cb..3cb0720 100644 --- a/src/Generators/Php/PhpEntityFactoryGenerator.php +++ b/src/Generators/Php/PhpEntityFactoryGenerator.php @@ -92,7 +92,7 @@ private function addMakeFunction() $returnType = ''; if ($this->config->shouldTypeHint()) { - $returnType .= sprintf(' : %s', $this->entityClassName); + $returnType .= sprintf(': %s', $this->entityClassName); } $this->output->addLine('public static function make(array $data = [])' . $returnType, 4); @@ -134,7 +134,7 @@ private function addMakeFromDataFunction() $returnType = ''; if ($this->config->shouldTypeHint()) { - $returnType .= sprintf(' : %s', $this->entityClassName); + $returnType .= sprintf(': %s', $this->entityClassName); } $this->output->addLine('public static function makeFromData(array $data)' . $returnType, 4); @@ -169,7 +169,7 @@ private function addMakeDataFunction() $returnType = ''; if ($this->config->shouldTypeHint()) { - $returnType .= ' : array'; + $returnType .= ': array'; } $this->output->addLine('public static function makeData(array $data = [])' . $returnType, 4); diff --git a/src/Generators/Php/PhpGetterGenerator.php b/src/Generators/Php/PhpGetterGenerator.php index da1fa73..df448f1 100644 --- a/src/Generators/Php/PhpGetterGenerator.php +++ b/src/Generators/Php/PhpGetterGenerator.php @@ -34,7 +34,7 @@ public function __construct(PhpProperty $property, PhpGetterGeneratorConfig $con $this->config = $config; } - public function generate() : string + public function generate(): string { if ($this->config->shouldIncludeAnnotations()) { $this->addAnnotation(); diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..43620b6 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,6 @@ +load(); diff --git a/tests/helpers/MySqlTestCase.php b/tests/helpers/MySqlTestCase.php index 0493068..9b58d66 100644 --- a/tests/helpers/MySqlTestCase.php +++ b/tests/helpers/MySqlTestCase.php @@ -9,19 +9,24 @@ abstract class MySqlTestCase extends TestCase /** * @var array */ - protected static $mysqlConnection = [ - 'host' => '127.0.0.1', - 'port' => 3306, - 'database' => 'test_db_to_php', - 'username' => 'root', - 'password' => 'Test123@', - ]; + public static $mysqlConnection = []; /** * @var PDO */ protected static $pdo; + static function init(): void + { + self::$mysqlConnection = [ + 'host' => $_ENV['DB_HOST'], + 'port' => $_ENV['DB_PORT'], + 'database' => $_ENV['DB_DATABASE'], + 'username' => $_ENV['DB_USERNAME'], + 'password' => $_ENV['DB_PASSWORD'], + ]; + } + /** * @return void */ @@ -128,3 +133,5 @@ private static function fetchMySqlStatements() : array } } } + +MySqlTestCase::init(); diff --git a/tests/integration/MySql/Php/config.php b/tests/integration/MySql/Php/config.php index efcb7a5..a100ac6 100644 --- a/tests/integration/MySql/Php/config.php +++ b/tests/integration/MySql/Php/config.php @@ -3,13 +3,7 @@ return [ 'typeHint' => true, 'databaseDriver' => kristijorgji\DbToPhp\DatabaseDrivers::MYSQL, - 'connection' => [ - 'host' => '127.0.0.1', - 'port' => 3306, - 'database' => 'test_db_to_php', - 'username' => 'root', - 'password' => 'Test123@', - ], + 'connection' => \kristijorgji\Tests\Helpers\MySqlTestCase::$mysqlConnection, 'entities' => [ 'includeTables' => ['*'], 'tableToEntityClassName' => [ diff --git a/tests/integration/MySql/Php/output/entities/expected/BinariusEntity.php b/tests/integration/MySql/Php/output/entities/expected/BinariusEntity.php index 32bbbee..5576ded 100644 --- a/tests/integration/MySql/Php/output/entities/expected/BinariusEntity.php +++ b/tests/integration/MySql/Php/output/entities/expected/BinariusEntity.php @@ -27,7 +27,7 @@ public function setFile(?string $file) /** * @return string|null */ - public function getFile() : ?string + public function getFile(): ?string { return $this->file; } @@ -45,7 +45,7 @@ public function setImage(?string $image) /** * @return string|null */ - public function getImage() : ?string + public function getImage(): ?string { return $this->image; } diff --git a/tests/integration/MySql/Php/output/entities/expected/SuperEntity.php b/tests/integration/MySql/Php/output/entities/expected/SuperEntity.php index c7bf055..2739d40 100644 --- a/tests/integration/MySql/Php/output/entities/expected/SuperEntity.php +++ b/tests/integration/MySql/Php/output/entities/expected/SuperEntity.php @@ -77,7 +77,7 @@ public function setId(int $id) /** * @return int */ - public function getId() : int + public function getId(): int { return $this->id; } @@ -95,7 +95,7 @@ public function setEvent(string $event) /** * @return string */ - public function getEvent() : string + public function getEvent(): string { return $this->event; } @@ -113,7 +113,7 @@ public function setPayload(string $payload) /** * @return string */ - public function getPayload() : string + public function getPayload(): string { return $this->payload; } @@ -131,7 +131,7 @@ public function setStatus(string $status) /** * @return string */ - public function getStatus() : string + public function getStatus(): string { return $this->status; } @@ -149,7 +149,7 @@ public function setSuperStatus(string $superStatus) /** * @return string */ - public function getSuperStatus() : string + public function getSuperStatus(): string { return $this->superStatus; } @@ -167,7 +167,7 @@ public function setActive(bool $active) /** * @return bool */ - public function getActive() : bool + public function getActive(): bool { return $this->active; } @@ -185,7 +185,7 @@ public function setFile(string $file) /** * @return string */ - public function getFile() : string + public function getFile(): string { return $this->file; } @@ -203,7 +203,7 @@ public function setTime(string $time) /** * @return string */ - public function getTime() : string + public function getTime(): string { return $this->time; } @@ -221,7 +221,7 @@ public function setCanBeNulled(?int $canBeNulled) /** * @return int|null */ - public function getCanBeNulled() : ?int + public function getCanBeNulled(): ?int { return $this->canBeNulled; } @@ -239,7 +239,7 @@ public function setCreatedAt(string $createdAt) /** * @return string */ - public function getCreatedAt() : string + public function getCreatedAt(): string { return $this->createdAt; } @@ -257,7 +257,7 @@ public function setUpdatedAt(string $updatedAt) /** * @return string */ - public function getUpdatedAt() : string + public function getUpdatedAt(): string { return $this->updatedAt; } @@ -275,7 +275,7 @@ public function setNewColumn(?bool $newColumn) /** * @return bool|null */ - public function getNewColumn() : ?bool + public function getNewColumn(): ?bool { return $this->newColumn; } diff --git a/tests/integration/MySql/Php/output/entities/expected/Test2Entity.php b/tests/integration/MySql/Php/output/entities/expected/Test2Entity.php index 0cdf0a5..517c9c0 100644 --- a/tests/integration/MySql/Php/output/entities/expected/Test2Entity.php +++ b/tests/integration/MySql/Php/output/entities/expected/Test2Entity.php @@ -67,7 +67,7 @@ public function setId(int $id) /** * @return int */ - public function getId() : int + public function getId(): int { return $this->id; } @@ -85,7 +85,7 @@ public function setName(?string $name) /** * @return string|null */ - public function getName() : ?string + public function getName(): ?string { return $this->name; } @@ -103,7 +103,7 @@ public function setSurname(?string $surname) /** * @return string|null */ - public function getSurname() : ?string + public function getSurname(): ?string { return $this->surname; } @@ -121,7 +121,7 @@ public function setIsWorking(bool $isWorking) /** * @return bool */ - public function getIsWorking() : bool + public function getIsWorking(): bool { return $this->isWorking; } @@ -139,7 +139,7 @@ public function setSalary(?float $salary) /** * @return float|null */ - public function getSalary() : ?float + public function getSalary(): ?float { return $this->salary; } @@ -157,7 +157,7 @@ public function setDiscount(?float $discount) /** * @return float|null */ - public function getDiscount() : ?float + public function getDiscount(): ?float { return $this->discount; } @@ -175,7 +175,7 @@ public function setNewColumn(?float $newColumn) /** * @return float|null */ - public function getNewColumn() : ?float + public function getNewColumn(): ?float { return $this->newColumn; } @@ -193,7 +193,7 @@ public function setDddd(?string $dddd) /** * @return string|null */ - public function getDddd() : ?string + public function getDddd(): ?string { return $this->dddd; } @@ -211,7 +211,7 @@ public function setBinaeraylk(?string $binaeraylk) /** * @return string|null */ - public function getBinaeraylk() : ?string + public function getBinaeraylk(): ?string { return $this->binaeraylk; } @@ -229,7 +229,7 @@ public function setF(?string $f) /** * @return string|null */ - public function getF() : ?string + public function getF(): ?string { return $this->f; } diff --git a/tests/integration/MySql/Php/output/entities/expected/TimesEntity.php b/tests/integration/MySql/Php/output/entities/expected/TimesEntity.php index 5277e15..ba1a287 100644 --- a/tests/integration/MySql/Php/output/entities/expected/TimesEntity.php +++ b/tests/integration/MySql/Php/output/entities/expected/TimesEntity.php @@ -42,7 +42,7 @@ public function setBirthdayYear(?int $birthdayYear) /** * @return int|null */ - public function getBirthdayYear() : ?int + public function getBirthdayYear(): ?int { return $this->birthdayYear; } @@ -60,7 +60,7 @@ public function setBirthdayTime(?string $birthdayTime) /** * @return string|null */ - public function getBirthdayTime() : ?string + public function getBirthdayTime(): ?string { return $this->birthdayTime; } @@ -78,7 +78,7 @@ public function setColumn3(?string $column3) /** * @return string|null */ - public function getColumn3() : ?string + public function getColumn3(): ?string { return $this->column3; } @@ -96,7 +96,7 @@ public function setLoggedIn(string $loggedIn) /** * @return string */ - public function getLoggedIn() : string + public function getLoggedIn(): string { return $this->loggedIn; } @@ -114,7 +114,7 @@ public function setRegisteredDate(?string $registeredDate) /** * @return string|null */ - public function getRegisteredDate() : ?string + public function getRegisteredDate(): ?string { return $this->registeredDate; } diff --git a/tests/integration/MySql/Php/output/factories/expected/BinariusEntityFactory.php b/tests/integration/MySql/Php/output/factories/expected/BinariusEntityFactory.php index 708321f..a0fdc71 100644 --- a/tests/integration/MySql/Php/output/factories/expected/BinariusEntityFactory.php +++ b/tests/integration/MySql/Php/output/factories/expected/BinariusEntityFactory.php @@ -19,7 +19,7 @@ class BinariusEntityFactory extends AbstractEntityFactory * @param array $data * @return BinariusEntity */ - public static function make(array $data = []) : BinariusEntity + public static function make(array $data = []): BinariusEntity { return self::makeFromData(self::makeData($data)); } @@ -28,7 +28,7 @@ public static function make(array $data = []) : BinariusEntity * @param array $data * @return BinariusEntity */ - public static function makeFromData(array $data) : BinariusEntity + public static function makeFromData(array $data): BinariusEntity { self::validateData($data); return self::mapArrayToEntity($data, BinariusEntity::class); @@ -38,7 +38,7 @@ public static function makeFromData(array $data) : BinariusEntity * @param array $data * @return array */ - public static function makeData(array $data = []) : array + public static function makeData(array $data = []): array { self::validateData($data); return [ diff --git a/tests/integration/MySql/Php/output/factories/expected/SuperEntityFactory.php b/tests/integration/MySql/Php/output/factories/expected/SuperEntityFactory.php index b601b1c..c0962ce 100644 --- a/tests/integration/MySql/Php/output/factories/expected/SuperEntityFactory.php +++ b/tests/integration/MySql/Php/output/factories/expected/SuperEntityFactory.php @@ -29,7 +29,7 @@ class SuperEntityFactory extends AbstractEntityFactory * @param array $data * @return SuperEntity */ - public static function make(array $data = []) : SuperEntity + public static function make(array $data = []): SuperEntity { return self::makeFromData(self::makeData($data)); } @@ -38,7 +38,7 @@ public static function make(array $data = []) : SuperEntity * @param array $data * @return SuperEntity */ - public static function makeFromData(array $data) : SuperEntity + public static function makeFromData(array $data): SuperEntity { self::validateData($data); return self::mapArrayToEntity($data, SuperEntity::class); @@ -48,7 +48,7 @@ public static function makeFromData(array $data) : SuperEntity * @param array $data * @return array */ - public static function makeData(array $data = []) : array + public static function makeData(array $data = []): array { self::validateData($data); return [ diff --git a/tests/integration/MySql/Php/output/factories/expected/Test2EntityFactory.php b/tests/integration/MySql/Php/output/factories/expected/Test2EntityFactory.php index 1dc0726..63364ff 100644 --- a/tests/integration/MySql/Php/output/factories/expected/Test2EntityFactory.php +++ b/tests/integration/MySql/Php/output/factories/expected/Test2EntityFactory.php @@ -27,7 +27,7 @@ class Test2EntityFactory extends AbstractEntityFactory * @param array $data * @return Test2Entity */ - public static function make(array $data = []) : Test2Entity + public static function make(array $data = []): Test2Entity { return self::makeFromData(self::makeData($data)); } @@ -36,7 +36,7 @@ public static function make(array $data = []) : Test2Entity * @param array $data * @return Test2Entity */ - public static function makeFromData(array $data) : Test2Entity + public static function makeFromData(array $data): Test2Entity { self::validateData($data); return self::mapArrayToEntity($data, Test2Entity::class); @@ -46,7 +46,7 @@ public static function makeFromData(array $data) : Test2Entity * @param array $data * @return array */ - public static function makeData(array $data = []) : array + public static function makeData(array $data = []): array { self::validateData($data); return [ diff --git a/tests/integration/MySql/Php/output/factories/expected/TimesEntityFactory.php b/tests/integration/MySql/Php/output/factories/expected/TimesEntityFactory.php index 83ee848..86fefd2 100644 --- a/tests/integration/MySql/Php/output/factories/expected/TimesEntityFactory.php +++ b/tests/integration/MySql/Php/output/factories/expected/TimesEntityFactory.php @@ -22,7 +22,7 @@ class TimesEntityFactory extends AbstractEntityFactory * @param array $data * @return TimesEntity */ - public static function make(array $data = []) : TimesEntity + public static function make(array $data = []): TimesEntity { return self::makeFromData(self::makeData($data)); } @@ -31,7 +31,7 @@ public static function make(array $data = []) : TimesEntity * @param array $data * @return TimesEntity */ - public static function makeFromData(array $data) : TimesEntity + public static function makeFromData(array $data): TimesEntity { self::validateData($data); return self::mapArrayToEntity($data, TimesEntity::class); @@ -41,7 +41,7 @@ public static function makeFromData(array $data) : TimesEntity * @param array $data * @return array */ - public static function makeData(array $data = []) : array + public static function makeData(array $data = []): array { self::validateData($data); return [ diff --git a/tests/unit/Db/Adapters/MySql/MySqlAdapterTest.php b/tests/unit/Db/Adapters/MySql/MySqlAdapterTest.php index 719ac21..0311f47 100644 --- a/tests/unit/Db/Adapters/MySql/MySqlAdapterTest.php +++ b/tests/unit/Db/Adapters/MySql/MySqlAdapterTest.php @@ -39,11 +39,14 @@ public function testGetTables() { $expectedTableNames = [ 'binarius', + 'special', 'test', - 'test_2' + 'test_2', + 'times' ]; $tables = $this->databaseAdapter->getTables(); + print_r($tables); foreach ($tables as $table) { $this->assertTrue(in_array($table->getName(), $expectedTableNames)); } diff --git a/tests/unit/Db/Adapters/MySql/test-mysql-db.sql b/tests/unit/Db/Adapters/MySql/test-mysql-db.sql index cc322f6..195bb66 100644 --- a/tests/unit/Db/Adapters/MySql/test-mysql-db.sql +++ b/tests/unit/Db/Adapters/MySql/test-mysql-db.sql @@ -38,6 +38,35 @@ INSERT INTO `binarius` VALUES ('a','fgdgfdgdfg'),(NULL,NULL); /*!40000 ALTER TABLE `binarius` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `special` +-- + +DROP TABLE IF EXISTS `special`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `special` ( + `geometry` geometry DEFAULT NULL, + `geometry_collection` geometrycollection DEFAULT NULL, + `json` json DEFAULT NULL, + `line_string` linestring DEFAULT NULL, + `multilinestring` multilinestring DEFAULT NULL, + `point` point DEFAULT NULL, + `multipoint` multipoint DEFAULT NULL, + `polygon` polygon DEFAULT NULL, + `multy_polygon` multipolygon DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `special` +-- + +LOCK TABLES `special` WRITE; +/*!40000 ALTER TABLE `special` DISABLE KEYS */; +/*!40000 ALTER TABLE `special` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `test` -- @@ -102,6 +131,31 @@ LOCK TABLES `test_2` WRITE; /*!40000 ALTER TABLE `test_2` DISABLE KEYS */; /*!40000 ALTER TABLE `test_2` ENABLE KEYS */; UNLOCK TABLES; + +-- +-- Table structure for table `times` +-- + +DROP TABLE IF EXISTS `times`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `times` ( + `birthday_year` year(4) DEFAULT NULL, + `birthday_time` time DEFAULT NULL, + `column_3` datetime DEFAULT NULL, + `logged_in` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `registered_date` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `times` +-- + +LOCK TABLES `times` WRITE; +/*!40000 ALTER TABLE `times` DISABLE KEYS */; +/*!40000 ALTER TABLE `times` ENABLE KEYS */; +UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -112,4 +166,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2017-11-21 16:23:19 +-- Dump completed on 2017-11-30 14:42:25 diff --git a/tests/unit/Generators/Php/expected/entity_factory_generator.txt b/tests/unit/Generators/Php/expected/entity_factory_generator.txt index 9ef2a08..29c54e3 100644 --- a/tests/unit/Generators/Php/expected/entity_factory_generator.txt +++ b/tests/unit/Generators/Php/expected/entity_factory_generator.txt @@ -19,7 +19,7 @@ class TestEntityFactory extends BaseEntityFactory * @param array $data * @return TestEntity */ - public static function make(array $data = []) : TestEntity + public static function make(array $data = []): TestEntity { return self::makeFromData(self::makeData($data)); } @@ -28,7 +28,7 @@ class TestEntityFactory extends BaseEntityFactory * @param array $data * @return TestEntity */ - public static function makeFromData(array $data) : TestEntity + public static function makeFromData(array $data): TestEntity { self::validateData($data); return self::mapArrayToEntity($data, TestEntity::class); @@ -38,7 +38,7 @@ class TestEntityFactory extends BaseEntityFactory * @param array $data * @return array */ - public static function makeData(array $data = []) : array + public static function makeData(array $data = []): array { self::validateData($data); return [ @@ -64,18 +64,18 @@ class TestEntityFactory extends BaseEntityFactory 'credit_value', ]; - public static function make(array $data = []) : TestEntity + public static function make(array $data = []): TestEntity { return self::makeFromData(self::makeData($data)); } - public static function makeFromData(array $data) : TestEntity + public static function makeFromData(array $data): TestEntity { self::validateData($data); return self::mapArrayToEntity($data, TestEntity::class); } - public static function makeData(array $data = []) : array + public static function makeData(array $data = []): array { self::validateData($data); return [ diff --git a/tests/unit/Generators/Php/expected/entity_generator.txt b/tests/unit/Generators/Php/expected/entity_generator.txt index f0560d1..ff33685 100644 --- a/tests/unit/Generators/Php/expected/entity_generator.txt +++ b/tests/unit/Generators/Php/expected/entity_generator.txt @@ -66,7 +66,7 @@ class TestEntity /** * @return float|null */ - public function getSalary() : ?float + public function getSalary(): ?float { return $this->salary; } @@ -84,7 +84,7 @@ class TestEntity /** * @return bool */ - public function getActive() : bool + public function getActive(): bool { return $this->active; } @@ -102,7 +102,7 @@ class TestEntity /** * @return string|null */ - public function getName() : ?string + public function getName(): ?string { return $this->name; } @@ -120,7 +120,7 @@ class TestEntity /** * @return int|null */ - public function getYear() : ?int + public function getYear(): ?int { return $this->year; } @@ -156,7 +156,7 @@ class TestEntity /** * @return float|null */ - public function getSalary() : ?float + public function getSalary(): ?float { return $this->salary; } @@ -164,7 +164,7 @@ class TestEntity /** * @return bool */ - public function getActive() : bool + public function getActive(): bool { return $this->active; } @@ -172,7 +172,7 @@ class TestEntity /** * @return string|null */ - public function getName() : ?string + public function getName(): ?string { return $this->name; } @@ -180,7 +180,7 @@ class TestEntity /** * @return int|null */ - public function getYear() : ?int + public function getYear(): ?int { return $this->year; } @@ -295,7 +295,7 @@ class TestEntity /** * @return float|null */ - public function getSalary() : ?float + public function getSalary(): ?float { return $this->salary; } @@ -314,7 +314,7 @@ class TestEntity /** * @return bool */ - public function getActive() : bool + public function getActive(): bool { return $this->active; } @@ -333,7 +333,7 @@ class TestEntity /** * @return string|null */ - public function getName() : ?string + public function getName(): ?string { return $this->name; } @@ -352,7 +352,7 @@ class TestEntity /** * @return int|null */ - public function getYear() : ?int + public function getYear(): ?int { return $this->year; } diff --git a/tests/unit/Generators/Php/expected/getter_generator.txt b/tests/unit/Generators/Php/expected/getter_generator.txt index 9e37aa3..aff3f70 100644 --- a/tests/unit/Generators/Php/expected/getter_generator.txt +++ b/tests/unit/Generators/Php/expected/getter_generator.txt @@ -2,7 +2,7 @@ /** * @return int|null */ - public function getTestProperty() : ?int + public function getTestProperty(): ?int { return $this->testProperty; } @@ -15,7 +15,7 @@ return $this->testProperty; } ##[no_annotation_with_type_hinting]## - public function getTestProperty() : ?int + public function getTestProperty(): ?int { return $this->testProperty; } From d5b498ff07cf62dcf0d9df33a0db25ee7148b840 Mon Sep 17 00:00:00 2001 From: kristijorgji Date: Tue, 3 Aug 2021 10:10:39 +0200 Subject: [PATCH 5/6] support for mysql 8.0 new type definitions of ints without specifying length --- src/Db/Adapters/MySql/MySqlFieldResolver.php | 3 ++- .../unit/Db/Adapters/MySql/MySqlFieldResolverTest.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Db/Adapters/MySql/MySqlFieldResolver.php b/src/Db/Adapters/MySql/MySqlFieldResolver.php index 2aa8863..88dc96a 100644 --- a/src/Db/Adapters/MySql/MySqlFieldResolver.php +++ b/src/Db/Adapters/MySql/MySqlFieldResolver.php @@ -82,7 +82,8 @@ public function resolveField(string $name, string $type, string $null) : Field if (($type == 'tinyint(1)' || preg_match('#(?=^bit)#i', $type))) { return new BoolField($name, $nullable); - } else if (preg_match('#^(tiny|small|medium|big)*int\(\d+\)( unsigned)?#i', $type, $captured)) { + } else if (preg_match('#^(tiny|small|medium|big)*int\(\d+\)( unsigned)?#i', $type, $captured) + || preg_match('#^(tiny|small|medium|big)*int( unsigned)?#i', $type, $captured)) { $signed = empty($captured[2]) ? true : false; $length = $this->getIntLength(empty($captured[1]) ? 'int' : $captured[1]); return new IntegerField($name, $nullable, $length, $signed); diff --git a/tests/unit/Db/Adapters/MySql/MySqlFieldResolverTest.php b/tests/unit/Db/Adapters/MySql/MySqlFieldResolverTest.php index 423ca3b..731bb16 100644 --- a/tests/unit/Db/Adapters/MySql/MySqlFieldResolverTest.php +++ b/tests/unit/Db/Adapters/MySql/MySqlFieldResolverTest.php @@ -83,20 +83,30 @@ public function resolveFieldProvider() 'enum(\'1\',\'4\',\'111\')' ), + 'unsigned_int8_no_length' => $h(new IntegerField($name, false, 8, false), 'tinyint unsigned'), 'unsigned_int8' => $h(new IntegerField($name, false, 8, false), 'tinyint(3) unsigned'), 'signed_int8' => $h(new IntegerField($name, false, 8, true), 'tinyint(3)'), + 'signed_int8_no_length' => $h(new IntegerField($name, false, 8, true), 'tinyint'), + 'unsigned_int16_no_length' => $h(new IntegerField($name, false, 16, false), 'smallint unsigned'), 'unsigned_int16' => $h(new IntegerField($name, false, 16, false), 'smallint(5) unsigned'), 'signed_int16' => $h(new IntegerField($name, false, 16, true), 'smallint(5)'), + 'signed_int16_no_length' => $h(new IntegerField($name, false, 16, true), 'smallint'), + 'unsigned_int24_no_length' => $h(new IntegerField($name, false, 24, false), 'mediumint unsigned'), 'unsigned_int24' => $h(new IntegerField($name, false, 24, false), 'mediumint(9) unsigned'), 'signed_int24' => $h(new IntegerField($name, false, 24, true), 'mediumint(9)'), + 'signed_int24_no_length' => $h(new IntegerField($name, false, 24, true), 'mediumint'), + 'unsigned_int32_no_length' => $h(new IntegerField($name, false, 32, false), 'int unsigned'), 'unsigned_int32' => $h(new IntegerField($name, false, 32, false), 'int(11) unsigned'), 'signed_int32' => $h(new IntegerField($name, false, 32, true), 'int(11)'), + 'signed_int32_no_length' => $h(new IntegerField($name, false, 32, true), 'int'), + 'unsigned_int64_no_length' => $h(new IntegerField($name, false, 64, false), 'bigint unsigned'), 'unsigned_int64' => $h(new IntegerField($name, false, 64, false), 'bigint(20) unsigned'), 'signed_int64' => $h(new IntegerField($name, false, 64, true), 'bigint(20)'), + 'signed_int64_no_length' => $h(new IntegerField($name, false, 64, true), 'bigint'), $h(new FloatField($name, false), 'float'), From e97eb270436748abc04512a7faf6988451b3022d Mon Sep 17 00:00:00 2001 From: Kristi Jorgji Date: Tue, 23 Aug 2022 16:17:33 +0200 Subject: [PATCH 6/6] allow to type hint properties upgrade to phpunit 9.5 and refactor the affected tests --- .gitignore | 1 + README.md | 1 + composer.json | 2 +- composer.lock | 1297 +++++++++++------ .../Configs/PhpPropertyGeneratorConfig.php | 18 +- .../Php/PhpMethodAnnotationGenerator.php | 18 +- .../Php/PhpPropertyAnnotationGenerator.php | 16 +- src/Generators/Php/PhpPropertyGenerator.php | 28 +- src/Generators/Php/Utils.php | 29 + src/Managers/Php/PhpEntityManager.php | 3 +- tests/helpers/MySqlTestCase.php | 10 +- tests/helpers/TestCase.php | 2 +- tests/integration/InitCommandTest.php | 4 +- .../MySql/Php/AbstractPhpTestCase.php | 4 +- tests/unit/Config/ConfigFactoryTest.php | 2 +- .../Console/Commands/AbstractCommandTest.php | 2 +- .../Commands/AbstractCommandTestCase.php | 2 +- .../Commands/GenerateEntitiesCommandTest.php | 2 +- .../Commands/GenerateFactoriesCommandTest.php | 2 +- tests/unit/Data/AbstractEntityFactoryTest.php | 9 +- .../Adapters/DatabaseAdapterFactoryTest.php | 2 +- .../Db/Adapters/MySql/MySqlAdapterTest.php | 4 +- .../Adapters/MySql/MySqlFieldResolverTest.php | 2 +- tests/unit/FileSystem/FileSystemTest.php | 5 +- .../Generators/Php/PhpEntityGeneratorTest.php | 10 +- .../Php/PhpPropertyGeneratorTest.php | 15 +- .../Php/expected/property_generator.txt | 2 + tests/unit/Managers/ManagerFactoryTest.php | 2 +- .../Managers/Php/AbstractPhpManagerTest.php | 2 +- .../Php/AbstractPhpManagerTestCase.php | 2 +- .../Php/PhpEntityFactoryManagerTest.php | 2 +- .../Managers/Php/PhpEntityManagerTest.php | 8 +- ...EntityFactoryFieldFunctionResolverTest.php | 2 +- .../Types/Php/PhpTypeMapperFactoryTest.php | 5 +- .../Mappers/Types/Php/PhpTypeMapperTest.php | 2 +- tests/unit/Support/EnumTest.php | 2 +- 36 files changed, 984 insertions(+), 535 deletions(-) create mode 100644 src/Generators/Php/Utils.php diff --git a/.gitignore b/.gitignore index 3209f71..61c5af6 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ tests/coverage/ Thumbs.db desktop.ini .DS_Store +.phpunit.result.cache diff --git a/README.md b/README.md index a0bc1f4..e578039 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ return [ 'outputDirectory' => 'Entities', 'namespace' => 'Entities', 'includeAnnotations' => true, + 'typeHintProperties' => true, 'includeSetters' => true, 'includeGetters' => true, 'fluentSetters' => true, diff --git a/composer.json b/composer.json index 205bd73..38a347b 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "require-dev": { "fzaninotto/faker": "~1.7", - "phpunit/phpunit": "~5.7" + "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 8a1a746..e6ee85d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "04ad3932f539c8bd44384bdfcf171807", + "content-hash": "dc9741e60bede9bbaf95db987a3e06dc", "packages": [ { "name": "graham-campbell/result-type", @@ -818,29 +818,30 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -865,7 +866,25 @@ "constructor", "instantiate" ], - "time": "2020-11-10T18:47:58+00:00" + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-03-03T08:28:38+00:00" }, { "name": "fzaninotto/faker", @@ -920,37 +939,38 @@ }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -964,253 +984,225 @@ "object", "object graph" ], - "time": "2020-11-13T09:40:50+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "funding": [ { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" } ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2020-06-27T09:03:43+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { - "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "name": "nikic/php-parser", + "version": "v4.14.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", "shasum": "" }, "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" + "ext-tokenizer": "*", + "php": ">=7.0" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, + "bin": [ + "bin/php-parse" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "5.x-dev" + "dev-master": "4.9-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src" + "PhpParser\\": "lib/PhpParser" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" + "name": "Nikita Popov" } ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-09-03T19:13:55+00:00" + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" + }, + "time": "2022-05-31T20:59:12+00:00" }, { - "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "name": "phar-io/manifest", + "version": "2.0.3", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*" + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-09-17T18:55:26+00:00" + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" }, { - "name": "phpspec/prophecy", - "version": "v1.10.3", + "name": "phar-io/version", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "php": "^7.2 || ^8.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10.x-dev" - } - }, "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" }, { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2020-03-05T15:02:03+00:00" + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.8", + "version": "9.2.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + "reference": "2593003befdcc10db5e213f9f28814f5aa8ac073" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2593003befdcc10db5e213f9f28814f5aa8ac073", + "reference": "2593003befdcc10db5e213f9f28814f5aa8ac073", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" + "nikic/php-parser": "^4.14", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-xdebug": "^2.5.1" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -1225,7 +1217,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1236,29 +1228,42 @@ "testing", "xunit" ], - "time": "2017-04-02T07:44:40+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.16" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-08-20T05:26:47+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1273,7 +1278,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1283,26 +1288,48 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1319,37 +1346,47 @@ "role": "lead" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", "keywords": [ - "template" + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2015-06-21T13:50:34+00:00" + "time": "2020-09-28T05:58:55+00:00" }, { - "name": "phpunit/php-timer", - "version": "1.0.9", + "name": "phpunit/php-text-template", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1364,42 +1401,51 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ - "timer" + "template" ], - "time": "2017-02-26T11:10:40+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" }, { - "name": "phpunit/php-token-stream", - "version": "2.0.2", + "name": "phpunit/php-timer", + "version": "5.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": "^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.2.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1414,64 +1460,73 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ - "tokenizer" + "timer" ], - "abandoned": true, - "time": "2017-11-27T05:48:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.27", + "version": "9.5.23", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" + "reference": "888556852e7e9bbeeedb9656afe46118765ade34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/888556852e7e9bbeeedb9656afe46118765ade34", + "reference": "888556852e7e9bbeeedb9656afe46118765ade34", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "^1.0.6|^2.0.1", - "symfony/yaml": "~2.1|~3.0|~4.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" - }, - "require-dev": { - "ext-pdo": "*" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.0", + "sebastian/version": "^3.0.2" }, "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "ext-soap": "*", + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -1479,10 +1534,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "9.5-dev" } }, "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], "classmap": [ "src/" ] @@ -1505,41 +1563,102 @@ "testing", "xunit" ], - "time": "2018-02-01T05:50:59+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.23" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-08-22T14:01:36+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", + "name": "sebastian/cli-parser", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^5.4" + "phpunit/phpunit": "^9.3" }, - "suggest": { - "ext-soap": "*" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -1554,43 +1673,48 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "abandoned": true, - "time": "2017-06-30T09:13:00+00:00" + "time": "2020-10-26T13:08:54+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1610,34 +1734,44 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1650,6 +1784,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1661,45 +1799,109 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29T09:50:25+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:49:45+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" }, { "name": "sebastian/diff", - "version": "1.4.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1712,46 +1914,62 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2017-05-22T07:24:03+00:00" + "time": "2020-10-26T13:10:38+00:00" }, { "name": "sebastian/environment", - "version": "2.0.0", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -1776,34 +1994,44 @@ "environment", "hhvm" ], - "time": "2016-11-26T07:53:53+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1816,6 +2044,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1824,46 +2056,55 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "ext-dom": "*", + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -1871,7 +2112,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1894,33 +2135,101 @@ "keywords": [ "global state" ], - "time": "2015-10-12T03:26:01+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-14T08:28:10+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" }, { "name": "sebastian/object-enumerator", - "version": "2.0.1", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1940,32 +2249,97 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" }, { "name": "sebastian/recursion-context", - "version": "2.0.0", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1978,14 +2352,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -1993,29 +2367,42 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2035,29 +2422,42 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" }, { - "name": "sebastian/version", - "version": "2.0.1", + "name": "sebastian/type", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2076,112 +2476,122 @@ "role": "lead" } ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-03-15T09:54:48+00:00" }, { - "name": "symfony/yaml", - "version": "v4.4.16", + "name": "sebastian/version", + "version": "3.0.2", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "543cb4dbd45ed803f08a9a65f27fb149b5dd20c2" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/543cb4dbd45ed803f08a9a65f27fb149b5dd20c2", - "reference": "543cb4dbd45ed803f08a9a65f27fb149b5dd20c2", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "php": ">=7.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2020-10-24T11:50:19+00:00" + "time": "2020-09-28T06:39:44+00:00" }, { - "name": "webmozart/assert", - "version": "1.9.1", + "name": "theseer/tokenizer", + "version": "1.2.1", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" } ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } ], - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-07-28T10:34:58+00:00" } ], "aliases": [], @@ -2192,5 +2602,6 @@ "platform": { "php": ">=7.1" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.2.0" } diff --git a/src/Generators/Php/Configs/PhpPropertyGeneratorConfig.php b/src/Generators/Php/Configs/PhpPropertyGeneratorConfig.php index fc357d9..87972cf 100644 --- a/src/Generators/Php/Configs/PhpPropertyGeneratorConfig.php +++ b/src/Generators/Php/Configs/PhpPropertyGeneratorConfig.php @@ -9,21 +9,31 @@ class PhpPropertyGeneratorConfig */ private $includeAnnotations; + /** + * @var bool + */ + private $typed; + /** * @param bool $includeAnnotations + * @param bool $typed */ public function __construct( - bool $includeAnnotations + bool $includeAnnotations, + bool $typed ) { $this->includeAnnotations = $includeAnnotations; + $this->typed = $typed; } - /** - * @return boolean - */ public function shouldIncludeAnnotations(): bool { return $this->includeAnnotations; } + + public function shouldBeTypeHinted(): bool + { + return $this->typed; + } } diff --git a/src/Generators/Php/PhpMethodAnnotationGenerator.php b/src/Generators/Php/PhpMethodAnnotationGenerator.php index f969337..84fafec 100644 --- a/src/Generators/Php/PhpMethodAnnotationGenerator.php +++ b/src/Generators/Php/PhpMethodAnnotationGenerator.php @@ -52,13 +52,13 @@ public function generate(int $indentationSpaces = 4) : string foreach ($this->parameters->all() as $argument) { $this->output->addLine( - sprintf('* @param %s $%s', $this->resolveType($argument->getType()), $argument->getName()), + sprintf('* @param %s $%s',Utils::resolveTypeForAnnotation($argument->getType()), $argument->getName()), $indentationSpaces + 1 ); } if ($this->returnType !== null) { - $returnType = $this->resolveType($this->returnType); + $returnType = Utils::resolveTypeForAnnotation($this->returnType); } else { $returnType = 'void'; } @@ -72,18 +72,4 @@ public function generate(int $indentationSpaces = 4) : string return $this->output->get(); } - - /** - * @param PhpType $type - * @return string - */ - private function resolveType(PhpType $type) : string - { - $nullableText = $type->isNullable() === true ? '|null' : ''; - if ($type instanceof PhpObjectType) { - return (string) $type->getClassName() . $nullableText; - } - - return (string) $type->getType() . $nullableText; - } } diff --git a/src/Generators/Php/PhpPropertyAnnotationGenerator.php b/src/Generators/Php/PhpPropertyAnnotationGenerator.php index 8b69d70..b60e839 100644 --- a/src/Generators/Php/PhpPropertyAnnotationGenerator.php +++ b/src/Generators/Php/PhpPropertyAnnotationGenerator.php @@ -37,7 +37,7 @@ public function generate(int $indentationSpaces = 4) : string $this->output->addLine( sprintf( '* @var %s', - $this->resolveType($this->type) + Utils::resolveTypeForAnnotation($this->type) ), $indentationSpaces + 1 ); @@ -45,18 +45,4 @@ public function generate(int $indentationSpaces = 4) : string return $this->output->get(); } - - /** - * @param PhpType $type - * @return string - */ - private function resolveType(PhpType $type) : string - { - $nullableText = $type->isNullable() === true ? '|null' : ''; - if ($type instanceof PhpObjectType) { - return (string) $type->getClassName() . $nullableText; - } - - return (string) $type->getType() . $nullableText; - } } diff --git a/src/Generators/Php/PhpPropertyGenerator.php b/src/Generators/Php/PhpPropertyGenerator.php index ed9fcd0..a6d5d35 100644 --- a/src/Generators/Php/PhpPropertyGenerator.php +++ b/src/Generators/Php/PhpPropertyGenerator.php @@ -58,13 +58,25 @@ private function addAnnotation() private function addDeclaration() { - $this->output->add( - sprintf( - '%s $%s;', - (string) $this->property->getAccessModifier(), - $this->property->getName() - ), - 4 - ); + if ($this->config->shouldBeTypeHinted()) { + $this->output->add( + sprintf( + '%s %s $%s;', + (string) $this->property->getAccessModifier(), + Utils::resolveType($this->property->getType()), + $this->property->getName() + ), + 4 + ); + } else { + $this->output->add( + sprintf( + '%s $%s;', + (string) $this->property->getAccessModifier(), + $this->property->getName() + ), + 4 + ); + } } } diff --git a/src/Generators/Php/Utils.php b/src/Generators/Php/Utils.php new file mode 100644 index 0000000..d96e208 --- /dev/null +++ b/src/Generators/Php/Utils.php @@ -0,0 +1,29 @@ +isNullable() === true ? '|null' : ''; + if ($type instanceof PhpObjectType) { + return $type->getClassName() . $nullableText; + } + + return $type->getType() . $nullableText; + } + + public static function resolveType(PhpType $type) : string + { + $nullablePrefix = $type->isNullable() === true ? '?' : ''; + if ($type instanceof PhpObjectType) { + return $nullablePrefix . $type->getClassName(); + } + + return $nullablePrefix . $type->getType(); + } +} diff --git a/src/Managers/Php/PhpEntityManager.php b/src/Managers/Php/PhpEntityManager.php index 339493d..249ae05 100644 --- a/src/Managers/Php/PhpEntityManager.php +++ b/src/Managers/Php/PhpEntityManager.php @@ -140,7 +140,8 @@ protected function parseConfigForEntity(string $tableName) : PhpEntityGeneratorC $this->typeHint ), new PhpPropertyGeneratorConfig( - $this->config['includeAnnotations'] + $this->config['includeAnnotations'], + $this->config['typeHintProperties'] ?? false ), $shouldTrackChanges ); diff --git a/tests/helpers/MySqlTestCase.php b/tests/helpers/MySqlTestCase.php index 9b58d66..fd9d188 100644 --- a/tests/helpers/MySqlTestCase.php +++ b/tests/helpers/MySqlTestCase.php @@ -27,10 +27,7 @@ static function init(): void ]; } - /** - * @return void - */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { $dsn = sprintf( 'mysql:host=%s:%s;charset=utf8', @@ -50,10 +47,7 @@ public static function setUpBeforeClass() self::initializeTestDatabase(); } - /** - * @return void - */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { self::dropTestDatabase(); self::$pdo = null; diff --git a/tests/helpers/TestCase.php b/tests/helpers/TestCase.php index 9bcaa3d..f381131 100644 --- a/tests/helpers/TestCase.php +++ b/tests/helpers/TestCase.php @@ -4,7 +4,7 @@ use DirectoryIterator; -class TestCase extends \PHPUnit_Framework_TestCase +class TestCase extends \PHPUnit\Framework\TestCase { use TestHelpers; diff --git a/tests/integration/InitCommandTest.php b/tests/integration/InitCommandTest.php index 57d9f98..856b949 100644 --- a/tests/integration/InitCommandTest.php +++ b/tests/integration/InitCommandTest.php @@ -34,7 +34,7 @@ class InitCommandTest extends TestCase */ private $command; - public function setUp() + public function setUp(): void { $this->fileSystem = new FileSystem(); $this->consoleApp = new DbToPhpApplication(); @@ -42,7 +42,7 @@ public function setUp() $this->command = 'init'; } - public function tearDown() + public function tearDown(): void { chdir($this->originalCwd); } diff --git a/tests/integration/MySql/Php/AbstractPhpTestCase.php b/tests/integration/MySql/Php/AbstractPhpTestCase.php index 3ec891d..5cf8e63 100644 --- a/tests/integration/MySql/Php/AbstractPhpTestCase.php +++ b/tests/integration/MySql/Php/AbstractPhpTestCase.php @@ -34,13 +34,13 @@ public static function getDumpPath() : string return __DIR__ . '/../test-mysql-db.sql'; } - public function setUp() + public function setUp(): void { $this->fileSystem = new FileSystem(); $this->consoleApp = new DbToPhpApplication(); } - public function tearDown() + public function tearDown(): void { $this->fileSystem->emptyDirectory($this->actualOutputDirectory); } diff --git a/tests/unit/Config/ConfigFactoryTest.php b/tests/unit/Config/ConfigFactoryTest.php index 2c57fd9..2a42af4 100644 --- a/tests/unit/Config/ConfigFactoryTest.php +++ b/tests/unit/Config/ConfigFactoryTest.php @@ -19,7 +19,7 @@ class ConfigFactoryTest extends TestCase */ private $configFactory; - public function setUp() + public function setUp(): void { $this->fileSystem = $this->getMockBuilder(FileSystemInterface::class)->getMock(); $this->configFactory = new ConfigFactory( diff --git a/tests/unit/Console/Commands/AbstractCommandTest.php b/tests/unit/Console/Commands/AbstractCommandTest.php index 6a5a85d..c4264b0 100644 --- a/tests/unit/Console/Commands/AbstractCommandTest.php +++ b/tests/unit/Console/Commands/AbstractCommandTest.php @@ -24,7 +24,7 @@ class AbstractCommandTest extends TestCase */ private $appName; - public function setUp() + public function setUp(): void { $this->configFactory = $this->getMockBuilder(ConfigFactory::class) ->disableOriginalConstructor() diff --git a/tests/unit/Console/Commands/AbstractCommandTestCase.php b/tests/unit/Console/Commands/AbstractCommandTestCase.php index 8d6a994..eeb5eea 100644 --- a/tests/unit/Console/Commands/AbstractCommandTestCase.php +++ b/tests/unit/Console/Commands/AbstractCommandTestCase.php @@ -32,7 +32,7 @@ abstract class AbstractCommandTestCase extends TestCase */ protected $output; - public function setUp() + public function setUp(): void { $this->configFactory = $this->getMockBuilder(ConfigFactory::class) ->disableOriginalConstructor() diff --git a/tests/unit/Console/Commands/GenerateEntitiesCommandTest.php b/tests/unit/Console/Commands/GenerateEntitiesCommandTest.php index 1227685..53b24d0 100644 --- a/tests/unit/Console/Commands/GenerateEntitiesCommandTest.php +++ b/tests/unit/Console/Commands/GenerateEntitiesCommandTest.php @@ -15,7 +15,7 @@ class GenerateEntitiesCommandTest extends AbstractCommandTestCase */ protected $command; - public function setUp() + public function setUp(): void { parent::setUp(); $this->command = new GenerateEntitiesCommand( diff --git a/tests/unit/Console/Commands/GenerateFactoriesCommandTest.php b/tests/unit/Console/Commands/GenerateFactoriesCommandTest.php index 2a5fd5c..5c22c3b 100644 --- a/tests/unit/Console/Commands/GenerateFactoriesCommandTest.php +++ b/tests/unit/Console/Commands/GenerateFactoriesCommandTest.php @@ -13,7 +13,7 @@ class GenerateFactoriesCommandTest extends AbstractCommandTestCase */ protected $command; - public function setUp() + public function setUp(): void { parent::setUp(); $this->command = new GenerateFactoriesCommand( diff --git a/tests/unit/Data/AbstractEntityFactoryTest.php b/tests/unit/Data/AbstractEntityFactoryTest.php index 7a3ddb3..54a9adc 100644 --- a/tests/unit/Data/AbstractEntityFactoryTest.php +++ b/tests/unit/Data/AbstractEntityFactoryTest.php @@ -23,6 +23,7 @@ public function testValidateFields() 'binaeraylk' => 'dummy', 'f' => 'dummy', ]); + self::expectNotToPerformAssertions(); } public function testValidateFields_invalid_field() @@ -41,7 +42,7 @@ public function testMapArrayToEntity() public function testRandomArray() { $actual = AbstractEntityFactory::randomArray(); - $this->assertInternalType('array', $actual); + self::assertIsArray($actual); } public function testRandomJson() @@ -53,7 +54,7 @@ public function testRandomJson() public function testRandomBoolean() { $actual = AbstractEntityFactory::randomBoolean(); - $this->assertInternalType('bool', $actual); + self::assertIsBool($actual); } public function testRandomDate() @@ -162,14 +163,14 @@ public function testRandomFloat() $min = rand(1, 100); $max = rand(0, 1) ? rand(1, 100) : null; $actual = AbstractEntityFactory::randomFloat($nrDecimals, $min, $max); - $this->assertInternalType('float', $actual); + self::assertIsFloat($actual); } } public function testRandomFloat_min_greater_then_max() { $actual = AbstractEntityFactory::randomFloat(rand(1, 4), 21, 7); - $this->assertInternalType('float', $actual); + self::assertIsFloat($actual); } public function testRandomUnsignedNumber() diff --git a/tests/unit/Db/Adapters/DatabaseAdapterFactoryTest.php b/tests/unit/Db/Adapters/DatabaseAdapterFactoryTest.php index c8d455f..a76d45d 100644 --- a/tests/unit/Db/Adapters/DatabaseAdapterFactoryTest.php +++ b/tests/unit/Db/Adapters/DatabaseAdapterFactoryTest.php @@ -13,7 +13,7 @@ class DatabaseAdapterFactoryTest extends TestCase */ private $databaseAdapterFactory; - public function setUp() + public function setUp(): void { $this->databaseAdapterFactory = new DatabaseAdapterFactory(); } diff --git a/tests/unit/Db/Adapters/MySql/MySqlAdapterTest.php b/tests/unit/Db/Adapters/MySql/MySqlAdapterTest.php index 0311f47..f175c9b 100644 --- a/tests/unit/Db/Adapters/MySql/MySqlAdapterTest.php +++ b/tests/unit/Db/Adapters/MySql/MySqlAdapterTest.php @@ -19,7 +19,7 @@ class MySqlAdapterTest extends MySqlTestCase */ private $databaseAdapter; - public function setUp() + public function setUp(): void { $this->databaseAdapter = new MySqlAdapter( self::$mysqlConnection['host'], @@ -30,7 +30,7 @@ public function setUp() ); } - public function tearDown() + public function tearDown(): void { $this->databaseAdapter = null; } diff --git a/tests/unit/Db/Adapters/MySql/MySqlFieldResolverTest.php b/tests/unit/Db/Adapters/MySql/MySqlFieldResolverTest.php index 731bb16..8ed0001 100644 --- a/tests/unit/Db/Adapters/MySql/MySqlFieldResolverTest.php +++ b/tests/unit/Db/Adapters/MySql/MySqlFieldResolverTest.php @@ -26,7 +26,7 @@ class MySqlFieldResolverTest extends TestCase */ private $fieldResolver; - public function setUp() + public function setUp(): void { $this->fieldResolver = new MySqlFieldResolver(); } diff --git a/tests/unit/FileSystem/FileSystemTest.php b/tests/unit/FileSystem/FileSystemTest.php index a3b6b03..065410d 100644 --- a/tests/unit/FileSystem/FileSystemTest.php +++ b/tests/unit/FileSystem/FileSystemTest.php @@ -13,7 +13,7 @@ class FileSystemTest extends TestCase */ private $fileSystem; - public function setUp() + public function setUp(): void { $this->fileSystem = new FileSystem(); } @@ -23,6 +23,9 @@ public function testCreateAndDeleteDirectory() $path = __DIR__ . '/test'; $this->fileSystem->createDirectory($path); $this->fileSystem->deleteDirectory($path); + self::assertFalse( + $this->fileSystem->exists($path) + ); } public function testReadFile() diff --git a/tests/unit/Generators/Php/PhpEntityGeneratorTest.php b/tests/unit/Generators/Php/PhpEntityGeneratorTest.php index c9d740d..8e917ef 100644 --- a/tests/unit/Generators/Php/PhpEntityGeneratorTest.php +++ b/tests/unit/Generators/Php/PhpEntityGeneratorTest.php @@ -51,7 +51,7 @@ public function generateProvider() new PhpGetterGeneratorConfig(true, true), new PhpPropertyGeneratorConfig( true, - new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) + false ), false ), @@ -66,7 +66,7 @@ public function generateProvider() new PhpGetterGeneratorConfig(true, true), new PhpPropertyGeneratorConfig( true, - new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) + false ), false ), @@ -81,7 +81,7 @@ public function generateProvider() new PhpGetterGeneratorConfig(true, true), new PhpPropertyGeneratorConfig( true, - new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) + false ), false ), @@ -96,7 +96,7 @@ public function generateProvider() new PhpGetterGeneratorConfig(true, true), new PhpPropertyGeneratorConfig( true, - new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) + false ), false ), @@ -116,7 +116,7 @@ public function generateProvider() new PhpGetterGeneratorConfig(true, true), new PhpPropertyGeneratorConfig( true, - new PhpAccessModifiers(PhpAccessModifiers::PRIVATE) + false ), true ), diff --git a/tests/unit/Generators/Php/PhpPropertyGeneratorTest.php b/tests/unit/Generators/Php/PhpPropertyGeneratorTest.php index 9be7a1a..196e93c 100644 --- a/tests/unit/Generators/Php/PhpPropertyGeneratorTest.php +++ b/tests/unit/Generators/Php/PhpPropertyGeneratorTest.php @@ -37,12 +37,12 @@ public function generateProvider() return [ 'no_annotations' => [ $this->getSampleProperty(), - new PhpPropertyGeneratorConfig(false), + new PhpPropertyGeneratorConfig(false, false), $expected['no_annotations'] ], 'with_annotations_nullable' => [ $this->getSampleProperty(), - new PhpPropertyGeneratorConfig(true), + new PhpPropertyGeneratorConfig(true, false), $expected['with_annotations_nullable'] ], 'with_annotations_not_nullable' => [ @@ -51,8 +51,17 @@ public function generateProvider() new PhpType(new PhpTypes(PhpTypes::INTEGER), false), 'employeeAge' ), - new PhpPropertyGeneratorConfig(true), + new PhpPropertyGeneratorConfig(true, false), $expected['with_annotations_not_nullable'] + ], + 'with_type_hints_no_annotation' => [ + new PhpProperty( + new PhpAccessModifiers(PhpAccessModifiers::PROTECTED), + new PhpType(new PhpTypes(PhpTypes::STRING), true), + 'secretValue' + ), + new PhpPropertyGeneratorConfig(false, true), + $expected['with_type_hints_no_annotation'] ] ]; } diff --git a/tests/unit/Generators/Php/expected/property_generator.txt b/tests/unit/Generators/Php/expected/property_generator.txt index a1e569f..61fc0fa 100644 --- a/tests/unit/Generators/Php/expected/property_generator.txt +++ b/tests/unit/Generators/Php/expected/property_generator.txt @@ -10,3 +10,5 @@ * @var int */ protected $employeeAge; +##[with_type_hints_no_annotation]## + protected ?string $secretValue; diff --git a/tests/unit/Managers/ManagerFactoryTest.php b/tests/unit/Managers/ManagerFactoryTest.php index 1a7c0dc..23da380 100644 --- a/tests/unit/Managers/ManagerFactoryTest.php +++ b/tests/unit/Managers/ManagerFactoryTest.php @@ -31,7 +31,7 @@ class ManagerFactoryTest extends TestCase */ private $managerFactory; - public function setUp() + public function setUp(): void { $this->config = [ 'databaseDriver' => \kristijorgji\DbToPhp\DatabaseDrivers::MYSQL, diff --git a/tests/unit/Managers/Php/AbstractPhpManagerTest.php b/tests/unit/Managers/Php/AbstractPhpManagerTest.php index b0e5729..a5dc0cf 100644 --- a/tests/unit/Managers/Php/AbstractPhpManagerTest.php +++ b/tests/unit/Managers/Php/AbstractPhpManagerTest.php @@ -14,7 +14,7 @@ class AbstractPhpManagerTest extends AbstractPhpManagerTestCase */ protected $manager; - public function setUp() + public function setUp(): void { parent::setUp(); $this->createManager(); diff --git a/tests/unit/Managers/Php/AbstractPhpManagerTestCase.php b/tests/unit/Managers/Php/AbstractPhpManagerTestCase.php index 92d9420..2ff58a1 100644 --- a/tests/unit/Managers/Php/AbstractPhpManagerTestCase.php +++ b/tests/unit/Managers/Php/AbstractPhpManagerTestCase.php @@ -34,7 +34,7 @@ class AbstractPhpManagerTestCase extends TestCase */ protected $typeHint; - public function setUp() + public function setUp(): void { $this->config = require $this->baseTestsPath('integration/MySql/Php/config.php'); diff --git a/tests/unit/Managers/Php/PhpEntityFactoryManagerTest.php b/tests/unit/Managers/Php/PhpEntityFactoryManagerTest.php index 92909eb..7d43c8d 100644 --- a/tests/unit/Managers/Php/PhpEntityFactoryManagerTest.php +++ b/tests/unit/Managers/Php/PhpEntityFactoryManagerTest.php @@ -25,7 +25,7 @@ class PhpEntityFactoryManagerTest extends AbstractPhpManagerTestCase */ protected $manager; - public function setUp() + public function setUp(): void { parent::setUp(); $this->config = $this->config['factories']; diff --git a/tests/unit/Managers/Php/PhpEntityManagerTest.php b/tests/unit/Managers/Php/PhpEntityManagerTest.php index b5ca8dd..b0bd4c6 100644 --- a/tests/unit/Managers/Php/PhpEntityManagerTest.php +++ b/tests/unit/Managers/Php/PhpEntityManagerTest.php @@ -38,7 +38,7 @@ class PhpEntityManagerTest extends AbstractPhpManagerTestCase */ protected $manager; - public function setUp() + public function setUp(): void { parent::setUp(); $this->config = $this->config['entities']; @@ -212,7 +212,8 @@ public function parseConfigForEntityProvider() true ), new PhpPropertyGeneratorConfig( - true + true, + false ), false ) @@ -255,7 +256,8 @@ public function parseConfigForEntityProvider() true ), new PhpPropertyGeneratorConfig( - true + true, + false ), true ) diff --git a/tests/unit/Managers/Php/Resolvers/PhpEntityFactoryFieldFunctionResolverTest.php b/tests/unit/Managers/Php/Resolvers/PhpEntityFactoryFieldFunctionResolverTest.php index c0fd21f..1fe5841 100644 --- a/tests/unit/Managers/Php/Resolvers/PhpEntityFactoryFieldFunctionResolverTest.php +++ b/tests/unit/Managers/Php/Resolvers/PhpEntityFactoryFieldFunctionResolverTest.php @@ -25,7 +25,7 @@ class PhpEntityFactoryFieldFunctionResolverTest extends TestCase */ private $resolver; - public function setUp() + public function setUp(): void { $this->resolver = new PhpEntityFactoryFieldFunctionResolver(); } diff --git a/tests/unit/Mappers/Types/Php/PhpTypeMapperFactoryTest.php b/tests/unit/Mappers/Types/Php/PhpTypeMapperFactoryTest.php index f7047f4..9e29282 100644 --- a/tests/unit/Mappers/Types/Php/PhpTypeMapperFactoryTest.php +++ b/tests/unit/Mappers/Types/Php/PhpTypeMapperFactoryTest.php @@ -5,15 +5,16 @@ use kristijorgji\DbToPhp\DatabaseDrivers; use kristijorgji\DbToPhp\Mappers\Types\Php\PhpTypeMapper; use kristijorgji\DbToPhp\Mappers\Types\Php\PhpTypeMapperFactory; +use kristijorgji\Tests\Helpers\TestCase; -class PhpTypeMapperFactoryTest extends \PHPUnit_Framework_TestCase +class PhpTypeMapperFactoryTest extends TestCase { /** * @var PhpTypeMapperFactory */ protected $typeMapperFactory; - public function setUp() + public function setUp(): void { $this->typeMapperFactory = new PhpTypeMapperFactory(); } diff --git a/tests/unit/Mappers/Types/Php/PhpTypeMapperTest.php b/tests/unit/Mappers/Types/Php/PhpTypeMapperTest.php index 58e1ffb..04b2dd8 100644 --- a/tests/unit/Mappers/Types/Php/PhpTypeMapperTest.php +++ b/tests/unit/Mappers/Types/Php/PhpTypeMapperTest.php @@ -27,7 +27,7 @@ class PhpTypeMapperTest extends TestCase */ private $mapper; - public function setUp() + public function setUp(): void { $this->mapper = new PhpTypeMapper(); } diff --git a/tests/unit/Support/EnumTest.php b/tests/unit/Support/EnumTest.php index e2b0f19..eb47618 100644 --- a/tests/unit/Support/EnumTest.php +++ b/tests/unit/Support/EnumTest.php @@ -12,7 +12,7 @@ class EnumTest extends TestCase */ private $testEnum; - public function setUp() + public function setUp(): void { $this->testEnum = new TestEnum(TestEnum::ANOTHER_TEST); }