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
11 changes: 8 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,17 @@ jobs:
name: tools
path: tools

- name: Set tools as an executable
run: find tools -type f -print0 | xargs -0 chmod +x

- name: Run lint
env:
PSALM_SHEPHERD: 1
# TODO: Remove it when psalm no longer tries to create a cache directory
# https://github.com/vimeo/psalm/issues/4267
XDG_CACHE_HOME: /tmp
run: composer lint

- name: Run bug analysis
run: composer findbugs

- name: Run unit tests
env:
XDEBUG_MODE: coverage
Expand Down
37 changes: 31 additions & 6 deletions .laradock/env-development
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ SHELL_OH_MY_ZSH_ALIASES=false

WORKSPACE_BASE_IMAGE_TAG_PREFIX=latest
WORKSPACE_COMPOSER_GLOBAL_INSTALL=true
WORKSPACE_COMPOSER_VERSION=2
WORKSPACE_COMPOSER_AUTH=false
WORKSPACE_COMPOSER_REPO_PACKAGIST=
WORKSPACE_NVM_NODEJS_ORG_MIRROR=
Expand All @@ -122,6 +123,7 @@ WORKSPACE_INSTALL_WORKSPACE_SSH=false
WORKSPACE_INSTALL_SUBVERSION=false
WORKSPACE_INSTALL_BZ2=false
WORKSPACE_INSTALL_GMP=false
WORKSPACE_INSTALL_GNUPG=false
WORKSPACE_INSTALL_XDEBUG=true
WORKSPACE_INSTALL_PCOV=false
WORKSPACE_INSTALL_PHPDBG=false
Expand All @@ -137,7 +139,7 @@ WORKSPACE_INSTALL_CASSANDRA=false
WORKSPACE_INSTALL_GEARMAN=false
WORKSPACE_INSTALL_MSSQL=false
WORKSPACE_INSTALL_DRUSH=false
WORKSPACE_DRUSH_VERSION=8.1.17
WORKSPACE_DRUSH_VERSION=8.4.6
WORKSPACE_INSTALL_DRUPAL_CONSOLE=false
WORKSPACE_INSTALL_WP_CLI=false
WORKSPACE_INSTALL_AEROSPIKE=false
Expand All @@ -146,7 +148,7 @@ WORKSPACE_INSTALL_V8JS=false
WORKSPACE_INSTALL_LARAVEL_ENVOY=false
WORKSPACE_INSTALL_LARAVEL_INSTALLER=false
WORKSPACE_INSTALL_DEPLOYER=false
WORKSPACE_INSTALL_PRESTISSIMO=true
WORKSPACE_INSTALL_PRESTISSIMO=false
WORKSPACE_INSTALL_LINUXBREW=false
WORKSPACE_INSTALL_MC=false
WORKSPACE_INSTALL_SYMFONY=false
Expand All @@ -156,6 +158,7 @@ WORKSPACE_INSTALL_POWERLINE=false
WORKSPACE_INSTALL_SUPERVISOR=false
WORKSPACE_INSTALL_IMAGE_OPTIMIZERS=false
WORKSPACE_INSTALL_IMAGEMAGICK=false
WORKSPACE_IMAGEMAGICK_VERSION=latest
WORKSPACE_INSTALL_TERRAFORM=false
WORKSPACE_INSTALL_DUSK_DEPS=false
WORKSPACE_INSTALL_PG_CLIENT=false
Expand All @@ -164,7 +167,7 @@ WORKSPACE_INSTALL_SWOOLE=false
WORKSPACE_INSTALL_TAINT=false
WORKSPACE_INSTALL_LIBPNG=false
WORKSPACE_INSTALL_GRAPHVIZ=false
WORKSPACE_INSTALL_IONCUBE=false
WORKSPACE_INSTALL_IONCUBE=false # PHP 8.0 is not supported yet. Reference: https://forum.ioncube.com/viewtopic.php?t=4592
WORKSPACE_INSTALL_MYSQL_CLIENT=false
WORKSPACE_INSTALL_PING=false
WORKSPACE_INSTALL_SSHPASS=false
Expand All @@ -184,7 +187,7 @@ WORKSPACE_INSTALL_AUDIOWAVEFORM=false
WORKSPACE_INSTALL_WKHTMLTOPDF=false
WORKSPACE_INSTALL_GNU_PARALLEL=false
WORKSPACE_INSTALL_AST=true
WORKSPACE_AST_VERSION=1.0.3
WORKSPACE_AST_VERSION=1.0.10
WORKSPACE_BROWSERSYNC_HOST_PORT=3000
WORKSPACE_BROWSERSYNC_UI_HOST_PORT=3001
WORKSPACE_VUE_CLI_SERVE_HOST_PORT=8080
Expand All @@ -194,6 +197,7 @@ WORKSPACE_INSTALL_GIT_PROMPT=false
WORKSPACE_INSTALL_DOCKER_CLIENT=false
WORKSPACE_INSTALL_LNAV=false
WORKSPACE_INSTALL_PROTOC=false
WORKSPACE_INSTALL_PHPDECIMAL=false
WORKSPACE_PROTOC_VERSION=latest

