Skip to content

Commit

Permalink
Merge branch 'master' into crud
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz authored Oct 11, 2024
2 parents a56ee0e + 6e88291 commit ba08bcd
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 83 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/docs export-ignore
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

name: Composer require checker

jobs:
composer-require-checker:
uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
5 changes: 3 additions & 2 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on:
pull_request:
pull_request_target:
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -17,7 +17,8 @@ jobs:
secrets:
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: >-
['ubuntu-latest']
php: >-
['8.1']
['8.3']
35 changes: 0 additions & 35 deletions .scrutinizer.yml

This file was deleted.

9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
<br>
</p>

[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii-gii/v/stable.png)](https://packagist.org/packages/yiisoft/yii-gii)
[![Total Downloads](https://poser.pugx.org/yiisoft/yii-gii/downloads.png)](https://packagist.org/packages/yiisoft/yii-gii)
[![Build Status](https://github.com/yiisoft/yii-gii/workflows/build/badge.svg)](https://github.com/yiisoft/yii-gii/actions?query=workflow%3Abuild)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yiisoft/yii-gii/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/yii-gii/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/yii-gii/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/yii-gii/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii-gii/v)](https://packagist.org/packages/yiisoft/yii-gii)
[![Total Downloads](https://poser.pugx.org/yiisoft/yii-gii/downloads)](https://packagist.org/packages/yiisoft/yii-gii)
[![Build status](https://github.com/yiisoft/yii-gii/actions/workflows/build.yml/badge.svg)](https://github.com/yiisoft/yii-gii/actions/workflows/build.yml)
[![Code coverage](https://codecov.io/gh/yiisoft/yii-gii/graph/badge.svg?token=JWRONWSQ5P)](https://codecov.io/gh/yiisoft/yii-gii)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fyii-gii%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/yii-gii/master)
[![static analysis](https://github.com/yiisoft/yii-gii/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/yii-gii/actions?query=workflow%3A%22static+analysis%22)

Expand Down
15 changes: 10 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,37 @@
"php": "^8.1",
"httpsoft/http-basis": "^1.1",
"phpspec/php-diff": "^1.1.3",
"psr/http-message": "^1.0|^2.0",
"symfony/console": "^6.0|^7.0",
"yiisoft/active-record": "dev-master",
"yiisoft/aliases": "^3.0",
"yiisoft/arrays": "^2.1|^3.0",
"yiisoft/csrf": "^2.1.1",
"yiisoft/data-response": "^2.0",
"yiisoft/db": "*",
"yiisoft/friendly-exception": "^1.1",
"yiisoft/http": "^1.2",
"yiisoft/hydrator": "^1.0",
"yiisoft/injector": "^1.1",
"yiisoft/input-http": "^1.0",
"yiisoft/json": "^1.0",
"yiisoft/router": "^3.0",
"yiisoft/strings": "^2.1",
"yiisoft/validator": "^1.0",
"yiisoft/validator": "^2.0",
"yiisoft/yii-console": "^2.0",
"yiisoft/yii-middleware": "^1.0"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.2",
"jetbrains/phpstorm-attributes": "^1.0",
"nyholm/psr7": "^1.5",
"phpunit/phpunit": "^10.2",
"rector/rector": "^1.0.0",
"rector/rector": "^1.2",
"roave/infection-static-analysis-plugin": "^1.23",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^5.13",
"yiisoft/active-record": "dev-master",
"yiisoft/cache": "^3.0",
"yiisoft/db": "1.2 as dev-master",
"yiisoft/db-sqlite": "^1.0",
"yiisoft/db-sqlite": "dev-master",
"yiisoft/di": "^1.1",
"yiisoft/dummy-provider": "^1.0",
"yiisoft/event-dispatcher": "^1.0",
Expand Down
7 changes: 0 additions & 7 deletions src/Component/CodeFile/CodeFileWriteResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Yiisoft\Yii\Gii\Component\CodeFile;

use JetBrains\PhpStorm\ArrayShape;

class CodeFileWriteResult
{
private array $results = [];
Expand All @@ -28,11 +26,6 @@ public function addError(CodeFile $file, string $error): void
];
}

#[ArrayShape([
'id' => 'string',
'status' => 'string',
'error' => 'null|string',
])]
public function getResults(): array
{
return $this->results;
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function diff(
private function createErrorResponse(InvalidGeneratorCommandException $e): DataResponse
{
return $this->responseFactory->createResponse(
['errors' => $e->getResult()->getErrorMessagesIndexedByAttribute()],
['errors' => $e->getResult()->getErrorMessagesIndexedByProperty()],
Status::UNPROCESSABLE_ENTITY
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/ActiveRecord/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
private readonly string $namespace = 'App\\Model',
#[Required]
#[Regex(
pattern: '/^(?:[a-z][a-z0-9]*)(?:\\\\[a-z][a-z0-9]*)*$/i',
pattern: '/^[\w\-.]+$/i',
message: 'Invalid table name'
)]
#[TableExistsRule]
Expand Down
5 changes: 0 additions & 5 deletions src/Validator/ClassExistsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
final class ClassExistsRule implements RuleInterface
{
public function getName(): string
{
return 'gii_class_exists';
}

public function getHandler(): string|RuleHandlerInterface
{
return ClassExistsHandler::class;
Expand Down
5 changes: 0 additions & 5 deletions src/Validator/NewClassRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
final class NewClassRule implements RuleInterface
{
public function getName(): string
{
return 'gii_new_class';
}

public function getHandler(): string|RuleHandlerInterface
{
return NewClassHandler::class;
Expand Down
5 changes: 0 additions & 5 deletions src/Validator/ReservedKeywordRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
final class ReservedKeywordRule implements RuleInterface
{
public function getName(): string
{
return 'gii_reserved_keyword';
}

public function getHandler(): string|RuleHandlerInterface
{
return ReservedKeywordHandler::class;
Expand Down
7 changes: 6 additions & 1 deletion src/Validator/TableExistsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ public function validate(mixed $value, object $rule, ValidationContext $context)

$result = new Result();

$tableSchema = $this->connection->getTableSchema($value);
try {
$tableSchema = $this->connection->getTableSchema($value);
} catch (\Yiisoft\Db\Exception\Exception $e) {
$result->addError($e->getMessage());
return $result;
}

if ($tableSchema === null) {
$result->addError(sprintf('Table "%s" does not exist.', $value));
Expand Down
5 changes: 0 additions & 5 deletions src/Validator/TableExistsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
final class TableExistsRule implements RuleInterface
{
public function getName(): string
{
return 'gii_table_exists';
}

public function getHandler(): string|RuleHandlerInterface
{
return TableExistsHandler::class;
Expand Down
5 changes: 0 additions & 5 deletions src/Validator/TemplateRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
final class TemplateRule implements RuleInterface
{
public function getName(): string
{
return 'gii_template_rule';
}

public function getHandler(): string|RuleHandlerInterface
{
return TemplateRuleHandler::class;
Expand Down

0 comments on commit ba08bcd

Please sign in to comment.