Merge pull request #375 from phpDocumentor/build-php84

Build on php 8.4
This commit is contained in:
Jaap van Otterdijk
2024-11-03 21:56:20 +01:00
committed by GitHub
14 changed files with 44 additions and 1802 deletions
+7 -7
View File
@@ -13,41 +13,41 @@ on: # yamllint disable-line rule:truthy
jobs: jobs:
code-coverage: code-coverage:
name: "Code Coverage" name: "Code Coverage"
uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@main" uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.8"
with: with:
composer-root-version: "5.x-dev" composer-root-version: "5.x-dev"
coding-standards: coding-standards:
name: "Coding Standards" name: "Coding Standards"
uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.7" uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.8"
with: with:
composer-root-version: "5.x-dev" composer-root-version: "5.x-dev"
dependency-analysis: dependency-analysis:
name: "Dependency analysis" name: "Dependency analysis"
uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.7" uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.8"
with: with:
composer-root-version: "5.x-dev" composer-root-version: "5.x-dev"
lint-root: lint-root:
name: "Lint root" name: "Lint root"
uses: "phpDocumentor/.github/.github/workflows/lint.yml@main" uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.8"
with: with:
composer-options: "--no-check-publish --ansi" composer-options: "--no-check-publish --ansi"
static-analysis: static-analysis:
name: "Static analysis" name: "Static analysis"
uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.7" uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.8"
with: with:
php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix"
composer-root-version: "5.x-dev" composer-root-version: "5.x-dev"
unit-tests: unit-tests:
name: "Unit test" name: "Unit test"
uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.7" uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.8"
with: with:
composer-root-version: "5.x-dev" composer-root-version: "5.x-dev"
php-versions: "['7.4', '8.0', '8.1', '8.2', '8.3']" upcoming-releases: true
bc_check: bc_check:
name: "BC Check" name: "BC Check"
+1 -1
View File
@@ -13,7 +13,7 @@ fix-code-style:
.PHONY: static-code-analysis .PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpstan --configuration=phpstan.neon docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpstan --configuration=phpstan.neon
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/psalm docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/psalm.phar
.PHONY: test .PHONY: test
test: test-unit ## Runs all test suites with phpunit/phpunit test: test-unit ## Runs all test suites with phpunit/phpunit
+1 -1
View File
@@ -29,7 +29,7 @@
"phpstan/phpstan-mockery": "^1.1", "phpstan/phpstan-mockery": "^1.1",
"phpstan/extension-installer": "^1.1", "phpstan/extension-installer": "^1.1",
"phpstan/phpstan-webmozart-assert": "^1.2", "phpstan/phpstan-webmozart-assert": "^1.2",
"vimeo/psalm": "^5.13" "psalm/phar": "^5.26"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
Generated
+18 -1776
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -44,7 +44,7 @@ class ExampleFinder
$filename = $example->getFilePath(); $filename = $example->getFilePath();
$file = $this->getExampleFileContents($filename); $file = $this->getExampleFileContents($filename);
if (!$file) { if ($file === null) {
return sprintf('** File not found : %s **', $filename); return sprintf('** File not found : %s **', $filename);
} }
@@ -112,7 +112,7 @@ class ExampleFinder
} }
} }
if (!$normalizedPath) { if ($normalizedPath === null) {
if (is_readable($this->getExamplePathFromSource($filename))) { if (is_readable($this->getExamplePathFromSource($filename))) {
$normalizedPath = $this->getExamplePathFromSource($filename); $normalizedPath = $this->getExamplePathFromSource($filename);
} elseif (is_readable($this->getExamplePathFromExampleDirectory($filename))) { } elseif (is_readable($this->getExamplePathFromExampleDirectory($filename))) {
@@ -122,7 +122,7 @@ class ExampleFinder
} }
} }
$lines = $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : false; $lines = $normalizedPath !== null && is_readable($normalizedPath) ? file($normalizedPath) : false;
return $lines !== false ? $lines : null; return $lines !== false ? $lines : null;
} }
+1 -1
View File
@@ -82,7 +82,7 @@ class Serializer
$indent = str_repeat($this->indentString, $this->indent); $indent = str_repeat($this->indentString, $this->indent);
$firstIndent = $this->isFirstLineIndented ? $indent : ''; $firstIndent = $this->isFirstLineIndented ? $indent : '';
// 3 === strlen(' * ') // 3 === strlen(' * ')
$wrapLength = $this->lineLength ? $this->lineLength - strlen($indent) - 3 : null; $wrapLength = $this->lineLength !== null ? $this->lineLength - strlen($indent) - 3 : null;
$text = $this->removeTrailingSpaces( $text = $this->removeTrailingSpaces(
$indent, $indent,
+2 -2
View File
@@ -166,14 +166,14 @@ final class StandardTagFactory implements TagFactory
public function addService(object $service, ?string $alias = null): void public function addService(object $service, ?string $alias = null): void
{ {
$this->serviceLocator[$alias ?: get_class($service)] = $service; $this->serviceLocator[$alias ?? get_class($service)] = $service;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public function registerTagHandler(string $tagName, $handler): void public function registerTagHandler(string $tagName, $handler): void
{ {
Assert::stringNotEmpty($tagName); Assert::stringNotEmpty($tagName);
if (strpos($tagName, '\\') && $tagName[0] !== '\\') { if (strpos($tagName, '\\') !== false && $tagName[0] !== '\\') {
throw new InvalidArgumentException( throw new InvalidArgumentException(
'A namespaced tag must have a leading backslash as it must be fully qualified' 'A namespaced tag must have a leading backslash as it must be fully qualified'
); );
+1 -1
View File
@@ -62,7 +62,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod
?DescriptionFactory $descriptionFactory = null, ?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null ?TypeContext $context = null
): self { ): self {
if (empty($body)) { if ($body === null || $body === '') {
return new static(); return new static();
} }
+1 -1
View File
@@ -160,7 +160,7 @@ final class Param extends TagWithType implements Factory\StaticMethod
} }
$variableName = ''; $variableName = '';
if ($this->variableName) { if ($this->variableName !== null && $this->variableName !== '') {
$variableName .= ($this->isReference ? '&' : '') . ($this->isVariadic ? '...' : ''); $variableName .= ($this->isReference ? '&' : '') . ($this->isVariadic ? '...' : '');
$variableName .= '$' . $this->variableName; $variableName .= '$' . $this->variableName;
} }
+2 -2
View File
@@ -111,13 +111,13 @@ final class Property extends TagWithType implements Factory\StaticMethod
*/ */
public function __toString(): string public function __toString(): string
{ {
if ($this->description) { if ($this->description !== null) {
$description = $this->description->render(); $description = $this->description->render();
} else { } else {
$description = ''; $description = '';
} }
if ($this->variableName) { if ($this->variableName !== null && $this->variableName !== '') {
$variableName = '$' . $this->variableName; $variableName = '$' . $this->variableName;
} else { } else {
$variableName = ''; $variableName = '';
+2 -2
View File
@@ -111,13 +111,13 @@ final class PropertyRead extends TagWithType implements Factory\StaticMethod
*/ */
public function __toString(): string public function __toString(): string
{ {
if ($this->description) { if ($this->description !== null) {
$description = $this->description->render(); $description = $this->description->render();
} else { } else {
$description = ''; $description = '';
} }
if ($this->variableName) { if ($this->variableName !== null && $this->variableName !== '') {
$variableName = '$' . $this->variableName; $variableName = '$' . $this->variableName;
} else { } else {
$variableName = ''; $variableName = '';
+2 -2
View File
@@ -59,7 +59,7 @@ final class Since extends BaseTag implements Factory\StaticMethod
?DescriptionFactory $descriptionFactory = null, ?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null ?TypeContext $context = null
): ?self { ): ?self {
if (empty($body)) { if ($body === null || $body === '') {
return new static(); return new static();
} }
@@ -89,7 +89,7 @@ final class Since extends BaseTag implements Factory\StaticMethod
*/ */
public function __toString(): string public function __toString(): string
{ {
if ($this->description) { if ($this->description !== null) {
$description = $this->description->render(); $description = $this->description->render();
} else { } else {
$description = ''; $description = '';
+2 -2
View File
@@ -111,13 +111,13 @@ final class Var_ extends TagWithType implements Factory\StaticMethod
*/ */
public function __toString(): string public function __toString(): string
{ {
if ($this->description) { if ($this->description !== null) {
$description = $this->description->render(); $description = $this->description->render();
} else { } else {
$description = ''; $description = '';
} }
if ($this->variableName) { if ($this->variableName !== null && $this->variableName !== '') {
$variableName = '$' . $this->variableName; $variableName = '$' . $this->variableName;
} else { } else {
$variableName = ''; $variableName = '';
+1 -1
View File
@@ -59,7 +59,7 @@ final class Version extends BaseTag implements Factory\StaticMethod
?DescriptionFactory $descriptionFactory = null, ?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null ?TypeContext $context = null
): ?self { ): ?self {
if (empty($body)) { if ($body === null || $body === '') {
return new static(); return new static();
} }