Skip to content

Commit

Permalink
Copy from yiisoft/form (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Dec 1, 2023
1 parent 89991c8 commit 6adc68b
Show file tree
Hide file tree
Showing 35 changed files with 2,951 additions and 32 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ phpunit.phar
# local phpunit config
/phpunit.xml
# phpunit cache
.phpunit.result.cache
/phpunit.cache
/.phpunit.cache/
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# _____ Change Log
# Yii Form Model Change Log

## 1.0.0 under development

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<a href="https://github.com/yiisoft" target="_blank">
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px">
</a>
<h1 align="center">Yii _____</h1>
<h1 align="center">Yii Form Model</h1>
<br>
</p>

Expand All @@ -26,7 +26,7 @@ The package ...
The package could be installed with composer:

```shell
composer require yiisoft/_____
composer require yiisoft/form-model
```

## General usage
Expand Down Expand Up @@ -74,7 +74,7 @@ Use [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker)

## License

The Yii _____ is free software. It is released under the terms of the BSD License.
The Yii Form Model is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.

Maintained by [Yii Software](https://www.yiiframework.com/).
Expand Down
26 changes: 17 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "yiisoft/_____",
"name": "yiisoft/form-model",
"type": "library",
"description": "_____",
"keywords": [
Expand Down Expand Up @@ -28,24 +28,32 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^8.1"
"php": "^8.1",
"ext-mbstring": "*",
"yiisoft/form": "^1.0@dev",
"yiisoft/html": "^3.3",
"yiisoft/hydrator": "dev-master",
"yiisoft/hydrator-validator": "dev-master",
"yiisoft/strings": "^2.3",
"yiisoft/validator": "^1.1"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.6",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.17.11",
"roave/infection-static-analysis-plugin": "^1.16",
"maglnet/composer-require-checker": "^4.7",
"phpunit/phpunit": "^10.5",
"rector/rector": "^0.18.11",
"roave/infection-static-analysis-plugin": "^1.34",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.7"
"vimeo/psalm": "^5.16",
"yiisoft/test-support": "^3.0"
},
"autoload": {
"psr-4": {
"Yiisoft\\_____\\": "src"
"Yiisoft\\FormModel\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Yiisoft\\_____\\Tests\\": "tests"
"Yiisoft\\FormModel\\Tests\\": "tests"
}
},
"config": {
Expand Down
33 changes: 16 additions & 17 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
failOnRisky="true"
failOnWarning="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
executionOrder="random"
resolveDependencies="true"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="false"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
executionOrder="random"
failOnRisky="true"
failOnWarning="true"
stopOnFailure="false"
colors="true"
>
<php>
<ini name="error_reporting" value="-1"/>
</php>

<testsuites>
<testsuite name="Yii _____ tests">
<testsuite name="Yii Form Model tests">
<directory>./tests</directory>
</testsuite>
</testsuites>

<coverage>
<source>
<include>
<directory>./src</directory>
<directory suffix=".php">./src</directory>
</include>
</coverage>
</source>
</phpunit>
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Rector\Config\RectorConfig;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
Expand All @@ -25,5 +26,6 @@
$rectorConfig->skip([
ClosureToArrowFunctionRector::class,
JsonThrowOnErrorRector::class,
ReadOnlyPropertyRector::class,
]);
};
Empty file removed src/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions src/Exception/PropertyNotSupportNestedValuesException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Yiisoft\FormModel\Exception;

final class PropertyNotSupportNestedValuesException extends ValueNotFoundException
{
public function __construct(
string $property,
private readonly mixed $value,
) {
parent::__construct('Property "' . $property . '" not support nested values.');
}

public function getValue(): mixed
{
return $this->value;
}
}
13 changes: 13 additions & 0 deletions src/Exception/StaticObjectPropertyException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Yiisoft\FormModel\Exception;

final class StaticObjectPropertyException extends ValueNotFoundException
{
public function __construct(string $property)
{
parent::__construct('Object property is static: "' . $property . '".');

Check warning on line 11 in src/Exception/StaticObjectPropertyException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Object property is static: "' . $property . '".'); + parent::__construct($property . 'Object property is static: "' . '".'); } }

Check warning on line 11 in src/Exception/StaticObjectPropertyException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Object property is static: "' . $property . '".'); + parent::__construct($property . '".'); } }

Check warning on line 11 in src/Exception/StaticObjectPropertyException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Object property is static: "' . $property . '".'); + parent::__construct('Object property is static: "' . '".'); } }

Check warning on line 11 in src/Exception/StaticObjectPropertyException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Object property is static: "' . $property . '".'); + parent::__construct('Object property is static: "' . '".' . $property); } }

Check warning on line 11 in src/Exception/StaticObjectPropertyException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Object property is static: "' . $property . '".'); + parent::__construct('Object property is static: "' . $property); } }

Check warning on line 11 in src/Exception/StaticObjectPropertyException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Object property is static: "' . $property . '".'); + } }
}
}
13 changes: 13 additions & 0 deletions src/Exception/UndefinedArrayElementException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Yiisoft\FormModel\Exception;

final class UndefinedArrayElementException extends ValueNotFoundException
{
public function __construct(string $property)
{
parent::__construct('Undefined array element: "' . $property . '".');

Check warning on line 11 in src/Exception/UndefinedArrayElementException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Undefined array element: "' . $property . '".'); + parent::__construct($property . 'Undefined array element: "' . '".'); } }

Check warning on line 11 in src/Exception/UndefinedArrayElementException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Undefined array element: "' . $property . '".'); + parent::__construct($property . '".'); } }

Check warning on line 11 in src/Exception/UndefinedArrayElementException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Undefined array element: "' . $property . '".'); + parent::__construct('Undefined array element: "' . '".'); } }

Check warning on line 11 in src/Exception/UndefinedArrayElementException.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ { public function __construct(string $property) { - parent::__construct('Undefined array element: "' . $property . '".'); + parent::__construct('Undefined array element: "' . '".' . $property); } }
}
}
13 changes: 13 additions & 0 deletions src/Exception/UndefinedObjectPropertyException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Yiisoft\FormModel\Exception;

final class UndefinedObjectPropertyException extends ValueNotFoundException
{
public function __construct(string $property)
{
parent::__construct('Undefined object property: "' . $property . '".');
}
}
11 changes: 11 additions & 0 deletions src/Exception/ValueNotFoundException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace Yiisoft\FormModel\Exception;

use InvalidArgumentException;

abstract class ValueNotFoundException extends InvalidArgumentException
{
}

0 comments on commit 6adc68b

Please sign in to comment.