### PHP_FPM ###############################################
Expand All @@ -203,12 +207,14 @@ PHP_FPM_INSTALL_BCMATH=true
PHP_FPM_INSTALL_MYSQLI=true
PHP_FPM_INSTALL_INTL=true
PHP_FPM_INSTALL_IMAGEMAGICK=true
PHP_FPM_IMAGEMAGICK_VERSION=latest
PHP_FPM_INSTALL_OPCACHE=true
PHP_FPM_INSTALL_IMAGE_OPTIMIZERS=true
PHP_FPM_INSTALL_PHPREDIS=true
PHP_FPM_INSTALL_MEMCACHED=false
PHP_FPM_INSTALL_BZ2=false
PHP_FPM_INSTALL_GMP=false
PHP_FPM_INSTALL_GNUPG=false
PHP_FPM_INSTALL_XDEBUG=false
PHP_FPM_INSTALL_PCOV=false
PHP_FPM_INSTALL_XHPROF=false
Expand Down Expand Up @@ -237,7 +243,7 @@ PHP_FPM_INSTALL_POSTGIS=false
PHP_FPM_INSTALL_PCNTL=false
PHP_FPM_INSTALL_CALENDAR=false
PHP_FPM_INSTALL_FAKETIME=false
PHP_FPM_INSTALL_IONCUBE=false
PHP_FPM_INSTALL_IONCUBE=false # PHP 8.0 is not supported yet. Reference: https://forum.ioncube.com/viewtopic.php?t=4592
PHP_FPM_INSTALL_RDKAFKA=false
PHP_FPM_INSTALL_GETTEXT=false
PHP_FPM_INSTALL_XMLRPC=false
Expand All @@ -251,11 +257,13 @@ PHP_FPM_INSTALL_PING=false
PHP_FPM_INSTALL_SSHPASS=false
PHP_FPM_INSTALL_MAILPARSE=false
PHP_FPM_INSTALL_WKHTMLTOPDF=false
PHP_FPM_INSTALL_PHPDECIMAL=false
PHP_FPM_FFMPEG=false
PHP_FPM_AUDIOWAVEFORM=false
PHP_FPM_ADDITIONAL_LOCALES="en_US.UTF-8 es_ES.UTF-8 fr_FR.UTF-8"
PHP_FPM_INSTALL_DOCKER_CLIENT=false
PHP_FPM_DEFAULT_LOCALE=POSIX
PHP_FPM_XDEBUG_PORT=9003

