Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/rector-cs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Rector + PHP CS Fixer

on:
pull_request_target:
paths:
- 'src/**'
- 'tests/**'
- '.github/workflows/rector-cs.yml'
- 'composer.json'
- 'rector.php'
- '.php-cs-fixer.dist.php'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
rector:
uses: yiisoft/actions/.github/workflows/rector-cs.yml@master
secrets:
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
php: '8.1'
24 changes: 0 additions & 24 deletions .github/workflows/rector.yml

This file was deleted.

11 changes: 3 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ composer.phar
/phpunit.xml
/.phpunit.cache

# ignore dev installed apps and extensions
/apps
/extensions
/packages

# NPM packages
/node_modules
.env
# PHP CS Fixer
/.php-cs-fixer.cache
/.php-cs-fixer.php
21 changes: 21 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
use Yiisoft\CodeStyle\ConfigBuilder;

$finder = (new Finder())->in([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

return ConfigBuilder::build()
->setRiskyAllowed(true)
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
'@Yiisoft/Core' => true,
'@Yiisoft/Core:risky' => true,
])
->setFinder($finder);
85 changes: 0 additions & 85 deletions .styleci.yml

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Bug #295: Remove unnecessary `CacheKeyNormalizer` instance creation in `CachedContent` (@samdark)
- Enh #295: Minor refactor `ViewTrait::getParameter()` and `ViewTrait::resolveViewFilePath()` (@samdark)
- Bug #300: Fix renderer selection for view files with double extensions (@vjik)
- Enh #302: Explicitly import classes, functions, and constants in "use" section (@vjik)

