Add development tools
This commit is contained in:
parent
ce210cd99b
commit
ed679b4685
|
@ -0,0 +1,121 @@
|
||||||
|
###
|
||||||
|
# https://github.com/gitattributes/gitattributes/blob/master/Common.gitattributes
|
||||||
|
###
|
||||||
|
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
#
|
||||||
|
# The above will handle all files NOT found below
|
||||||
|
#
|
||||||
|
|
||||||
|
# Documents
|
||||||
|
*.bibtex text diff=bibtex
|
||||||
|
*.doc diff=astextplain
|
||||||
|
*.DOC diff=astextplain
|
||||||
|
*.docx diff=astextplain
|
||||||
|
*.DOCX diff=astextplain
|
||||||
|
*.dot diff=astextplain
|
||||||
|
*.DOT diff=astextplain
|
||||||
|
*.pdf diff=astextplain
|
||||||
|
*.PDF diff=astextplain
|
||||||
|
*.rtf diff=astextplain
|
||||||
|
*.RTF diff=astextplain
|
||||||
|
*.md text diff=markdown
|
||||||
|
*.mdx text diff=markdown
|
||||||
|
*.tex text diff=tex
|
||||||
|
*.adoc text
|
||||||
|
*.textile text
|
||||||
|
*.mustache text
|
||||||
|
*.csv text eol=crlf
|
||||||
|
*.tab text
|
||||||
|
*.tsv text
|
||||||
|
*.txt text
|
||||||
|
*.sql text
|
||||||
|
*.epub diff=astextplain
|
||||||
|
|
||||||
|
# Graphics
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.jpeg binary
|
||||||
|
*.gif binary
|
||||||
|
*.tif binary
|
||||||
|
*.tiff binary
|
||||||
|
*.ico binary
|
||||||
|
# SVG treated as text by default.
|
||||||
|
*.svg text
|
||||||
|
# If you want to treat it as binary,
|
||||||
|
# use the following line instead.
|
||||||
|
# *.svg binary
|
||||||
|
*.eps binary
|
||||||
|
|
||||||
|
# Scripts
|
||||||
|
*.bash text eol=lf
|
||||||
|
*.fish text eol=lf
|
||||||
|
*.ksh text eol=lf
|
||||||
|
*.sh text eol=lf
|
||||||
|
*.zsh text eol=lf
|
||||||
|
# These are explicitly windows files and should use crlf
|
||||||
|
*.bat text eol=crlf
|
||||||
|
*.cmd text eol=crlf
|
||||||
|
*.ps1 text eol=crlf
|
||||||
|
|
||||||
|
# Serialisation
|
||||||
|
*.json text
|
||||||
|
*.toml text
|
||||||
|
*.xml text
|
||||||
|
*.yaml text
|
||||||
|
*.yml text
|
||||||
|
|
||||||
|
# Archives
|
||||||
|
*.7z binary
|
||||||
|
*.gz binary
|
||||||
|
*.tar binary
|
||||||
|
*.tgz binary
|
||||||
|
*.zip binary
|
||||||
|
|
||||||
|
# Text files where line endings should be preserved
|
||||||
|
*.patch -text
|
||||||
|
|
||||||
|
#
|
||||||
|
# Exclude files from exporting
|
||||||
|
#
|
||||||
|
|
||||||
|
.gitattributes export-ignore
|
||||||
|
.gitignore export-ignore
|
||||||
|
.gitkeep export-ignore
|
||||||
|
|
||||||
|
###
|
||||||
|
# https://github.com/gitattributes/gitattributes/blob/master/PHP.gitattributes
|
||||||
|
###
|
||||||
|
|
||||||
|
# PHP files
|
||||||
|
*.php text eol=lf diff=php
|
||||||
|
*.phpt text eol=lf diff=php
|
||||||
|
*.phtml text eol=lf diff=html
|
||||||
|
*.twig text eol=lf
|
||||||
|
*.phar binary
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
phpcs.xml text eol=lf
|
||||||
|
phpunit.xml text eol=lf
|
||||||
|
phpstan.neon text eol=lf
|
||||||
|
psalm.xml text eol=lf
|
||||||
|
|
||||||
|
###
|
||||||
|
# Open Culture Consulting custom additions
|
||||||
|
###
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
.editorconfig text eol=lf
|
||||||
|
*.dist.xml text eol=lf
|
||||||
|
*.xml.dist text eol=lf
|
||||||
|
*.neon text eol=lf
|
||||||
|
|
||||||
|
# Generated documentation
|
||||||
|
doc/* linguist-generated=true
|
||||||
|
|
||||||
|
# Exclude files from exporting
|
||||||
|
.github/* export-ignore
|
||||||
|
.phpdoc/* export-ignore
|
||||||
|
phpdoc.dist.xml export-ignore
|
|
@ -1,7 +1,13 @@
|
||||||
|
/.phpdoc/cache/
|
||||||
/.vscode/
|
/.vscode/
|
||||||
/config/config.yml
|
/config/config.yml
|
||||||
/data/
|
/data/
|
||||||
/var/
|
/var/
|
||||||
/vendor/
|
/vendor/
|
||||||
|
.php-cs-fixer.cache
|
||||||
.php-cs-fixer.php
|
.php-cs-fixer.php
|
||||||
|
phpcs.xml
|
||||||
|
phpdoc.xml
|
||||||
phpstan.neon
|
phpstan.neon
|
||||||
|
psalm.xml
|
||||||
|
TODO
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Useful PHP Basics
|
* PHP Basics
|
||||||
* Copyright (C) 2024 Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
* Copyright (C) 2024 Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -24,15 +24,15 @@ namespace PhpCsFixer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration for PHP-CS-Fixer.
|
* Configuration for PHP-CS-Fixer.
|
||||||
|
*
|
||||||
* @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst
|
* @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst
|
||||||
*
|
*
|
||||||
* @return ConfigInterface
|
* @return ConfigInterface
|
||||||
*/
|
*/
|
||||||
return (new Config())
|
$config = new Config();
|
||||||
|
$finder = new Finder();
|
||||||
|
|
||||||
|
return $config
|
||||||
->setRiskyAllowed(true)
|
->setRiskyAllowed(true)
|
||||||
->setRules([
|
->setRules(['@PSR12' => true])
|
||||||
'@PSR12' => true,
|
->setFinder($finder->in([__DIR__ . '/src']));
|
||||||
])
|
|
||||||
->setFinder(
|
|
||||||
(new Finder())->in(__DIR__)
|
|
||||||
);
|
|
||||||
|
|
|
@ -42,15 +42,23 @@
|
||||||
"symfony/yaml": "^6.4"
|
"symfony/yaml": "^6.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"phpdocumentor/shim": "^3.5",
|
||||||
"phpstan/phpstan": "^1.10",
|
"phpstan/phpstan": "^1.10",
|
||||||
"phpstan/phpstan-strict-rules": "^1.5",
|
"phpstan/phpstan-strict-rules": "^1.5",
|
||||||
"friendsofphp/php-cs-fixer": "^3.48"
|
"friendsofphp/php-cs-fixer": "^3.48",
|
||||||
|
"squizlabs/php_codesniffer": "^3.10",
|
||||||
|
"vimeo/psalm": "^5.25"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"OCC\\OaiPmh2\\": "src/"
|
"OCC\\OaiPmh2\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"config": {
|
||||||
|
"allow-plugins": {
|
||||||
|
"phpdocumentor/shim": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-install-cmd": [
|
"pre-install-cmd": [
|
||||||
"@php -r \"!is_dir('./data') && mkdir('./data', 0775);\"",
|
"@php -r \"!is_dir('./data') && mkdir('./data', 0775);\"",
|
||||||
|
@ -71,10 +79,34 @@
|
||||||
"doctrine:initialize-database": [
|
"doctrine:initialize-database": [
|
||||||
"@php bin/cli orm:schema-tool:update --complete --force",
|
"@php bin/cli orm:schema-tool:update --complete --force",
|
||||||
"@php bin/cli oai:formats:update --quiet"
|
"@php bin/cli oai:formats:update --quiet"
|
||||||
|
],
|
||||||
|
"php-cs-fixer:check": [
|
||||||
|
"@php vendor/bin/php-cs-fixer check"
|
||||||
|
],
|
||||||
|
"php-cs-fixer:fix": [
|
||||||
|
"@php vendor/bin/php-cs-fixer fix"
|
||||||
|
],
|
||||||
|
"phpcs:check": [
|
||||||
|
"@php vendor/bin/phpcs"
|
||||||
|
],
|
||||||
|
"phpdoc:build": [
|
||||||
|
"@php vendor/bin/phpdoc"
|
||||||
|
],
|
||||||
|
"phpstan:check": [
|
||||||
|
"@php vendor/bin/phpstan"
|
||||||
|
],
|
||||||
|
"psalm:check": [
|
||||||
|
"@php vendor/bin/psalm"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts-descriptions": {
|
"scripts-descriptions": {
|
||||||
"doctrine:clear-cache": "Clears the Doctrine/ORM metadata, query and result caches",
|
"doctrine:clear-cache": "Clears the Doctrine/ORM metadata, query and result caches",
|
||||||
"doctrine:initialize-database": "Initializes a new database (NOT RECOMMENDED IN PRODUCTION!)"
|
"doctrine:initialize-database": "Initializes a new database (NOT RECOMMENDED IN PRODUCTION!)",
|
||||||
|
"php-cs-fixer:check": "Runs a code check with PHP Coding Standards Fixer and reports problems. If a custom configuration file '.php-cs-fixer.php' exists, it will be used instead of the default settings in '.php-cs-fixer.dist.php'.",
|
||||||
|
"php-cs-fixer:fix": "Runs a code check with PHP Coding Standards Fixer and tries to fix all issues. If a custom configuration file '.php-cs-fixer.php' exists, it will be used instead of the default settings in '.php-cs-fixer.dist.php'.",
|
||||||
|
"phpcs:check": "Runs a code check with PHP_CodeSniffer and reports problems. If a custom configuration file '.phpcs.xml' exists, it will be used instead of the default settings in '.phpcs.xml.dist'.",
|
||||||
|
"phpdoc:build": "Builds the documentation from source files in ./src and additional templates in .phpdoc/. If a custom configuration file 'phpdoc.xml' exists, it will be used instead of the default settings in 'phpdoc.dist.xml'.",
|
||||||
|
"phpstan:check": "Runs a code check with PHPStan static code analyzer and reports problems. If a custom configuration file 'phpstan.neon' exists, it will be used instead of the default settings in 'phpstan.dist.neon'.",
|
||||||
|
"psalm:check": "Runs a code check with Psalm static code analyzer and reports problems. If a custom configuration file 'psalm.xml' exists, it will be used instead of the default settings in 'psalm.xml.dist'."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="OCC Standard Ruleset">
|
||||||
|
<description>Open Culture Consulting strictly follows PSR standards.</description>
|
||||||
|
<file>./src</file>
|
||||||
|
<arg name="extensions" value="php"/>
|
||||||
|
<rule ref="PSR12">
|
||||||
|
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
|
||||||
|
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<phpdocumentor
|
||||||
|
configVersion="3"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="https://www.phpdoc.org"
|
||||||
|
xsi:schemaLocation="https://www.phpdoc.org https://raw.githubusercontent.com/phpDocumentor/phpDocumentor/master/data/xsd/phpdoc.xsd">
|
||||||
|
<title>OAI-PMH2 Data Provider</title>
|
||||||
|
<paths>
|
||||||
|
<output>doc</output>
|
||||||
|
<cache>.phpdoc/cache</cache>
|
||||||
|
</paths>
|
||||||
|
<version number="latest">
|
||||||
|
<api format="php">
|
||||||
|
<source dsn=".">
|
||||||
|
<path>/src</path>
|
||||||
|
</source>
|
||||||
|
<extensions>
|
||||||
|
<extension>php</extension>
|
||||||
|
</extensions>
|
||||||
|
<default-package-name>OAIPMH2</default-package-name>
|
||||||
|
<include-source>true</include-source>
|
||||||
|
<ignore-tags>
|
||||||
|
<ignore-tag>extends</ignore-tag>
|
||||||
|
<ignore-tag>implements</ignore-tag>
|
||||||
|
<ignore-tag>phpstan-require-implements</ignore-tag>
|
||||||
|
<ignore-tag>psalm-suppress</ignore-tag>
|
||||||
|
</ignore-tags>
|
||||||
|
</api>
|
||||||
|
<guide format="rst">
|
||||||
|
<source dsn=".">
|
||||||
|
<path>/.phpdoc/guide</path>
|
||||||
|
</source>
|
||||||
|
<output>guides</output>
|
||||||
|
</guide>
|
||||||
|
</version>
|
||||||
|
<setting name="graphs.enabled" value="false"/>
|
||||||
|
<setting name="guides.enabled" value="true"/>
|
||||||
|
<setting name="template.color" value="orange"/>
|
||||||
|
</phpdocumentor>
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<psalm
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
|
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||||
|
errorLevel="1"
|
||||||
|
resolveFromConfigFile="true"
|
||||||
|
findUnusedBaselineEntry="true"
|
||||||
|
findUnusedCode="true"
|
||||||
|
findUnusedVariablesAndParams="true"
|
||||||
|
>
|
||||||
|
<issueHandlers>
|
||||||
|
<RedundantCastGivenDocblockType errorLevel="suppress"/>
|
||||||
|
<RedundantConditionGivenDocblockType errorLevel="suppress"/>
|
||||||
|
<RedundantFunctionCallGivenDocblockType errorLevel="suppress"/>
|
||||||
|
</issueHandlers>
|
||||||
|
<projectFiles>
|
||||||
|
<directory name="src"/>
|
||||||
|
<ignoreFiles>
|
||||||
|
<directory name="vendor"/>
|
||||||
|
</ignoreFiles>
|
||||||
|
</projectFiles>
|
||||||
|
</psalm>
|
Loading…
Reference in New Issue