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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ jobs:
- name: Composer install
run: composer install

- name: Run loader regression checks
run: php tests/loader.php

- name: Run PHP CodeSniffer
run: vendor/bin/phpcs -q --report=checkstyle src/ | cs2pr
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RUN ls -lah \
&& make build-cakephp3-all CAKEPHP_SOURCE_DIR=/cakephp \
&& make build-cakephp4-all CAKEPHP_SOURCE_DIR=/cakephp \
&& make build-cakephp5-all CAKEPHP_SOURCE_DIR=/cakephp \
&& make build-cakephp6-all CAKEPHP_SOURCE_DIR=/cakephp \
&& make build-authentication-all AUTHENTICATION_SOURCE_DIR=/authentication \
&& make build-authorization-all AUTHORIZATION_SOURCE_DIR=/authorization \
&& make build-chronos-all CHRONOS_SOURCE_DIR=/chronos \
Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ CAKEPHP5_RELEASES := \
5.3|5.3.7|update \
5.4|origin/5.x|update

CAKEPHP6_RELEASES := \
6.0|origin/6.x|update

CHRONOS_RELEASES := \
1.x|origin/1.x|update \
2.x|origin/2.x|update \
Expand Down Expand Up @@ -73,19 +76,21 @@ release_mode = $(word 3,$(subst |, ,$1))
CAKEPHP3_VERSIONS := $(foreach release,$(CAKEPHP3_RELEASES),$(call release_version,$(release)))
CAKEPHP4_VERSIONS := $(foreach release,$(CAKEPHP4_RELEASES),$(call release_version,$(release)))
CAKEPHP5_VERSIONS := $(foreach release,$(CAKEPHP5_RELEASES),$(call release_version,$(release)))
CAKEPHP6_VERSIONS := $(foreach release,$(CAKEPHP6_RELEASES),$(call release_version,$(release)))
CHRONOS_VERSIONS := $(foreach release,$(CHRONOS_RELEASES),$(call release_version,$(release)))
ELASTIC_VERSIONS := $(foreach release,$(ELASTIC_RELEASES),$(call release_version,$(release)))
QUEUE_VERSIONS := $(foreach release,$(QUEUE_RELEASES),$(call release_version,$(release)))
AUTHENTICATION_VERSIONS := $(foreach release,$(AUTHENTICATION_RELEASES),$(call release_version,$(release)))
AUTHORIZATION_VERSIONS := $(foreach release,$(AUTHORIZATION_RELEASES),$(call release_version,$(release)))

