Skip to content

Commit

Permalink
Merge branch 'v5.5.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Dec 16, 2023
2 parents 6fa8c9f + daad190 commit af085c6
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 30 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
os: [ubuntu-latest]
experimental: [false]
composer-options: ['']
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
os: [ubuntu-latest]
experimental: [false]
composer-options: ['']
Expand All @@ -66,13 +66,14 @@ jobs:
- name: Cache module
uses: actions/cache@v3
with:
path: ~/v2.1.8.tar.gz
path: ~/shunit2_2.1.8-4_all.deb
key: shunit2-cache
- name: Setup shunit 2
run: ./tests/phar/install-tests.sh
run: |
wget http://ftp.debian.org/debian/pool/main/s/shunit2/shunit2_2.1.8-4_all.deb -O ~/shunit2_2.1.8-4.deb
sudo apt install -y ~/shunit2_2.1.8-4.deb
- name: Run phar tests
run: |
export PATH="$PATH:$HOME/shunit2-2.1.8/"
COMPOSER_BIN="/bin/composer" COMPOSER_OPTIONS="${{ matrix.composer-options }}" ./tests/phar/tests.sh
test-resume-from-parse:
Expand All @@ -82,7 +83,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
os: [ubuntu-latest]
experimental: [false]
composer-options: ['']
Expand Down Expand Up @@ -116,7 +117,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
os: [ubuntu-latest]
experimental: [false]
composer-options: ['']
Expand Down
10 changes: 5 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ parameters:
count: 1
path: src/Parser/Node/DocBlockNode.php

-
message: "#^Call to an undefined method PhpParser\\\\Node\\\\ComplexType\\|PhpParser\\\\Node\\\\Identifier\\|PhpParser\\\\Node\\\\Name\\:\\:__toString\\(\\)\\.$#"
count: 1
path: src/Parser/NodeVisitor.php

-
message: "#^Call to an undefined method PhpParser\\\\Node\\\\Identifier\\|PhpParser\\\\Node\\\\IntersectionType\\|PhpParser\\\\Node\\\\Name\\:\\:__toString\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -305,11 +310,6 @@ parameters:
count: 1
path: src/Parser/NodeVisitor.php

-
message: "#^Parameter \\#1 \\$type of method Doctum\\\\Parser\\\\NodeVisitor\\:\\:typeToString\\(\\) expects PhpParser\\\\Node\\\\Identifier\\|PhpParser\\\\Node\\\\Name\\|PhpParser\\\\Node\\\\NullableType\\|PhpParser\\\\Node\\\\UnionType\\|null, PhpParser\\\\Node\\\\ComplexType\\|PhpParser\\\\Node\\\\Identifier\\|PhpParser\\\\Node\\\\Name\\|null given\\.$#"
count: 4
path: src/Parser/NodeVisitor.php

-
message: "#^Property Doctum\\\\Parser\\\\NodeVisitor\\:\\:\\$context has no type specified\\.$#"
count: 1
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ parameters:
- tests/phar/data/*
- scripts/generate-twig-cache.php
- scripts/update-po-files.php
- scripts/phar-utils-timestamps.php
- scripts/phar-generator-script.php
paths:
- src/
- scripts/
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ if [ ${IS_LTS_MODE} = "0" ]; then
updateLatestFolders "./releases/${VERSION}"
else
echo 'LTS mode !'
read -r -p "Make it the latest version ? [Y/n]" response
read -r -p "Make it the latest (${VERSION_ENV}) version ? [Y/n]" response
response=${response,,} # tolower
if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then
updateLatestFolders "./releases/${VERSION}"
Expand Down
4 changes: 3 additions & 1 deletion src/Doctum.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ class Doctum implements ArrayAccess
private $base_url = null;
/** @var string|null */
private $favicon = null;
/** @var string */
private $language = 'en';

/**
* @var array<string,string>|null
Expand Down Expand Up @@ -362,7 +364,7 @@ public function offsetGet($offset)
private function getLanguageFromConfig(): string
{
/** @var string $language */
$language = $this->config['language'] ?? 'en';
$language = $this->config['language'] ?? $this->language;
return $language;
}

Expand Down
3 changes: 3 additions & 0 deletions src/Parser/NodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ protected function addMethod(ClassMethodNode $node)
}
}

