Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Sep 2, 2024
0 parents commit 183fc47
Show file tree
Hide file tree
Showing 32 changed files with 7,843 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.github/ export-ignore
/stubs/ export-ignore
/tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/composer.lock export-ignore
/infection.json.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml.dist export-ignore
96 changes: 96 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Check

on:
workflow_dispatch: ~
push:
branches: ['*.x']
pull_request: ~

jobs:
composer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
coverage: none
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
- run: composer validate
- run: composer normalize --dry-run
- run: composer check-require

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
coverage: none
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
- run: composer fixcs -- --dry-run --format=checkstyle

psalm:
runs-on: ubuntu-latest
strategy:
matrix:
dependency-versions: [lowest, highest]
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
coverage: none
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
dependency-versions: ${{ matrix.dependency-versions }}
- run: composer psalm -- --stats --output-format=github ${{ matrix.dependency-versions == 'lowest' && '--shepherd' || '' }}

test:
runs-on: ubuntu-latest
strategy:
matrix:
php: [8.1, 8.2, 8.3]
dependency-versions: [lowest, highest]
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-file: development
tools: composer:v2
coverage: ${{ matrix.php == '8.1' && matrix.dependency-versions == 'lowest' && 'pcov' || '' }}
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
dependency-versions: ${{ matrix.dependency-versions }}
- run: composer test -- --colors=always --coverage-clover coverage.xml
- if: ${{ matrix.php == '8.1' && matrix.dependency-versions == 'lowest' }}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

infection:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
ini-file: development
tools: composer:v2
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
- run: composer infection
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**/vendor/
/var/
/.php-cs-fixer.php
/phpstan.neon
/phpunit.xml
/psalm.xml
34 changes: 34 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
use PHPyh\CodingStandard\PhpCsFixerCodingStandard;

$config = (new Config())
->setFinder(
Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->append([
__FILE__,
]),
)
->setParallelConfig(ParallelConfigFactory::detect())
->setCacheFile(__DIR__ . '/var/' . basename(__FILE__) . '.cache');

(new PhpCsFixerCodingStandard())->applyTo($config, [
'final_public_method_for_abstract_class' => false,
'ordered_class_elements' => ['order' => ['use_trait']],
'class_attributes_separation' => ['elements' => [
'trait_import' => 'only_if_meta',
'const' => 'only_if_meta',
'case' => 'only_if_meta',
'property' => 'one',
'method' => 'one',
]],
]);

return $config;
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Typhoon Data Structures

## Installation

`composer require typhoon/data-structures`
69 changes: 69 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "typhoon/data-structures",
"description": "Typhoon Data Structures",
"license": "MIT",
"type": "project",
"authors": [
{
"name": "Valentin Udaltsov",
"email": "[email protected]"
},
{
"name": "Typhoon Team",
"homepage": "https://github.com/orgs/typhoon-php/people"
}
],
"require": {
"php": "^8.1"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"ergebnis/composer-normalize": "^2.43.0",
"friendsofphp/php-cs-fixer": "^3.62.0",
"infection/infection": "^0.29.6",
"phpstan/phpstan": "^1.11.9",
"phpunit/phpunit": "^10.5",
"phpyh/coding-standard": "^2.6.1",
"symfony/var-dumper": "^6.4.10 || ^7.1.3"
},
"autoload": {
"psr-4": {
"Typhoon\\DataStructures\\": "src/"
},
"files": [
"src/functions.php"
]
},
"autoload-dev": {
"psr-4": {
"Typhoon\\DataStructures\\": "tests/"
}
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"ergebnis/composer-normalize": true,
"infection/extension-installer": true
},
"lock": false,
"platform": {
"php": "8.1"
},
"sort-packages": true
},
"extra": {
"bamarni-bin": {
"bin-links": false,
"forward-command": true,
"target-directory": "tools"
}
},
"scripts": {
"check-require": "tools/composer-require-checker/vendor/bin/composer-require-checker",
"fixcs": "php-cs-fixer fix --diff",
"infection": "infection --show-mutations",
"pre-command-run": "mkdir -p var",
"psalm": "tools/psalm/vendor/bin/psalm --show-info --no-diff --no-cache",
"test": "phpunit"
}
}
19 changes: 19 additions & 0 deletions infection.json5.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "vendor/infection/infection/resources/schema.json",
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "var/infection.log",
"stryker": {
"report": "/^\\d+\\.\\d+\\.x$/"
},
},
"tmpDir": "var",
"minCoveredMsi": 99,
"mutators": {
"@default": true,
},
}
27 changes: 27 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory="var/phpunit"
requireCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="display_errors" value="1"/>
<ini name="error_reporting" value="-1"/>
</php>

<testsuites>
<testsuite name="main">
<directory>tests</directory>
</testsuite>
</testsuites>

<source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
85 changes: 85 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0"?>
<psalm
checkForThrowsDocblock="true"
checkForThrowsInGlobalScope="true"
disableSuppressAll="true"
ensureArrayStringOffsetsExist="true"
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="true"
findUnusedPsalmSuppress="true"
findUnusedVariablesAndParams="true"
memoizeMethodCallResults="true"
reportMixedIssues="true"
sealAllMethods="true"
sealAllProperties="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config tools/psalm/vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
<directory name="tests"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
<ignoreFiles allowMissingFiles="true">
<directory name="var"/>
</ignoreFiles>
</projectFiles>

<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
<!--<pluginClass class="Typhoon\Tools\Psalm\CheckVisibilityPlugin"/>-->
</plugins>

<ignoreExceptions>
<classAndDescendants name="ReflectionException"/>
<classAndDescendants name="LogicException"/>
<classAndDescendants name="RuntimeException"/>
</ignoreExceptions>

<issueHandlers>
<PluginIssue name="UnspecifiedVisibility">
<errorLevel type="suppress">
<directory name="tests"/>
</errorLevel>
</PluginIssue>
<MissingThrowsDocblock>
<errorLevel type="suppress">
<directory name="tests"/>
</errorLevel>
</MissingThrowsDocblock>
<MixedAssignment errorLevel="suppress"/>
<PossiblyUnusedMethod>
<errorLevel type="suppress">
<directory name="tests"/>
</errorLevel>
</PossiblyUnusedMethod>
<RedundantCondition>
<errorLevel type="suppress">
<directory name="tests"/>
</errorLevel>
</RedundantCondition>
<RedundantConditionGivenDocblockType>
<errorLevel type="suppress">
<directory name="tests"/>
</errorLevel>
</RedundantConditionGivenDocblockType>
<UnusedConstructor errorLevel="suppress"/>
</issueHandlers>

<forbiddenFunctions>
<function name="dd"/>
<function name="die"/>
<function name="dump"/>
<function name="echo"/>
<function name="empty"/>
<function name="eval"/>
<function name="exit"/>
<function name="print"/>
<function name="sleep"/>
<function name="usleep"/>
<function name="var_dump"/>
</forbiddenFunctions>
</psalm>
Loading

0 comments on commit 183fc47

Please sign in to comment.