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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"laravel/scout": "^10.12.2",
"larastan/larastan": "^3.1.0",
"orchestra/testbench": "^10.0.0",
"phpstan/phpstan": "2.1.42",
"phpstan/phpstan": "2.1.46",
"phpstan/phpstan-mockery": "^2.0.0",
"phpstan/phpstan-phpunit": "^2.0.9",
"phpstan/phpstan-strict-rules": "^2.0.1",
Expand Down
452 changes: 245 additions & 207 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@j-ulrich/release-it-regex-bumper": "^5.1.0",
"@release-it/bumper": "^7.0.2",
"@release-it/conventional-changelog": "^10.0.0",
"markdownlint-cli2": "^0.20.0",
"markdownlint-rule-relative-links": "^4.0.0",
"markdownlint-cli2": "^0.22.0",
"markdownlint-rule-relative-links": "^5.1.0",
"minimist": "^1.2.8",
"release-it": "^19.0.4"
}
Expand Down
34 changes: 16 additions & 18 deletions packages/lara-asp-testing/src/Concerns/Override.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace LastDragon_ru\LaraASP\Testing\Concerns;

use Closure;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Foundation\Testing\Concerns\InteractsWithContainer;
use LogicException;
Expand Down Expand Up @@ -63,15 +64,19 @@ protected function assertPostConditions(): void {
}

/**
* @template T
* @template TMock of T&MockInterface
* @template T of object
* @template R of T
*
* @param class-string<T> $class
* @param callable(TMock,static=):void|callable(TMock,static=):TMock|callable(TMock,static=):T|TMock|T|class-string<T>|null $factory
* @param class-string<T> $class
* @param (
* $factory is Closure(T&MockInterface):void|Closure():void
* ? Closure(T&MockInterface):void|Closure():void
* : Closure(T&MockInterface):R|Closure():R|R|class-string<R>
* ) $factory
*
* @return TMock|T
* @return ($factory is Closure(T&MockInterface):void|Closure():void ? T&MockInterface : R)
*/
protected function override(string $class, mixed $factory = null): mixed {
protected function override(string $class, object|string|null $factory = null): object {
// Overridden?
if (isset($this->overrides[$class])) {
throw new LogicException(
Expand All @@ -83,18 +88,11 @@ protected function override(string $class, mixed $factory = null): mixed {
}

// Mock
/** @var TMock|T $mock */
$mock = (is_callable($factory) && !($factory instanceof $class)) || $factory === null
? Mockery::mock($class)
: $factory;

if (is_callable($factory) && !($factory instanceof $class)) {
$mock = $factory($mock, $this) ?? $mock;
} elseif (is_string($factory)) {
$mock = $this->app()->make($factory);
} else {
// empty
}
$mock = match (true) {
$factory instanceof Closure => (static fn ($mock) => $factory($mock) ?? $mock)(Mockery::mock($class)),
is_string($factory) => $this->app()->make($factory),
default => $factory,
};

// Override
$this->overrides[$class] = Mockery::spy(static function () use ($mock): mixed {
Expand Down
7 changes: 1 addition & 6 deletions packages/text-parser/src/Ast/Cursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
use Override;
use Traversable;

use function assert;
use function is_object;

/**
* @see NodeParent
* @see NodeChild
Expand Down Expand Up @@ -63,8 +60,6 @@ public function count(): int {
public function getIterator(): Traversable {
if ($this->node instanceof NodeParent) {
foreach ($this->node as $key => $child) {
assert(is_object($child), 'https://github.com/phpstan/phpstan/issues/13204');

yield $key => new static($child, $this, $key);
}
} else {
Expand All @@ -83,7 +78,7 @@ public function offsetGet(mixed $offset): mixed {
$child = $this->node instanceof NodeParent
? $this->node->offsetGet($offset)
: null;
$child = $child !== null && is_object($child)
$child = $child !== null
? new static($child, $this, $offset)
: null;

Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/monorepo-builder/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require-dev": {
"symplify/monorepo-builder": "^11.2"
"symplify/monorepo-builder": "^12.5"
}
}
Loading
Loading