Skip to content
Open
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
12 changes: 4 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"homepage": "http://www.phpdoc.org",
"license": "MIT",
"autoload": {
"files": [
"src/php-parser/Modifiers.php"
],
"psr-4": {
"phpDocumentor\\": "src/phpDocumentor"
}
Expand All @@ -26,7 +23,7 @@
"require": {
"php": "8.2.*|8.3.*|8.4.*|8.5.*",
"composer-runtime-api": "^2",
"nikic/php-parser": "~4.18 || ^5.0",
"nikic/php-parser": "^5.0",
"phpdocumentor/reflection-common": "^2.1",
"phpdocumentor/reflection-docblock": "^6.0",
"phpdocumentor/type-resolver": "^2.0",
Expand All @@ -39,12 +36,11 @@
"mikey179/vfsstream": "~1.2",
"mockery/mockery": "~1.6.0",
"phpspec/prophecy-phpunit": "^2.4",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^10.5.53",
"psalm/phar": "^6.0",
"rector/rector": "^1.0.0",
"squizlabs/php_codesniffer": "^3.8"
},
"config": {
Expand Down
102 changes: 19 additions & 83 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,4 @@ parameters:
- src

level: max
ignoreErrors:

- '#Method phpDocumentor\\Reflection\\File\\LocalFile::md5\(\) should return string but returns string\|false\.#'
#
# all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it)
#
# src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php
- '#Method phpDocumentor\\Reflection\\Php\\Factory\\(.*)::getFqsen\(\) should return phpDocumentor\\Reflection\\Fqsen but returns mixed\.#'
- '#Parameter \#1 \$fqsen of class phpDocumentor\\Reflection\\Php\\(.*) constructor expects phpDocumentor\\Reflection\\Fqsen, mixed given\.#'
- '#Parameter \#1 \$fqsen of method phpDocumentor\\Reflection\\Php\\File::addNamespace\(\) expects phpDocumentor\\Reflection\\Fqsen, mixed given\.#'
#
# Type hint in php-parser is incorrect.
- '#Cannot cast PhpParser\\Node\\Expr\|string to string.#'

- '#Parameter \#2 \$object of method phpDocumentor\\Reflection\\Php\\ProjectFactoryStrategy::matches\(\) expects object, mixed given.#'
- '#Method phpDocumentor\\Reflection\\Php\\ValueEvaluator\\ConstantEvaluator::evaluate\(\) should return string but returns mixed.#'
31 changes: 0 additions & 31 deletions src/php-parser/Modifiers.php

This file was deleted.

6 changes: 5 additions & 1 deletion src/phpDocumentor/Reflection/File/LocalFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use InvalidArgumentException;
use Override;
use phpDocumentor\Reflection\File;
use Webmozart\Assert\Assert;

use function file_exists;
use function file_get_contents;
Expand Down Expand Up @@ -56,7 +57,10 @@ public function getContents(): string
#[Override]
public function md5(): string
{
return md5_file($this->path);
$hash = md5_file($this->path);
Assert::string($hash);

return $hash;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/phpDocumentor/Reflection/Middleware/ChainFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final class ChainFactory
public static function createExecutionChain(array $middlewareList, callable $lastCallable): callable
{
while ($middleware = array_pop($middlewareList)) {
// @phpstan-ignore instanceof.alwaysTrue (runtime guard for invalid callers despite @param Middleware[])
if (!$middleware instanceof Middleware) {
throw new InvalidArgumentException(
sprintf(
Expand All @@ -35,7 +36,7 @@ public static function createExecutionChain(array $middlewareList, callable $las
);
}

$lastCallable = static fn ($command): object => $middleware->execute($command, $lastCallable);
$lastCallable = static fn (Command $command): object => $middleware->execute($command, $lastCallable);
}

return $lastCallable;
Expand Down
35 changes: 4 additions & 31 deletions src/phpDocumentor/Reflection/Php/Argument.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\Types\Mixed_;

use function is_string;
use function trigger_error;

use const E_USER_DEPRECATED;

/**
* Descriptor representing a single Argument of a method or function.
*
Expand All @@ -38,8 +33,8 @@ public function __construct(
/** @var string name of the Argument */
private readonly string $name,
Type|null $type = null,
/** @var Expression|string|null the default value for an argument or null if none is provided */
private Expression|string|null $default = null,
/** @var Expression|null the default value for an argument or null if none is provided */
private Expression|null $default = null,
/** @var bool whether the argument passes the parameter by reference instead of by value */
private readonly bool $byReference = false,
/** @var bool Determines if this Argument represents a variadic argument */
Expand All @@ -49,15 +44,6 @@ public function __construct(
$type = new Mixed_();
}

if (is_string($this->default)) {
trigger_error(
'Default values for arguments should be of type Expression, support for strings will be '
. 'removed in 7.x',
E_USER_DEPRECATED,
);
$this->default = new Expression($this->default, []);
}

$this->type = $type;
}

Expand All @@ -69,26 +55,13 @@ public function getName(): string
return $this->name;
}

public function getType(): Type|null
public function getType(): Type
{
return $this->type;
}

public function getDefault(bool $asString = true): Expression|string|null
public function getDefault(): Expression|null
{
if ($this->default === null) {
return null;
}

if ($asString) {
trigger_error(
'The Default value will become of type Expression by default',
E_USER_DEPRECATED,
);

return (string) $this->default;
}

return $this->default;
}

Expand Down
Loading
Loading