PHP_FPM_PUID=1000
PHP_FPM_PGID=1000
Expand All @@ -271,8 +279,11 @@ PHP_FPM_NEW_RELIC_APP_NAME=app_name
PHP_WORKER_INSTALL_BZ2=false
PHP_WORKER_INSTALL_GD=false
PHP_WORKER_INSTALL_IMAGEMAGICK=false
PHP_WORKER_IMAGEMAGICK_VERSION=latest
PHP_WORKER_INSTALL_GMP=false
PHP_WORKER_INSTALL_GNUPG=false
PHP_WORKER_INSTALL_PGSQL=false
PHP_WORKER_INSTALL_MONGO=false
PHP_WORKER_INSTALL_BCMATH=false
# PHP_WORKER_INSTALL_OCI8 Does not work in php5.6 version
PHP_WORKER_INSTALL_OCI8=false
Expand Down Expand Up @@ -310,12 +321,15 @@ NGINX_SSL_PATH=./nginx/ssl/
LARAVEL_HORIZON_INSTALL_BZ2=false
LARAVEL_HORIZON_INSTALL_GD=false
LARAVEL_HORIZON_INSTALL_GMP=false
LARAVEL_HORIZON_INSTALL_GNUPG=false
LARAVEL_HORIZON_INSTALL_IMAGEMAGICK=false
LARAVEL_HORIZON_IMAGEMAGICK_VERSION=latest
LARAVEL_HORIZON_INSTALL_SOCKETS=false
LARAVEL_HORIZON_INSTALL_YAML=false
LARAVEL_HORIZON_INSTALL_ZIP_ARCHIVE=false
LARAVEL_HORIZON_INSTALL_PHPREDIS=true
LARAVEL_HORIZON_INSTALL_PHPREDIS=false
LARAVEL_HORIZON_INSTALL_MONGO=false
LARAVEL_HORIZON_INSTALL_CASSANDRA=false
LARAVEL_HORIZON_INSTALL_FFMPEG=false
LARAVEL_HORIZON_INSTALL_AUDIOWAVEFORM=false
LARAVEL_HORIZON_PGID=1000
Expand All @@ -327,10 +341,12 @@ APACHE_HOST_HTTP_PORT=80
APACHE_HOST_HTTPS_PORT=443
APACHE_HOST_LOG_PATH=./logs/apache2
APACHE_SITES_PATH=./apache2/sites
APACHE_SSL_PATH=./apache2/ssl
APACHE_PHP_UPSTREAM_CONTAINER=php-fpm
APACHE_PHP_UPSTREAM_PORT=9000
APACHE_PHP_UPSTREAM_TIMEOUT=60
APACHE_DOCUMENT_ROOT=/var/www/
APACHE_SSL_PATH=./apache2/ssl/
APACHE_INSTALL_HTTP2=false

### MYSQL #################################################
Expand Down Expand Up @@ -868,6 +884,15 @@ PGADMIN_PORT=5050
PGADMIN_DEFAULT_EMAIL=pgadmin4@pgadmin.org
PGADMIN_DEFAULT_PASSWORD=admin

### SWAGGER EDITOR ###########################################

SWAGGER_EDITOR_PORT=5151

### SWAGGER UI ###############################################

SWAGGER_API_URL=http://generator.swagger.io/api/swagger.json
SWAGGER_UI_PORT=5555

