Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: check guides #67

Open
wants to merge 69 commits into
base: docs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
ee78483
init docs
soyuka Dec 2, 2022
79c5034
init scripts
soyuka Dec 5, 2022
0d60dcc
docs: Add php documentation for validation
nitneuk Dec 5, 2022
289fc12
docs own source
soyuka Dec 16, 2022
63c9814
phpstan move to dev dep
soyuka Dec 16, 2022
70082a8
move guides => guide
soyuka Dec 16, 2022
4fd2276
fix(sidebar): missing EOL
JacquesDurand Dec 19, 2022
472de5d
feat: generate method references
JacquesDurand Dec 19, 2022
273059a
fix: correctly link return types
JacquesDurand Dec 20, 2022
80a5dd1
feat: generate all references
JacquesDurand Dec 20, 2022
6efeeca
temp
soyuka Dec 20, 2022
da19202
Merge remote-tracking branch 'jackie/feat/references-for-non-constuct…
soyuka Dec 20, 2022
04486d9
feat: generate references based on config patterns
JacquesDurand Dec 20, 2022
b85e732
feat: prevent internal classes to be referenced
JacquesDurand Dec 21, 2022
d9d61f6
fix: remove generated h2 for doc text node in methods
JacquesDurand Dec 21, 2022
33c7283
feat: do not document private methods
JacquesDurand Dec 21, 2022
edf2df7
feat: prevent reference generation for classes with only private methods
JacquesDurand Dec 21, 2022
63000c9
feat: prevent ref generation for external methods
JacquesDurand Dec 21, 2022
f0f10db
feat: beautify properties/method parameters
JacquesDurand Dec 21, 2022
bf9836a
feat: add basic constants generation
JacquesDurand Dec 22, 2022
ba8a209
feat: inheritdoc support for methods
JacquesDurand Dec 22, 2022
554a6cc
feat: ignore classes with configured tags
JacquesDurand Dec 22, 2022
42cfc83
fix: prevent skip of empty interfaces
JacquesDurand Dec 23, 2022
5357581
feat: show extensions and implementations
JacquesDurand Dec 23, 2022
fcc8874
fix: visual gap for properties anchors
JacquesDurand Dec 23, 2022
829c928
feat: add anchors on methods
JacquesDurand Dec 23, 2022
4b9572f
chore: add favicon
JacquesDurand Dec 23, 2022
c0c5b3f
feat: add page title
JacquesDurand Dec 23, 2022
47e4be4
Merge remote-tracking branch 'jackie/feat/references-for-non-constuct…
soyuka Dec 26, 2022
5c23965
more stuff wip
soyuka Dec 26, 2022
888835a
init skeleton
soyuka Dec 26, 2022
a5f456d
fix kernel
soyuka Dec 26, 2022
39b5524
guide and index command
soyuka Dec 27, 2022
11360ca
service di
soyuka Dec 27, 2022
9db3975
guide ok
soyuka Dec 27, 2022
c3b9a6c
chore: refacto reference generation
JacquesDurand Dec 27, 2022
febf05f
chore: refacto all references generation
JacquesDurand Dec 27, 2022
c77ebab
use frontmatter
soyuka Dec 28, 2022
e359cb8
move file also
soyuka Dec 28, 2022
8d29f6e
fix: use guard clauses
JacquesDurand Dec 28, 2022
7165950
fix: remove unnecessary file opening
JacquesDurand Dec 28, 2022
cade882
fix: remove automatic output generation
JacquesDurand Dec 28, 2022
8d6af83
fix: remove factory reference generation
JacquesDurand Dec 28, 2022
15f2441
feat: generate YML and XML config references
JacquesDurand Dec 28, 2022
5bca5c1
more guides
soyuka Jan 2, 2023
2d1a855
feat: generate YML and XML config references
JacquesDurand Dec 28, 2022
18164cd
fix: prevent doc of private properties w/o accessors
JacquesDurand Dec 29, 2022
0d0e1e5
fix: doc comment on property and not parameter
JacquesDurand Dec 29, 2022
7f01581
feat: print default value for properties
JacquesDurand Dec 29, 2022
76934e2
feat: handle default values for promoted properties
JacquesDurand Dec 30, 2022
ac9a606
chore: refacto services, add specialization
JacquesDurand Dec 30, 2022
6f368fd
chore: continue services refacto for reflection methods
JacquesDurand Dec 30, 2022
2049720
chore(output): place writing function in outputformatter
JacquesDurand Dec 30, 2022
bd84209
feat: handle nullable types (using ?)
JacquesDurand Dec 30, 2022
c1ab981
feat: better handling of default values
JacquesDurand Jan 2, 2023
0a93901
chore(command): simplify command names
JacquesDurand Jan 2, 2023
5bd5557
chore: remove now unused function
JacquesDurand Jan 2, 2023
4a3f1c9
chore: merge configuration generation with reference
JacquesDurand Jan 2, 2023
6a1f25a
chore(deps): remove redundant phpdoc-parser deps
JacquesDurand Jan 2, 2023
6a471b4
fix(config): keep original generation path
JacquesDurand Jan 2, 2023
fede3e9
Merge remote-tracking branch 'jackie/feat/configuration-example' into…
soyuka Jan 3, 2023
e01db49
Merge remote-tracking branch 'jackie/tests/services-unit-tests' into …
soyuka Jan 3, 2023
5869d00
more content
soyuka Jan 9, 2023
a361602
Add codeSelector block format (#59)
Byidi Jan 13, 2023
96f4410
Add `deprecationReason` reference (#58)
vincentchalamon Jan 13, 2023
41c8b08
feat: add mongodb tutorial (#61)
vincentchalamon Jan 13, 2023
309e06b
Add "user-entity" tutorial (#56)
vincentchalamon Jan 13, 2023
8392558
ci: check guides
Byidi Jan 16, 2023
573097b
fix-guides
Byidi Jan 17, 2023
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
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -728,3 +728,36 @@ jobs:
run: tests/Fixtures/app/console cache:clear --ansi
- name: Run Behat tests
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction

checkguide:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- '8.1'
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl, bcmath, curl, openssl, mbstring
ini-values: memory_limit=-1
tools: pecl, composer
coverage: none
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Update project dependencies
run: cd docs && composer update --no-interaction --no-progress --ansi
- name: Run check command
run: cd docs && make check
24 changes: 24 additions & 0 deletions docs/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=ab0da85135bd245202dd6c8de5b90aa9
###< symfony/framework-bundle ###

###> nelmio/cors-bundle ###
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
###< nelmio/cors-bundle ###
6 changes: 6 additions & 0 deletions docs/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
29 changes: 29 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
pages/guide/**/*.mdx
pages/reference/**/*.mdx
pages/tutorial/**/*.mdx
pages/sidebar.mdx
.next
node_modules
composer.lock
vendor
var

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
25 changes: 25 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.PHONY: guide index references clean

all: guide references index

guide:
for d in ./guide/*.php; do \
name=$$(basename $$d .php); \
./bin/pdg pdg:guide "$$d" > "pages/guide/$$name.mdx"; \
done

check:
for d in ./guide/*.php; do \
name=$$(basename $$d .php); \
./bin/pdg pdg:check:guide "$$d"; \
done

index:
./bin/pdg pdg:index > "pages/sidebar.mdx"

references:
./bin/pdg pdg:references

clean:
rm -r pages/reference/*
rm pages/guide/*.mdx
17 changes: 17 additions & 0 deletions docs/bin/pdg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php

use PDG\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context, string $guide = '') {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG'], $guide);

return new Application($kernel);
};
67 changes: 67 additions & 0 deletions docs/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "api-platform/pdg",
"description": "PHP Documentation Generator",
"authors": [
{
"name": "soyuka",
"email": "soyuka@users.noreply.github.com"
}
],
"autoload": {
"psr-4": {
"PDG\\": "src/",
"ApiPlatform\\": "../src"
},
"files": [
"src/Command/CheckGuideCommand.php",
"src/Command/PhpUnitCommand.php",
"src/Command/TestGuideCommand.php"
]
},
"require-dev": {
"symfony/dom-crawler": "^6.2",
"phpstan/phpdoc-parser": "^1.15",
"symfony/serializer": "^6.2",
"nikic/php-parser": "^4.15",
"dama/doctrine-test-bundle": "^7.1",
"justinrainbow/json-schema": "^5.2",
"phpunit/phpunit": "^9.5",
"symfony/browser-kit": "^6.2",
"symfony/css-selector": "^6.2",
"symfony/http-client": "^6.2",
"symfony/phpunit-bridge": "^6.2"
},
"require": {
"symfony/runtime": "^6.2",
"symfony/console": "^6.2",
"symfony/http-kernel": "^6.2",
"symfony/framework-bundle": "^6.2",
"spatie/yaml-front-matter": "^2.0",
"symfony/property-info": "^6.2",
"symfony/property-access": "^6.2",
"symfony/flex": "^2.2",
"nelmio/cors-bundle": "^2.2",
"symfony/security-bundle": "^6.2",
"willdurand/negotiation": "^3.1",
"symfony/twig-bundle": "^6.2",
"symfony/web-link": "^6.2",
"doctrine/annotations": "^2.0",
"doctrine/doctrine-bundle": "^2.8",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.14",
"doctrine/doctrine-fixtures-bundle": "^3.4",
"symfony/validator": "^6.2"
},
"config": {
"allow-plugins": {
"symfony/runtime": true,
"symfony/flex": true
}
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
}
}
13 changes: 13 additions & 0 deletions docs/config/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true],
];
10 changes: 10 additions & 0 deletions docs/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
api_platform:
formats:
json: [ 'application/json' ]
jsonld: [ 'application/ld+json' ]

# mapping:
# paths:
# - '%kernel.project_dir%/src'
# doctrine:
# enabled: true
19 changes: 19 additions & 0 deletions docs/config/packages/cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
framework:
cache:
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name

# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# Other options include:

# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost

# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu

# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: null
43 changes: 43 additions & 0 deletions docs/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
doctrine:
dbal:
url: '%database_url%'

# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '14'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
dir: '%kernel.project_dir%/src'
prefix: 'App\Entity'
alias: App

when@test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'

when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool

framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system
6 changes: 6 additions & 0 deletions docs/config/packages/doctrine_migrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
doctrine_migrations:
migrations_paths:
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/src'
enable_profiler: false
25 changes: 25 additions & 0 deletions docs/config/packages/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
http_method_override: false
handle_all_throwables: true

# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.native

#esi: true
#fragments: true
php_errors:
log: true

when@test:
framework:
test: true
session:
storage_factory_id: session.storage.factory.mock_file
10 changes: 10 additions & 0 deletions docs/config/packages/nelmio_cors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
expose_headers: ['Link']
max_age: 3600
paths:
'^/': null
12 changes: 12 additions & 0 deletions docs/config/packages/routing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
framework:
router:
utf8: true

# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost

when@prod:
framework:
router:
strict_requirements: null
39 changes: 39 additions & 0 deletions docs/config/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
users_in_memory: { memory: null }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
lazy: true
provider: users_in_memory

# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall

# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true

# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }

when@test:
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon
Loading