.PHONY: help clean deploy install \
build-cakephp3-all build-cakephp4-all build-cakephp5-all \
build-cakephp3-all build-cakephp4-all build-cakephp5-all build-cakephp6-all \
build-chronos-all build-elastic-all build-queue-all \
build-authentication-all build-authorization-all \
$(foreach version,$(CAKEPHP3_VERSIONS),build-cakephp-$(version)) \
$(foreach version,$(CAKEPHP4_VERSIONS),build-cakephp-$(version)) \
$(foreach version,$(CAKEPHP5_VERSIONS),build-cakephp-$(version)) \
$(foreach version,$(CAKEPHP6_VERSIONS),build-cakephp-$(version)) \
$(foreach version,$(CHRONOS_VERSIONS),build-chronos-$(version)) \
$(foreach version,$(ELASTIC_VERSIONS),build-elastic-$(version)) \
$(foreach version,$(QUEUE_VERSIONS),build-queue-$(version)) \
Expand All @@ -105,7 +110,7 @@ help:
@echo " deploy"
@echo " Move built release directories from $(BUILD_DIR) into $(DEPLOY_DIR)."
@echo " build-cakephp-<version>"
@echo " Versions: $(CAKEPHP3_VERSIONS) $(CAKEPHP4_VERSIONS) $(CAKEPHP5_VERSIONS)"
@echo " Versions: $(CAKEPHP3_VERSIONS) $(CAKEPHP4_VERSIONS) $(CAKEPHP5_VERSIONS) $(CAKEPHP6_VERSIONS)"
@echo " build-chronos-<version>"
@echo " Versions: $(CHRONOS_VERSIONS)"
@echo " build-elastic-<version>"
Expand All @@ -116,7 +121,7 @@ help:
@echo " Versions: $(AUTHENTICATION_VERSIONS)"
@echo " build-authorization-<version>"
@echo " Versions: $(AUTHORIZATION_VERSIONS)"
@echo " build-cakephp3-all build-cakephp4-all build-cakephp5-all"
@echo " build-cakephp3-all build-cakephp4-all build-cakephp5-all build-cakephp6-all"
@echo " build-chronos-all build-elastic-all build-queue-all"
@echo " build-authentication-all build-authorization-all"
@echo ""
Expand Down Expand Up @@ -170,6 +175,7 @@ endef
build-cakephp3-all: $(foreach version,$(CAKEPHP3_VERSIONS),build-cakephp-$(version))
build-cakephp4-all: $(foreach version,$(CAKEPHP4_VERSIONS),build-cakephp-$(version))
build-cakephp5-all: $(foreach version,$(CAKEPHP5_VERSIONS),build-cakephp-$(version))
build-cakephp6-all: $(foreach version,$(CAKEPHP6_VERSIONS),build-cakephp-$(version))
build-chronos-all: $(foreach version,$(CHRONOS_VERSIONS),build-chronos-$(version))
build-elastic-all: $(foreach version,$(ELASTIC_VERSIONS),build-elastic-$(version))
build-queue-all: $(foreach version,$(QUEUE_VERSIONS),build-queue-$(version))
Expand All @@ -179,6 +185,7 @@ build-authorization-all: $(foreach version,$(AUTHORIZATION_VERSIONS),build-autho
$(foreach release,$(CAKEPHP3_RELEASES),$(eval $(call build_docs,cakephp,CAKEPHP_SOURCE_DIR,cakephp,cakephp3,$(call release_version,$(release)),$(call release_tag,$(release)),$(call release_mode,$(release)))))
$(foreach release,$(CAKEPHP4_RELEASES),$(eval $(call build_docs,cakephp,CAKEPHP_SOURCE_DIR,cakephp,cakephp4,$(call release_version,$(release)),$(call release_tag,$(release)),$(call release_mode,$(release)))))
$(foreach release,$(CAKEPHP5_RELEASES),$(eval $(call build_docs,cakephp,CAKEPHP_SOURCE_DIR,cakephp,cakephp5,$(call release_version,$(release)),$(call release_tag,$(release)),$(call release_mode,$(release)))))
$(foreach release,$(CAKEPHP6_RELEASES),$(eval $(call build_docs,cakephp,CAKEPHP_SOURCE_DIR,cakephp,cakephp6,$(call release_version,$(release)),$(call release_tag,$(release)),$(call release_mode,$(release)))))
$(foreach release,$(CHRONOS_RELEASES),$(eval $(call build_docs,chronos,CHRONOS_SOURCE_DIR,chronos,chronos,$(call release_version,$(release)),$(call release_tag,$(release)),$(call release_mode,$(release)))))
$(foreach release,$(ELASTIC_RELEASES),$(eval $(call build_docs,elastic,ELASTIC_SOURCE_DIR,elastic-search,elastic,$(call release_version,$(release)),$(call release_tag,$(release)),$(call release_mode,$(release)))))
$(foreach release,$(QUEUE_RELEASES),$(eval $(call build_docs,queue,QUEUE_SOURCE_DIR,queue,queue,$(call release_version,$(release)),$(call release_tag,$(release)),$(call release_mode,$(release)))))
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,22 @@ cd ../cakephp/ && git checkout origin/5.x && cd -
php bin/apitool.php generate --config cakephp5 --version 5.2 --tag origin/5.x --output-dir build/test/ ../cakephp
```

### Building CakePHP 6.0 documentation

Build the development documentation from `origin/6.x`:

```sh
make build-cakephp-6.0
```

The `build-cakephp6-all` target builds all configured 6.x versions. The Makefile
checks out the source branch and updates its dependencies, so use a clean CakePHP
clone. Output is written to `build/api/cakephp/6.0/`.

To generate directly from an existing 6.x checkout:

```sh
mkdir -p build/api/cakephp/6.0
cp -r static/assets/* build/api/cakephp/6.0/
php bin/apitool.php generate --config cakephp6 --version 6.0 --tag origin/6.x --output-dir build/api/cakephp/6.0/ ../cakephp
```
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"cakephp/console": "^5.0",
"composer/composer": "^2.0",
"erusev/parsedown": "^1.7",
"nikic/php-parser": "^4.13",
"nikic/php-parser": "^5.6",
"phpstan/phpdoc-parser": "^1.29.1",
"twig/markdown-extra": "^3.0",
"twig/twig": "^3.0"
Expand Down
27 changes: 14 additions & 13 deletions composer.lock

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

3 changes: 3 additions & 0 deletions config/cakephp3.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

return [
'Project' => [
// Early 3.x releases use PHP 5 syntax, including curly-brace string offsets.
'phpVersion' => '5.6',
'namespaces' => 'Cake',
'sourceDirs' => ['src', 'config'],
'exclude' => [
Expand All @@ -22,6 +24,7 @@
'project' => 'CakePHP',
'release' => 'Red Velvet',
'versions' => [
'6.0' => '../6.0/',
'5.4' => '../5.4/',
'5.3' => '../5.3/',
'5.2' => '../5.2/',
Expand Down
1 change: 1 addition & 0 deletions config/cakephp4.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'project' => 'CakePHP',
'release' => 'Strawberry',
'versions' => [
'6.0' => '../6.0/',
'5.4' => '../5.4/',
'5.3' => '../5.3/',
'5.2' => '../5.2/',
Expand Down
1 change: 1 addition & 0 deletions config/cakephp5.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'project' => 'CakePHP',
'release' => 'Chiffon',
'versions' => [
'6.0' => '../6.0/',
'5.4' => '../5.4/',
'5.3' => '../5.3/',
'5.2' => '../5.2/',
Expand Down
65 changes: 65 additions & 0 deletions config/cakephp6.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

return [
'Project' => [
'namespaces' => 'Cake',
'sourceDirs' => ['src', 'config'],
'exclude' => [
'classes' => [
'Cake\Collection\CollectionTrait',
'Cake\Collection\ExtractTrait',
'Cake\Datasource\EntityTrait',
'Cake\Datasource\QueryTrait',
'Cake\I18n\DateFormatTrait',
],
],
'repo' => 'https://github.com/cakephp/cakephp',
],

'Twig' => [
'templateDir' => 'templates',
'globals' => [
'project' => 'CakePHP',
'release' => '',
'versions' => [
'6.0' => '../6.0/',
'5.4' => '../5.4/',
'5.3' => '../5.3/',
'5.2' => '../5.2/',
'5.1' => '../5.1/',
'5.0' => '../5.0/',
'4.6' => '../4.6/',
'4.5' => '../4.5/',
'4.4' => '../4.4/',
'4.3' => '../4.3/',
'4.2' => '../4.2/',
'4.1' => '../4.1/',
'4.0' => '../4.0/',
'3.10' => '../3.10',
'3.9' => '../3.9/',
'3.8' => '../3.8/',
'3.7' => '../3.7/',
'3.6' => '../3.6/',
'3.5' => '../3.5/',
'3.4' => '../3.4/',
'3.3' => '../3.3/',
'3.2' => '../3.2/',
'3.1' => '../3.1/',
'3.0' => '../3.0/',
'2.10' => '../2.10/',
'2.9' => '../2.9/',
'2.8' => '../2.8/',
'2.7' => '../2.7/',
'2.6' => '../2.6/',
'2.5' => '../2.5/',
'2.4' => '../2.4/',
'2.3' => '../2.3/',
'2.2' => '../2.2/',
'2.1' => '../2.1/',
'2.0' => '../2.0/',
'1.3' => '../1.3/',
'1.2' => '../1.2/',
],
],
],
];
4 changes: 2 additions & 2 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ server {
index index.html index.;
server_name _;

location ~ "^/([345]\.\d+)/.*\.html$" {
location ~ "^/([3456]\.\d+)/.*\.html$" {
try_files $uri @overview;
}

Expand All @@ -14,7 +14,7 @@ server {
}

location @overview {
rewrite "^/([345]\.\d+)/.*$" /$1/ redirect;
rewrite "^/([3456]\.\d+)/.*$" /$1/ redirect;
rewrite "^/4\.next/.*$" /$1/ redirect;
return 404;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
use PhpParser\Node\Const_;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Param;
use PhpParser\Node\PropertyItem;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassConst;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Interface_;
use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\PropertyProperty;
use PhpParser\Node\Stmt\Trait_;
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode;
Expand Down Expand Up @@ -181,13 +181,13 @@ protected function createConstant(
/**
* @param \Cake\ApiDocs\Reflection\ReflectedClassLike $classLike Reflected classLike
* @param \PhpParser\Node\Stmt\Property $classNode Property node
* @param \PhpParser\Node\Stmt\PropertyProperty $propNode Property node
* @param \PhpParser\Node\PropertyItem $propNode Property node
* @return \Cake\ApiDocs\Reflection\ReflectedDefine
*/
protected function createProperty(
ReflectedClassLike $classLike,
Property $classNode,
PropertyProperty $propNode
PropertyItem $propNode
): ReflectedProperty {
$doc = new DocBlock($classNode->getDocComment()?->getText());
$source = new Source(
Expand Down
6 changes: 3 additions & 3 deletions src/FileVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Trait_;
use PhpParser\Node\Stmt\Use_;
use PhpParser\Node\Stmt\UseUse;
use PhpParser\Node\UseItem;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitorAbstract;

Expand Down Expand Up @@ -183,11 +183,11 @@ public function leaveNode(Node $node)
}

/**
* @param \PhpParser\Node\Stmt\UseUse $use Use node
* @param \PhpParser\Node\UseItem $use Use node
* @param string|null $prefix Group use prefix
* @return array<string, string>
*/
protected function normalizeUse(UseUse $use, ?string $prefix = null): array
protected function normalizeUse(UseItem $use, ?string $prefix = null): array
{
$name = (string)$use->name;
if ($prefix) {
Expand Down
9 changes: 7 additions & 2 deletions src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use PhpParser\NodeTraverser;
use PhpParser\Parser;
use PhpParser\ParserFactory;
use PhpParser\PhpVersion;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;

Expand All @@ -37,11 +38,15 @@ class Loader

/**
* @param string $projectPath Project path
* @param string|null $phpVersion PHP syntax version, or null for the newest supported version
*/
public function __construct(string $projectPath)
public function __construct(string $projectPath, ?string $phpVersion = null)
{
$this->projectPath = $projectPath;
$this->parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
$factory = new ParserFactory();
$this->parser = $phpVersion === null
? $factory->createForNewestSupportedVersion()
: $factory->createForVersion(PhpVersion::fromString($phpVersion));
}

/**
Expand Down
Loading
Loading