### SONARQUBE ################################################
## docker-compose up -d sonarqube
## (If you encounter a database error)
Expand Down
7 changes: 4 additions & 3 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-coveralls" version="^2.4.3" installed="2.4.3" location="./tools/php-coveralls" copy="false"/>
<phar name="php-cs-fixer" version="^2.18.2" installed="2.18.3" location="./tools/php-cs-fixer" copy="false"/>
<phar name="php-cs-fixer" version="^2.18.2" installed="2.18.4" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcbf" version="^3.5.8" installed="3.5.8" location="./tools/phpcbf" copy="false"/>
<phar name="phpcs" version="^3.5.8" installed="3.5.8" location="./tools/phpcs" copy="false"/>
<phar name="phpdocumentor" version="^3.0.0" installed="3.0.0" location="./tools/phpDocumentor" copy="false"/>
<phar name="phpstan" version="^0.12.64" installed="0.12.81" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^9.5.0" installed="9.5.3" location="./tools/phpunit" copy="false"/>
<phar name="phpstan" version="^0.12.64" installed="0.12.82" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^9.5.0" installed="9.5.4" location="./tools/phpunit" copy="false"/>
<phar name="psalm" version="^4.7.0" installed="4.7.0" location="./tools/psalm" copy="false"/>
</phive>
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ return PhpCsFixer\Config::create()
'inheritDoc' => 'inheritdoc',
],
],
'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true],
'native_constant_invocation' => true,
'native_function_invocation' => true,
'no_empty_phpdoc' => true,
Expand Down
11 changes: 7 additions & 4 deletions .vim/coc-settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"diagnostic-languageserver.linters": {
"ngmy.laradock.composer.lint": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-enum_workspace_1", "composer", "lint", "--", "--report=emacs"]
"ngmy.laradock.phive.phpcs": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-enum_workspace_1", "php", "tools/phpcs", "--report=emacs"]
},
"ngmy.laradock.composer.findbugs": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-enum_workspace_1", "composer", "findbugs", "--", "--error-format", "raw", "--no-progress"]
"ngmy.laradock.phive.phpstan": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-enum_workspace_1", "php", "tools/phpstan", "analyse", "--error-format", "raw", "--no-progress"]
},
"ngmy.laradock.phive.psalm": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-enum_workspace_1", "php", "tools/psalm", "--output-format=emacs", "--no-progress", "--no-cache"]
}
}
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
[![PHP CI](https://github.com/ngmy/php-typed-array/actions/workflows/php.yml/badge.svg)](https://github.com/ngmy/php-typed-array/actions/workflows/php.yml)
[![Coverage Status](https://coveralls.io/repos/github/ngmy/php-enum/badge.svg?branch=master)](https://coveralls.io/github/ngmy/php-enum?branch=master)
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)
[![Psalm Coverage](https://shepherd.dev/github/ngmy/php-typed-array/coverage.svg?)](https://shepherd.dev/github/ngmy/php-typed-array)
[![Psalm Level](https://shepherd.dev/github/ngmy/php-typed-array/level.svg?)](https://shepherd.dev/github/ngmy/php-typed-array)

PHP Enum is the enumeration type for PHP.

- Interface like the enum type of Java
- Also provides the enum map and set like Java
- Supports the static analysis like PHPStan. Please see [examples](docs/examples)
- Supports the static analysis like PHPStan and Psalm. Please see [examples](docs/examples)

```php
/**
Expand Down
40 changes: 30 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"require": {
"php": "^7.3|^8.0",
"ngmy/typed-array": "^0.8.0"
"ngmy/typed-array": "^0.11.0"
},
"autoload": {
"psr-4": {
Expand All @@ -39,20 +39,40 @@
"prefer-stable": true,
"scripts": {
"test": [
"@php tools/phpunit --colors=always"
"@phpunit"
],
"lint": [
"@php tools/phpcs"
],
"findbugs": [
"@php tools/phpstan analyse --ansi"
"@phpcs",
"@phpstan",
"@psalm"
],
"fmt": [
"@php tools/phpcbf | exit 0",
"@php tools/php-cs-fixer fix --ansi"
"@php-cs-fixer",
"@phpcbf"
],
"doc": [
"@phpdoc"
],
"php-cs-fixer": [
"tools/php-cs-fixer fix --ansi"
],
"phpcbf": [
"tools/phpcbf"
],
"phpcs": [
"tools/phpcs"
],
"phpdoc": [
"tools/phpDocumentor --force"
],
"phpstan": [
"tools/phpstan analyse --ansi"
],
"phpunit": [
"tools/phpunit --colors=always"
],
"docs": [
"@php tools/phpDocumentor --force"
"psalm": [
"if [ \"${PSALM_SHEPHERD:-0}\" = '0' ]; then tools/psalm --no-cache; else tools/psalm --no-cache --shepherd; fi"
]
}
}
14 changes: 7 additions & 7 deletions composer.lock

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

Loading