Skip to content

Commit

Permalink
Update main component version (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
liquetsoft authored Sep 25, 2024
1 parent 9c8c177 commit f03718e
Show file tree
Hide file tree
Showing 157 changed files with 2,334 additions and 1,671 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php-versions: ['8.0', '8.1']
php-versions: ['8.2']
steps:
- uses: actions/checkout@v2
- name: Install PHP
Expand Down Expand Up @@ -63,13 +63,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.0', '8.1']
laravel-version: ['^8.0', '^9.0']
include:
- php-version: '8.0'
laravel-version: '^7.0'
- php-version: '8.1'
laravel-version: '^10.0'
php-version: ['8.2']
laravel-version: ['^8.0', '^9.0', '^10.0', '^11.0']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
31 changes: 24 additions & 7 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$finder = PhpCsFixer\Finder::create()->in(__DIR__);

$rules = [
'@Symfony' => true,
'new_with_braces' => true,
'concat_space' => ['spacing' => 'one'],
'array_syntax' => ['syntax' => 'short'],
'new_with_parentheses' => true,
'concat_space' => [
'spacing' => 'one',
],
'array_syntax' => [
'syntax' => 'short',
],
'yoda_style' => false,
'phpdoc_no_empty_return' => false,
'no_superfluous_phpdoc_tags' => false,
'no_superfluous_phpdoc_tags' => true,
'single_line_throw' => false,
'array_indentation' => true,
'declare_strict_types' => true,
'void_return' => true,
'non_printable_character' => true,
'modernize_types_casting' => true,
'ordered_interfaces' => ['order' => 'alpha', 'direction' => 'ascend'],
'ordered_interfaces' => [
'order' => 'alpha',
'direction' => 'ascend',
],
'date_time_immutable' => true,
'native_constant_invocation' => true,
'combine_nested_dirname' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
'native_function_invocation' => [
'include' => [
'@compiler_optimized'
],
'scope' => 'namespaced',
'strict' => true,
],
'php_unit_construct' => true,
'php_unit_dedicate_assert' => true,
'php_unit_expectation' => true,
Expand All @@ -32,4 +46,7 @@
'strict_comparison' => true,
];

return (new Config())->setRules($rules)->setFinder($finder);
return (new Config())
->setParallelConfig(ParallelConfigFactory::detect())
->setRules($rules)
->setFinder($finder);
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,14 @@ Allowed Memory Size Exhausted
'report_query_bindings' => false,
],
```

2. **laravel/telescope**

* отключите все логирование для консольных команд

```php
// в config/telescope.php
'ignore_commands' => [
'liquetsoft:fias*',
],
```
25 changes: 12 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "liquetsoft/fias-laravel",
"type": "library",
"description": "Laravel bundle for FIAS database importer.",
"description": "Laravel bundle for FIAS database importer",
"keywords": ["php", "fias", "laravel"],
"license": "MIT",
"require": {
"php": ">=8.0",
"liquetsoft/fias-component": "^12.0",
"illuminate/database": "^7.0|^8.0|^9.0|^10.0",
"laravel/framework": "^7.0|^8.0|^9.0|^10.0"
"php": ">=8.2",
"liquetsoft/fias-component": "^13.0",
"illuminate/database": "^8.0|^9.0|^10.0|^11.0",
"illuminate/http": "^8.0|^9.0|^10.0|^11.0",
"laravel/framework": "^8.0|^9.0|^10.0|^11.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0",
"phpunit/phpunit": "^10.0",
"fakerphp/faker": "^1.7",
"friendsofphp/php-cs-fixer": "^3.0",
"sebastian/phpcpd": "^5.0|^6.0",
"vimeo/psalm": "^5.0",
"nette/php-generator": "^3.6 || ^4.0"
"nette/php-generator": "^4.0"
},
"autoload": {
"psr-4": {
Expand All @@ -40,13 +40,12 @@
"coverage": "vendor/bin/phpunit --configuration phpunit.xml.dist --coverage-html=tests/coverage",
"fixer": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -vv --allow-risky=yes",
"linter": [
"vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -vv --dry-run --stop-on-violation --allow-risky=yes",
"vendor/bin/phpcpd ./ --exclude vendor --exclude src/Entity --exclude src/Resource --exclude src/Migration --exclude src/Serializer/CompiledEntitesDenormalizer.php --exclude tests",
"vendor/bin/psalm --show-info=true --php-version=$(php -r \"echo phpversion();\")"
"vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -vv --dry-run --stop-on-violation --allow-risky=yes",
"vendor/bin/psalm --show-info=true --php-version=$(php -r \"echo phpversion();\")"
],
"entities": [
"php -f generator/generate_entities.php",
"vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --allow-risky=yes -q"
"php -f generator/generate_entities.php",
"vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --allow-risky=yes -q"
]
},
"extra": {
Expand Down
10 changes: 5 additions & 5 deletions docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM php:8.1-cli-alpine

FROM php:8.2-cli-alpine

RUN set -xe && apk update && apk add --no-cache \
libzip \
Expand All @@ -12,10 +11,11 @@ RUN set -xe && apk update && apk add --no-cache \
git \
autoconf \
g++ \
linux-headers \
make


RUN docker-php-ext-install zip soap \
RUN docker-php-ext-install zip opcache \
&& docker-php-source extract \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
Expand All @@ -24,8 +24,8 @@ RUN docker-php-ext-install zip soap \
&& echo 'xdebug.mode=coverage' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini


RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.3.10 \
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.7.8 \
&& mkdir -p /.composer && chmod -Rf 777 /.composer


WORKDIR /var/app
WORKDIR /var/app
35 changes: 2 additions & 33 deletions generator/AbstractGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ abstract class AbstractGenerator
/**
* Создает php класс для указанного дескриптора.
*
* @param EntityDescriptor $descriptor
* @param \SplFileInfo $dir
* @param string $namespace
*
* @throws \Throwable
*/
abstract protected function generateClassByDescriptor(EntityDescriptor $descriptor, \SplFileInfo $dir, string $namespace): void;

/**
* @param EntityRegistry $registry
*/
public function __construct(EntityRegistry $registry)
{
$this->registry = $registry;
Expand All @@ -39,9 +32,6 @@ public function __construct(EntityRegistry $registry)
/**
* Создает классы сущностей в указанной папке с указанным пространством имен.
*
* @param \SplFileInfo $dir
* @param string $namespace
*
* @throws \InvalidArgumentException
* @throws \RuntimeException
*/
Expand All @@ -53,17 +43,14 @@ public function run(\SplFileInfo $dir, string $namespace = ''): void
try {
$this->generate($dir, $unifiedNamespace);
} catch (\Throwable $e) {
$message = 'Error while class generation.';
$message = 'Error while class generation';
throw new \RuntimeException($message, 0, $e);
}
}

/**
* Процесс генерации классов.
*
* @param \SplFileInfo $dir
* @param string $namespace
*
* @throws \Throwable
*/
protected function generate(\SplFileInfo $dir, string $namespace): void
Expand All @@ -77,25 +64,19 @@ protected function generate(\SplFileInfo $dir, string $namespace): void
/**
* Проверяет, что каталог существует и доступен на запись.
*
* @param \SplFileInfo $dir
*
* @throws \InvalidArgumentException
*/
protected function checkDir(\SplFileInfo $dir): void
{
if (!$dir->isDir() || !$dir->isWritable()) {
throw new \InvalidArgumentException(
"Destination folder '" . $dir->getPathname() . "' isn't writable or doesn't exist."
"Destination folder '" . $dir->getPathname() . "' isn't writable or doesn't exist"
);
}
}

/**
* Приводит пространсва имен к единообразному виду.
*
* @param string $namespace
*
* @return string
*/
protected function unifyClassName(string $namespace): string
{
Expand All @@ -107,10 +88,6 @@ protected function unifyClassName(string $namespace): string

/**
* Приводит пространства имен к единообразному виду.
*
* @param string $namespace
*
* @return string
*/
protected function unifyNamespace(string $namespace): string
{
Expand All @@ -119,10 +96,6 @@ protected function unifyNamespace(string $namespace): string

/**
* Приводит имена колонок к единообразному виду.
*
* @param string $name
*
* @return string
*/
protected function unifyColumnName(string $name): string
{
Expand All @@ -131,10 +104,6 @@ protected function unifyColumnName(string $name): string

/**
* Преобразует имя класса в имя таблицы в БД.
*
* @param string $name
*
* @return string
*/
protected function convertClassnameToTableName(string $name): string
{
Expand Down
8 changes: 1 addition & 7 deletions generator/MigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function generateClassByDescriptor(EntityDescriptor $descriptor, \SplF
$phpFile->addUse(Connection::class);
}

$class = $phpFile->addClass($className)->addExtend(Migration::class);
$class = $phpFile->addClass($className)->setExtends(Migration::class);
$class->addComment("Миграция для создания сущности '{$descriptor->getName()}'.");
$this->decorateClassWithUpMethodByDescription($class, $descriptor);
$this->decorateClassWithDownMethodByDescription($class, $descriptor);
Expand All @@ -51,9 +51,6 @@ protected function generateClassByDescriptor(EntityDescriptor $descriptor, \SplF

/**
* Добавляет создание таблицы в класс миграции.
*
* @param ClassType $class
* @param EntityDescriptor $descriptor
*/
protected function decorateClassWithUpMethodByDescription(ClassType $class, EntityDescriptor $descriptor): void
{
Expand Down Expand Up @@ -159,9 +156,6 @@ protected function decorateClassWithUpMethodByDescription(ClassType $class, Enti

/**
* Добавляет удаление таблицы в класс миграции.
*
* @param ClassType $class
* @param EntityDescriptor $descriptor
*/
protected function decorateClassWithDownMethodByDescription(ClassType $class, EntityDescriptor $descriptor): void
{
Expand Down
Loading

0 comments on commit f03718e

Please sign in to comment.