/**
* @param FunctionReflection|MethodReflection|PropertyReflection $methodOrFunctionOrProperty
*/
protected function addTagFromCommentToMethod(
string $tagName,
DocBlockNode $comment,
Expand Down
2 changes: 2 additions & 0 deletions src/Reflection/FunctionReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public function getClass()

public function setClass(ClassReflection $class)
{
// phpcs:disable Squiz.PHP.NonExecutableCode.ReturnNotRequired
return; // No op
// phpcs:enable
}

/**
Expand Down
22 changes: 19 additions & 3 deletions tests/phar/data/absolute_1.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ Version main


Parsing Foo\Foo total: 62 errors
Parsing Head total: 62 errors
Parsing Body total: 62 errors
Parsing Footer total: 62 errors
Parsing IntersectionDocument total: 62 errors
Parsing Models\LaravelModel total: 62 errors
Parsing RoundaboutIntersection\Foo total: 62 errors
Parsing RoundaboutIntersection\Bar total: 62 errors
Parsing RoundaboutIntersection\FooAndBar total: 62 errors
Parsing RoundaboutIntersection\Baz total: 62 errors
Parsing IPv4Address total: 62 errors
Parsing MyContainer total: 63 errors
Parsing Collection total: 63 errors
Expand Down Expand Up @@ -34,27 +42,35 @@ Rendering Namespace Illuminate
Rendering Namespace Illuminate\Database
Rendering Namespace Illuminate\Database\Eloquent
Rendering Namespace Models
Rendering Namespace RoundaboutIntersection
Rendering Namespace SuperCoolLibrary
Rendering Class Bar
Rendering Class Body
Rendering Class Cat
Rendering Class Collection
Rendering Class DogCollection
Rendering Class Foo
Rendering Class Foo\Foo
Rendering Class Footer
Rendering Class Head
Rendering Class IPv4Address
Rendering Class Illuminate\Database\Eloquent\Builder
Rendering Class IntersectionDocument
Rendering Class Models\LaravelModel
Rendering Class MyContainer
Rendering Class Net_Sample
Rendering Class PersistentCollection
Rendering Class RoundaboutIntersection\Bar
Rendering Class RoundaboutIntersection\Baz
Rendering Class RoundaboutIntersection\Foo
Rendering Class RoundaboutIntersection\FooAndBar
Rendering Class SuperCoolLibrary\Meta
Rendering done


Version Updated C Removed C
main 13 0
main 21 0


Version Updated C Updated N Removed C Removed N
main 13 7 0 0

main 21 8 0 0
76 changes: 76 additions & 0 deletions tests/phar/data/absolute_fr_1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Updating project

Version main
------------


Parsing Foo\Foo total: 62 errors
Parsing Head total: 62 errors
Parsing Body total: 62 errors
Parsing Footer total: 62 errors
Parsing IntersectionDocument total: 62 errors
Parsing Models\LaravelModel total: 62 errors
Parsing RoundaboutIntersection\Foo total: 62 errors
Parsing RoundaboutIntersection\Bar total: 62 errors
Parsing RoundaboutIntersection\FooAndBar total: 62 errors
Parsing RoundaboutIntersection\Baz total: 62 errors
Parsing IPv4Address total: 62 errors
Parsing MyContainer total: 63 errors
Parsing Collection total: 63 errors
Parsing DogCollection total: 63 errors
Parsing PersistentCollection total: 63 errors
Parsing Cat total: 63 errors
Parsing Foo total: 63 errors
Parsing Bar total: 63 errors
Parsing SuperCoolLibrary\Meta total: 63 errors
Parsing Net_Sample total: 63 errors
Parsing done

Rendering Global index.html
Rendering Global doc-index.html
Rendering Global namespaces.html
Rendering Global classes.html
Rendering Global interfaces.html
Rendering Global traits.html
Rendering Global opensearch.xml
Rendering Global search.html
Rendering Global doctum.js
Rendering Global doctum-search.json
Rendering Namespace [Global Namespace]
Rendering Namespace Foo
Rendering Namespace Illuminate
Rendering Namespace Illuminate\Database
Rendering Namespace Illuminate\Database\Eloquent
Rendering Namespace Models
Rendering Namespace RoundaboutIntersection
Rendering Namespace SuperCoolLibrary
Rendering Class Bar
Rendering Class Body
Rendering Class Cat
Rendering Class Collection
Rendering Class DogCollection
Rendering Class Foo
Rendering Class Foo\Foo
Rendering Class Footer
Rendering Class Head
Rendering Class IPv4Address
Rendering Class Illuminate\Database\Eloquent\Builder
Rendering Class IntersectionDocument
Rendering Class Models\LaravelModel
Rendering Class MyContainer
Rendering Class Net_Sample
Rendering Class PersistentCollection
Rendering Class RoundaboutIntersection\Bar
Rendering Class RoundaboutIntersection\Baz
Rendering Class RoundaboutIntersection\Foo
Rendering Class RoundaboutIntersection\FooAndBar
Rendering Class SuperCoolLibrary\Meta
Rendering done


Version Updated C Removed C
main 21 0


Version Updated C Updated N Removed C Removed N
main 21 8 0 0
27 changes: 27 additions & 0 deletions tests/phar/data/doctum-absolute-fr.conf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types = 1);

use Doctum\Doctum;
use Symfony\Component\Finder\Finder;

$rootDir = __DIR__ . '/src';
$iterator = Finder::create()
->files()
->sortByName()
->name('*.php')
->in($rootDir);

return new Doctum(
$iterator,
[
'theme' => 'default',
'title' => 'API Documentation',
'build_dir' => __DIR__ . '/build/html',
'cache_dir' => __DIR__ . '/cache/html',
'insert_todos' => true,
'language' => 'fr',
'base_url' => 'http://8.1.local/@code-lts/doctum/tests/phar/data/build/html/',
'favicon' => 'https://williamdes.eu/assets/logo/williamdes_x64.png',
]
);
22 changes: 19 additions & 3 deletions tests/phar/data/relative_1.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ Version main


Parsing Foo\Foo total: 62 errors
Parsing Head total: 62 errors
Parsing Body total: 62 errors
Parsing Footer total: 62 errors
Parsing IntersectionDocument total: 62 errors
Parsing Models\LaravelModel total: 62 errors
Parsing RoundaboutIntersection\Foo total: 62 errors
Parsing RoundaboutIntersection\Bar total: 62 errors
Parsing RoundaboutIntersection\FooAndBar total: 62 errors
Parsing RoundaboutIntersection\Baz total: 62 errors
Parsing IPv4Address total: 62 errors
Parsing MyContainer total: 63 errors
Parsing Collection total: 63 errors
Expand Down Expand Up @@ -34,27 +42,35 @@ Rendering Namespace Illuminate
Rendering Namespace Illuminate\Database
Rendering Namespace Illuminate\Database\Eloquent
Rendering Namespace Models
Rendering Namespace RoundaboutIntersection
Rendering Namespace SuperCoolLibrary
Rendering Class Bar
Rendering Class Body
Rendering Class Cat
Rendering Class Collection
Rendering Class DogCollection
Rendering Class Foo
Rendering Class Foo\Foo
Rendering Class Footer
Rendering Class Head
Rendering Class IPv4Address
Rendering Class Illuminate\Database\Eloquent\Builder
Rendering Class IntersectionDocument
Rendering Class Models\LaravelModel
Rendering Class MyContainer
Rendering Class Net_Sample
Rendering Class PersistentCollection
Rendering Class RoundaboutIntersection\Bar
Rendering Class RoundaboutIntersection\Baz
Rendering Class RoundaboutIntersection\Foo
Rendering Class RoundaboutIntersection\FooAndBar
Rendering Class SuperCoolLibrary\Meta
Rendering done


Version Updated C Removed C
main 13 0
main 21 0


Version Updated C Updated N Removed C Removed N
main 13 7 0 0

main 21 8 0 0
10 changes: 0 additions & 10 deletions tests/phar/install-tests.sh

This file was deleted.

14 changes: 14 additions & 0 deletions tests/phar/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,27 @@ testPharVersionCommand() {
testPharAbsoluteFiles() {
cd $(dirname $0)/data/
ABSOLUTE_OUTPUT=$(COLUMNS=200 ${PHAR_PATH} update --ignore-parse-errors --no-progress --no-ansi --force ./doctum-absolute.conf.php 2>&1)
# Un-comment to update the test data
# echo "${ABSOLUTE_OUTPUT}" > absolute_1.out
assertSame "The output must be the same" "$(cat absolute_1.out)" "${ABSOLUTE_OUTPUT}"
cd - > /dev/null
}

testPharAbsoluteFilesFrench() {
cd $(dirname $0)/data/
ABSOLUTE_OUTPUT=$(COLUMNS=200 ${PHAR_PATH} update --ignore-parse-errors --no-progress --no-ansi --force ./doctum-absolute-fr.conf.php 2>&1)
# Un-comment to update the test data
# echo "${ABSOLUTE_OUTPUT}" > absolute_fr_1.out
assertSame "The output must be the same" "$(cat absolute_fr_1.out)" "${ABSOLUTE_OUTPUT}"
assertSame "The output must be the same" "Afficher le menu</span" "$(grep -F "Afficher le menu" ./build/html/doc-index.html | cut -d '>' -f 2)"
cd - > /dev/null
}

testPharRelativeFiles() {
cd $(dirname $0)/data/
RELATIVE_OUTPUT=$(COLUMNS=200 ${PHAR_PATH} update --ignore-parse-errors --no-progress --no-ansi --force ./doctum-relative.conf.php 2>&1)
# Un-comment to update the test data
# echo "${RELATIVE_OUTPUT}" > relative_1.out
assertSame "The output must be the same" "$(cat relative_1.out)" "${RELATIVE_OUTPUT}"
cd - > /dev/null
}
Expand Down

0 comments on commit af085c6

Please sign in to comment.