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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.0.0 - WIP
- Upgrade dev package PestPHP 3
- Upgrade dev package PHPstan 2
- Upgrade dev package Rector 2

## 0.4.4 - 2025-03-22
- Adding `getBoolean()` method for returning boolean value

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
}
],
"require": {
"php": "^8.1|^8.2|^8.3|^8.4",
"php": "^8.2|^8.3|^8.4",
"swaggest/json-schema": "^0.12.42",
"symfony/yaml": "^6.4|^7.1"
},
"require-dev": {
"laravel/pint": "^1.2",
"pestphp/pest": "^2.34",
"phpstan/phpstan": "^1.6",
"rector/rector": "^1"
"pestphp/pest": "^3.0",
"phpstan/phpstan": "^2",
"rector/rector": "^2"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
])
// uncomment to reach your current PHP version
->withPhpSets(
php81: true,
php82: true,
)
->withPreparedSets(
deadCode: true,
Expand Down
9 changes: 3 additions & 6 deletions src/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,10 @@ final class Block implements Iterator, ArrayAccess, Countable
/** @var array<int|string, mixed> */
private array $data;

private bool $iteratorReturnsBlock = true;

/** @param array<int|string, mixed> $data */
public function __construct(array $data = [], bool $iteratorReturnsBlock = true)
public function __construct(array $data = [], private bool $iteratorReturnsBlock = true)
{
$this->data = $data;
$this->iteratorReturnsBlock = $iteratorReturnsBlock;
}

public function iterateBlock(bool $returnsBlock = true): self
Expand Down Expand Up @@ -204,9 +201,9 @@ public function values(): self
* It returns Block or [] depending on $returnArrClass value
*
* @param bool $returnBlockClass true if you need Block object
* @return int|string|array<int|string, mixed>|Block
* @return array<int|string, mixed>|Block
*/
public function keys(bool $returnBlockClass = false): int|string|array|Block
public function keys(bool $returnBlockClass = false): array|Block
{
if ($returnBlockClass) {
return self::make(array_keys($this->data));
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/BlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
expect($composer->getBlock("require.php"))->toBeInstanceOf(Block::class);
expect($composer->get("require.php"))->toBeString();

expect($composer->getBlock("require")->has("^8.1|^8.2|^8.3|^8.4"))->toBeTrue();
expect($composer->getBlock("require")->has("^8.2|^8.3|^8.4"))->toBeTrue();
expect($composer->getBlock("require")->hasKey("php"))->toBeTrue();
expect($composer->getBlock("require-dev")->hasKey("pestphp/pest"))->toBeTrue();
});
Expand Down