## 12.2.2 December 07, 2025

Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"rector/rector": "^2.3.4",
"spatie/phpunit-watcher": "^1.24.4",
"yiisoft/aliases": "^3.1.1",
"yiisoft/code-style": "^1.0",
"yiisoft/di": "^1.4.1",
"yiisoft/psr-dummy-provider": "^1.0.2",
"yiisoft/test-support": "^3.1.0"
Expand Down Expand Up @@ -83,6 +84,7 @@
},
"scripts": {
"bench": "phpbench run",
"cs-fix": "php-cs-fixer fix",
"infection": "infection --threads=max",
"test": "phpunit --testdox",
"test-watch": "phpunit-watcher watch"
Expand Down
6 changes: 3 additions & 3 deletions src/Cache/CachedContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
private readonly string $id,
private readonly CacheInterface $cache,
array $dynamicContents = [],
array $variations = []
array $variations = [],
) {
$this->setDynamicContents($dynamicContents);
$this->setVariations($variations);
Expand All @@ -60,9 +60,9 @@
*/
public function cache(
string $content,
DateInterval|int|null $ttl = 60,

Check warning on line 63 in src/Cache/CachedContent.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.5-ubuntu-latest

Escaped Mutant for Mutator "IncrementInteger": @@ @@ */ public function cache( string $content, - DateInterval|int|null $ttl = 60, + DateInterval|int|null $ttl = 61, ?Dependency $dependency = null, float $beta = 1.0, ): string {

Check warning on line 63 in src/Cache/CachedContent.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.5-ubuntu-latest

Escaped Mutant for Mutator "DecrementInteger": @@ @@ */ public function cache( string $content, - DateInterval|int|null $ttl = 60, + DateInterval|int|null $ttl = 59, ?Dependency $dependency = null, float $beta = 1.0, ): string {
Dependency|null $dependency = null,
float $beta = 1.0
?Dependency $dependency = null,
float $beta = 1.0,

Check warning on line 65 in src/Cache/CachedContent.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.5-ubuntu-latest

Escaped Mutant for Mutator "OneZeroFloat": @@ @@ string $content, DateInterval|int|null $ttl = 60, ?Dependency $dependency = null, - float $beta = 1.0, + float $beta = 0.0, ): string { /** @psalm-suppress MixedArgument */ return $this->replaceDynamicPlaceholders(
): string {
/** @psalm-suppress MixedArgument */
return $this->replaceDynamicPlaceholders(
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/DynamicContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class DynamicContent
public function __construct(
private readonly string $id,
callable $contentGenerator,
private readonly array $parameters = []
private readonly array $parameters = [],
) {
$this->contentGenerator = $contentGenerator;
}
Expand Down
5 changes: 2 additions & 3 deletions src/Event/View/AfterRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ public function __construct(
private readonly View $view,
private readonly string $file,
private readonly array $parameters,
private readonly string $result
) {
}
private readonly string $result,
) {}

public function getView(): View
{
Expand Down
5 changes: 2 additions & 3 deletions src/Event/View/BeforeRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ final class BeforeRender implements StoppableEventInterface
public function __construct(
private readonly View $view,
private readonly string $file,
private readonly array $parameters
) {
}
private readonly array $parameters,
) {}

public function stopPropagation(): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Event/View/PageBegin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace Yiisoft\View\Event\View;

final class PageBegin extends ViewEvent
{
}
final class PageBegin extends ViewEvent {}
4 changes: 1 addition & 3 deletions src/Event/View/PageEnd.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace Yiisoft\View\Event\View;

final class PageEnd extends ViewEvent
{
}
final class PageEnd extends ViewEvent {}
5 changes: 2 additions & 3 deletions src/Event/View/ViewEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
abstract class ViewEvent
{
final public function __construct(
private readonly View $view
) {
}
private readonly View $view,
) {}

final public function getView(): View
{
Expand Down
5 changes: 2 additions & 3 deletions src/Event/WebView/AfterRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ public function __construct(
private readonly WebView $view,
private readonly string $file,
private readonly array $parameters,
private readonly string $result
) {
}
private readonly string $result,
) {}

public function getView(): WebView
{
Expand Down
5 changes: 2 additions & 3 deletions src/Event/WebView/BeforeRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ final class BeforeRender implements StoppableEventInterface
public function __construct(
private readonly WebView $view,
private readonly string $file,
private readonly array $parameters
) {
}
private readonly array $parameters,
) {}

public function stopPropagation(): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Event/WebView/BodyBegin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace Yiisoft\View\Event\WebView;

final class BodyBegin extends WebViewEvent
{
}
final class BodyBegin extends WebViewEvent {}
4 changes: 1 addition & 3 deletions src/Event/WebView/BodyEnd.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace Yiisoft\View\Event\WebView;

final class BodyEnd extends WebViewEvent
{
}
final class BodyEnd extends WebViewEvent {}
4 changes: 1 addition & 3 deletions src/Event/WebView/Head.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace Yiisoft\View\Event\WebView;

final class Head extends WebViewEvent
{
}
final class Head extends WebViewEvent {}
4 changes: 1 addition & 3 deletions src/Event/WebView/PageBegin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace Yiisoft\View\Event\WebView;

final class PageBegin extends WebViewEvent
{
}
final class PageBegin extends WebViewEvent {}
4 changes: 1 addition & 3 deletions src/Event/WebView/PageEnd.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace Yiisoft\View\Event\WebView;

final class PageEnd extends WebViewEvent
{
}
final class PageEnd extends WebViewEvent {}
5 changes: 2 additions & 3 deletions src/Event/WebView/WebViewEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
abstract class WebViewEvent
{
final public function __construct(
private readonly WebView $view
) {
}
private readonly WebView $view,
) {}

final public function getView(): WebView
{
Expand Down
4 changes: 1 addition & 3 deletions src/Exception/ViewNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use Exception;

final class ViewNotFoundException extends Exception
{
}
final class ViewNotFoundException extends Exception {}
2 changes: 2 additions & 0 deletions src/PhpTemplateRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
use function ob_implicit_flush;
use function ob_start;

use const EXTR_OVERWRITE;

/**
* `PhpTemplateRenderer` renders the PHP views.
*/
Expand All @@ -30,7 +32,7 @@

$obInitialLevel = ob_get_level();
ob_start();
ob_implicit_flush(false);

Check warning on line 35 in src/PhpTemplateRenderer.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.5-ubuntu-latest

Escaped Mutant for Mutator "FunctionCallRemoval": @@ @@ $obInitialLevel = ob_get_level(); ob_start(); - ob_implicit_flush(false); + try { /** @psalm-suppress PossiblyInvalidFunctionCall,PossiblyNullFunctionCall */ $renderer->bindTo($view)($template, $parameters);

Check warning on line 35 in src/PhpTemplateRenderer.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.5-ubuntu-latest

Escaped Mutant for Mutator "FalseValue": @@ @@ $obInitialLevel = ob_get_level(); ob_start(); - ob_implicit_flush(false); + ob_implicit_flush(true); try { /** @psalm-suppress PossiblyInvalidFunctionCall,PossiblyNullFunctionCall */ $renderer->bindTo($view)($template, $parameters);
try {
/** @psalm-suppress PossiblyInvalidFunctionCall,PossiblyNullFunctionCall */
$renderer->bindTo($view)($template, $parameters);
Expand Down
5 changes: 2 additions & 3 deletions src/State/LocaleState.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
final class LocaleState
{
public function __construct(
private string $locale = 'en'
) {
}
private string $locale = 'en',
) {}

/**
* Set the specified locale code.
Expand Down
Loading
Loading