Skip to content

Commit

Permalink
PHPStan max level
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Nov 16, 2021
1 parent 1121c17 commit 75f6656
Show file tree
Hide file tree
Showing 340 changed files with 4,924 additions and 2,969 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
@@ -0,0 +1,3 @@
docs/* linguist-vendored
packages/skeleton/var/* linguist-vendored
packages/skeleton/media/* linguist-vendored
48 changes: 41 additions & 7 deletions .github/workflows/psalm.yml
@@ -1,12 +1,42 @@
name: Psalm
name: 'Static Code Analysis'

on:
push:
paths:
- '**.php'
- 'psalm.xml.dist'
on: [push, pull_request]

jobs:
phpstan:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [7.4, 8.0]
stability: [prefer-stable] #prefer-lowest,

name: PHPStan - P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v1
with:
dependency-versions: highest
composer-options: --prefer-dist --${{ matrix.stability }} --no-interaction

- name: Build container
run: cd packages/skeleton && php ./bin/console cache:clear

- name: PHPStan
run: vendor/bin/phpstan --memory-limit=1G analyse --error-format=github --debug

psalm:
name: psalm
runs-on: ubuntu-latest
Expand All @@ -16,7 +46,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: "7.4"
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

Expand All @@ -29,8 +59,12 @@ jobs:
- name: Run composer install
run: composer install -n --prefer-dist

- name: Build container
run: cd packages/skeleton && php ./bin/console cache:clear

- name: Run psalm
run: ./vendor/bin/psalm --output-format=github --shepherd

# uses: docker://vimeo/psalm-github-actions
# with:
# args: --shepherd
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -17,6 +17,7 @@ coverage
coverage.xml
/debug
/drivers
.vs-code

# Future packages
related-pages
Expand All @@ -34,4 +35,4 @@ bootstrap5-theme
!**/skeleton/var/app.db*
!.gitkeep

Draft.md
Draft.md
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Expand Up @@ -39,6 +39,8 @@
'keep_multiple_spaces_after_comma' => true,
],
'single_trait_insert_per_statement' => true,
'modernize_types_casting' => false, // PHPStan...*
'phpdoc_to_comment' => false, // see here to add use to structural element https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/402b34d4ab33146eaab0f17d60c928eaa7e332b9/src/Tokenizer/Analyzer/CommentsAnalyzer.php#L155
])
->setRiskyAllowed(true)
->setFinder($finder);
14 changes: 11 additions & 3 deletions .scripts/data-preserve
@@ -1,6 +1,14 @@
#!/bin/sh
#!/bin/bash -e

cd packages/skeleton
if [ "$1" != "no-docs" ]; then
echo 'preserve docs'
cp -r docs docs~preserve
fi

cd packages/skeleton
cp var/app.db var/app.db~
cp -r media media~preserve
cp -r media media~preserve

if [ -e '/tmp/com.github.pushword.pushword/tests/var/dev/cache' ]; then
cp -r '/tmp/com.github.pushword.pushword/tests/var/dev/cache' '/tmp/com.github.pushword.pushword/tests/var/dev/cache~'
fi
13 changes: 12 additions & 1 deletion .scripts/data-restore
@@ -1,4 +1,10 @@
#!/bin/sh
#!/bin/bash -e

if [ "$1" != "no-docs" ]; then
rm -rf docs
cp -r docs~preserve docs
rm -rf docs~preserve
fi

cd packages/skeleton

Expand All @@ -8,3 +14,8 @@ rm var/app.db~
rm -rf media
cp -r media~preserve media
rm -rf media~preserve

if [ -e '/tmp/com.github.pushword.pushword/tests/var/dev/cache~' ]; then
cp -r '/tmp/com.github.pushword.pushword/tests/var/dev/cache~' '/tmp/com.github.pushword.pushword/tests/var/dev/cache'
rm -rf '/tmp/com.github.pushword.pushword/tests/var/dev/cache~'
fi
7 changes: 5 additions & 2 deletions .scripts/generate-docs
@@ -1,18 +1,21 @@
#!/bin/bash -e

#composer reset-skeleton

function restoreData {
echo "restore data..."
if [[ $CURRENT_DIR = 'packages/skeleton' ]]
then
cd ../../
fi
sh ./.scripts/data-restore
bash ./.scripts/data-restore no-docs
}
trap restoreData EXIT
sh ./.scripts/data-preserve
bash ./.scripts/data-preserve no-docs

php ./.scripts/generate-docs-assets


CURRENT_DIR='packages/skeleton'
cd packages/skeleton

Expand Down
4 changes: 2 additions & 2 deletions .scripts/reset-skeleton
@@ -1,8 +1,8 @@
#!/bin/bash -e

cd packages/skeleton
rm var/app.db
rm -rf media
rm var/app.db|| true
rm -rf media|| true
cp -r media~ media
php bin/console doctrine:schema:create -q
php bin/console doctrine:fixtures:load -q
Expand Down
22 changes: 17 additions & 5 deletions .scripts/test
@@ -1,14 +1,26 @@
#!/bin/bash -e

function restoreDataAndComposerDependencies {
echo 'restore data and dependencies...'
bash ./.scripts/data-restore
composer update
}

function restoreData {
echo 'restore data...'
sh ./.scripts/data-restore
composer update
bash ./.scripts/data-restore
}

trap restoreData EXIT
sh ./.scripts/data-preserve

XDEBUG_MODE=off php -dxdebug.mode=off vendor/bin/phpunit --stop-on-failure --debug
#XDEBUG_MODE=off php -dxdebug.mode=off
vendor/bin/phpunit --stop-on-failure
#--debug

composer update --prefer-lowest
XDEBUG_MODE=off php -dxdebug.mode=off vendor/bin/phpunit --stop-on-failure --debug
if [ "$1" = "full" ]
then
trap restoreDataAndComposerDependencies EXIT
composer update --prefer-lowest
XDEBUG_MODE=off php -dxdebug.mode=off vendor/bin/phpunit --stop-on-failure --debug
fi
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Pushword

A php **CMS** built on top of **Symfony** to **rapidly** create, manage and maintain **Modern Website(s)**.
A php **CMS** built as a **Symfony Bundle** to **rapidly** create, manage and maintain **Website(s)**.

[![Latest Version](https://img.shields.io/github/tag/pushword/pushword.svg?style=flat&label=release)](https://github.com/Pushword/Pushword/tags)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
Expand Down
23 changes: 18 additions & 5 deletions composer.json
Expand Up @@ -29,10 +29,13 @@
"miljar/php-exif": "^0.6.5",
"nette/utils": "^3.2",
"pagerfanta/twig": "^3.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"piedweb/facebook-scraper": "^0.0.74",
"piedweb/linksimprover": "^0.0.8",
"piedweb/render-html-attributes": "^2.0.1",
"piedweb/url-harvester": "^0.0.28",
"piedweb/url-harvester": "^0.0.31",
"sensio/framework-extra-bundle": "^6.1",
"sonata-project/admin-bundle": "^4.0",
"sonata-project/doctrine-orm-admin-bundle": "^4.0",
Expand All @@ -58,17 +61,24 @@
"symfony/web-link": "^5.2",
"symfony/webpack-encore-bundle": "^1.8",
"symfony/yaml": "^5.2",
"thecodingmachine/safe": "^1.3",
"twig/intl-extra": "^3.2",
"vich/uploader-bundle": "^1.16",
"villfa/invert-color": "^0.5",
"wyrihaximus/html-compress": "^4.1"
},
"require-dev": {
"composer/composer": "^2.0",
"friendsofphp/php-cs-fixer": "^3.0",
"friendsofphp/php-cs-fixer": "^3.2",
"friendsoftwig/twigcs": "^5.0",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^9.5",
"psalm/plugin-symfony": "^3.0",
"rector/rector": "^0.12.1",
"squizlabs/php_codesniffer": "^3.5",
"symfony/debug": "^4.4",
"symfony/dotenv": "^5.2",
"symfony/maker-bundle": "^1.26",
"symfony/panther": "^1.0",
Expand All @@ -77,7 +87,8 @@
"symfony/test-pack": "^1.0",
"symplify/monorepo-builder": "^9.0",
"symplify/vendor-patches": "^9.0",
"vimeo/psalm": "^4"
"vimeo/psalm": "^4",
"weirdan/doctrine-psalm-plugin": "^2.0"
},
"extra": {
"branch-alias": {
Expand Down Expand Up @@ -121,14 +132,16 @@
}
},
"scripts": {
"console": "cd packages/skeleton && php bin/console $2",
"dev": "cd packages/skeleton && symfony server:start -d",
"psalm": "vendor/bin/psalm --no-suggestions",
"stan": "vendor/bin/phpstan analyze packages/*/src",
"psalm": "vendor/bin/psalm --no-suggestions --no-cache",
"test": "./.scripts/test",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage",
"format": "vendor/bin/php-cs-fixer fix",
"assets": "./.scripts/generate-assets",
"publish-js-helper": "cd packages/js-helper && npm version patch && cd ../../ && git add packages/js-helper/. && git commit -m 'update pushword/js-helper version' && git push && cd packages/js-helper && npm publish",
"generate-docs": "./.scripts/generate-docs",
"docs": "./.scripts/generate-docs",
"reset-skeleton": "./.scripts/reset-skeleton"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=UTF-8><meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name=viewport><link href=/assets/favicons/apple-touch-icon.png rel=apple-touch-icon sizes=180x180><link href=/assets/favicons/favicon-32x32.png rel=icon sizes=32x32 type=image/png><link href=/assets/favicons/favicon-16x16.png rel=icon sizes=16x16 type=image/png><link href=/assets/favicons/site.webmanifest rel=manifest><link color=#000000 href=/assets/favicons/safari-pinned-tab.svg rel=mask-icon><link href=/assets/favicons/favicon.ico rel="shortcut icon"><meta content=Pushword name=apple-mobile-web-app-title><meta content=Pushword name=application-name><meta content=#fff name=msapplication-TileColor><meta content=/assets/favicons/browserconfig.xml name=msapplication-config><meta content=#fff name=theme-color><title>Oops! Une erreur...</title><link href=/assets/tw.min.css?7dcbae0e0 rel=stylesheet><style>:root{--primary:#ef8206;--secondary:#d97706;--font-family:Inter var,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}</style><style>.nojs{display:block}</style><script>document.head.insertAdjacentHTML('beforeend','<style>.nojs{display:none !important}<\/style>')</script><link href=https://pushword.piedweb.com/feed.xml rel=alternate title="Pushword &raquo; Flux" type=application/rss+xml> <body><div class="container mt-5 mx-auto"><h1>Oops! Une erreur...</h1> <p> <p>Un écrou semble s'être dévisser.<br>Merci de nous informer sur votre environnement lorsque cette erreur c'est produite.<br><br><a class="btn btn-secondary" href=/>Retour</a></div> <script async src=/assets/app.min.js?90191a294></script>
<!DOCTYPE html><html><head><meta charset=UTF-8><meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name=viewport><link href=/assets/favicons/apple-touch-icon.png rel=apple-touch-icon sizes=180x180><link href=/assets/favicons/favicon-32x32.png rel=icon sizes=32x32 type=image/png><link href=/assets/favicons/favicon-16x16.png rel=icon sizes=16x16 type=image/png><link href=/assets/favicons/site.webmanifest rel=manifest><link color=#000000 href=/assets/favicons/safari-pinned-tab.svg rel=mask-icon><link href=/assets/favicons/favicon.ico rel="shortcut icon"><meta content=Pushword name=apple-mobile-web-app-title><meta content=Pushword name=application-name><meta content=#fff name=msapplication-TileColor><meta content=/assets/favicons/browserconfig.xml name=msapplication-config><meta content=#fff name=theme-color><title>Oops! Une erreur...</title><link href=/assets/tw.min.css?27d526267 rel=stylesheet><style>:root{--primary:#ef8206;--secondary:#d97706;--font-family:Inter var,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}</style><style>.nojs{display:block}</style><script>document.head.insertAdjacentHTML('beforeend','<style>.nojs{display:none !important}<\/style>')</script><link href=https://pushword.piedweb.com/feed.xml rel=alternate title="Pushword &raquo; Flux" type=application/rss+xml> <body><div class="container mt-5 mx-auto"><h1>Oops! Une erreur...</h1> <p> <p>Un écrou semble s'être dévisser.<br>Merci de nous informer sur votre environnement lorsque cette erreur c'est produite.<br><br><a class="btn btn-secondary" href=/>Retour</a></div> <script async src=/assets/app.min.js?b55ec7a03></script>
2 changes: 1 addition & 1 deletion docs/architecture.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/assets/app.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/tw.min.css

Large diffs are not rendered by default.

0 comments on commit 75f6656

Please sign in to comment.