Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ composer.phar
composer.lock
vagrant_ansible_inventory_default
Vagrantfile
.DS_Store
.DS_Store
/var/cache/rector
33 changes: 30 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
}
],
"require": {
"php": ">=5.5.9"
},
"php": ">=8.3"
},
"autoload": {
"psr-4": {
"Sentiment\\": "src/"
Expand All @@ -24,5 +24,32 @@
"psr-4": {
"Sentiment\\Tests\\": "tests/"
}
},
"require-dev": {
"rector/rector": "^2.1",
"phpstan/phpstan": "^2.1",
"pestphp/pest": "*",
"laravel/pint": "^1.25"
},
"scripts": {
"rector": "vendor/bin/rector process",
"rector-dry": "vendor/bin/rector process --dry-run",
"phpstan": "vendor/bin/phpstan analyse",
"phpstan-baseline": "vendor/bin/phpstan analyse --generate-baseline",
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage",
"pint": "vendor/bin/pint",
"pint-test": "vendor/bin/pint --test",
"ready": [
"@rector",
"@pint",
"@phpstan",
"@test"
]
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
}
6 changes: 6 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
level: 5
paths:
- src
tmpDir: var/cache/phpstan
reportUnmatchedIgnoredErrors: false
18 changes: 18 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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"
colors="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
<directory>src</directory>
</include>
</source>
</phpunit>
110 changes: 110 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"preset": "psr12",
"exclude": [
"vendor",
"var"
],
"rules": {
"array_syntax": {
"syntax": "short"
},
"binary_operator_spaces": {
"default": "single_space"
},
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"blank_line_before_statement": {
"statements": ["return"]
},
"braces": {
"allow_single_line_closure": true,
"position_after_functions_and_oop_constructs": "next",
"position_after_control_structures": "same",
"position_after_anonymous_constructs": "same"
},
"cast_spaces": {
"space": "single"
},
"class_attributes_separation": {
"elements": {
"method": "one"
}
},
"concat_space": {
"spacing": "none"
},
"declare_equal_normalize": true,
"function_typehint_space": true,
"single_line_comment_style": {
"comment_types": ["hash"]
},
"include": true,
"lowercase_cast": true,
"lowercase_static_reference": true,
"magic_constant_casing": true,
"method_argument_space": {
"on_multiline": "ensure_fully_multiline"
},
"method_chaining_indentation": true,
"no_blank_lines_after_class_opening": true,
"no_blank_lines_after_phpdoc": true,
"no_empty_phpdoc": true,
"no_empty_statement": true,
"no_extra_blank_lines": {
"tokens": [
"extra",
"throw",
"use"
]
},
"no_leading_import_slash": true,
"no_leading_namespace_whitespace": true,
"no_mixed_echo_print": true,
"no_multiline_whitespace_around_double_arrow": true,
"no_short_bool_cast": true,
"no_singleline_whitespace_before_semicolons": true,
"no_spaces_around_offset": true,
"no_trailing_comma_in_singleline": true,
"no_unneeded_control_parentheses": true,
"no_unneeded_curly_braces": true,
"no_unused_imports": true,
"no_whitespace_before_comma_in_array": true,
"no_whitespace_in_blank_line": true,
"normalize_index_brace": true,
"object_operator_without_whitespace": true,
"ordered_imports": {
"sort_algorithm": "alpha"
},
"php_unit_fqcn_annotation": true,
"phpdoc_align": {
"align": "vertical"
},
"phpdoc_annotation_without_dot": true,
"phpdoc_indent": true,
"phpdoc_inline_tag_normalizer": true,
"phpdoc_no_access": true,
"phpdoc_no_alias_tag": true,
"phpdoc_no_package": true,
"phpdoc_no_useless_inheritdoc": true,
"phpdoc_return_self_reference": true,
"phpdoc_scalar": true,
"phpdoc_single_line_var_spacing": true,
"phpdoc_trim": true,
"phpdoc_types": true,
"phpdoc_var_without_name": true,
"return_type_declaration": true,
"single_class_element_per_statement": true,
"single_import_per_statement": true,
"single_line_after_imports": true,
"single_quote": true,
"space_after_semicolon": {
"remove_in_empty_for_expressions": true
},
"standardize_not_equals": true,
"ternary_operator_spaces": true,
"trailing_comma_in_multiline": true,
"trim_array_spaces": true,
"unary_operator_spaces": true,
"whitespace_after_comma_in_array": true
}
}
31 changes: 31 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;

return RectorConfig::configure()
->withPaths([
__DIR__.'/src',
])
->withPhpSets(
php83: true
)
->withSets([
// Apply all PHP version upgrades up to PHP 8.3
LevelSetList::UP_TO_PHP_83,

// Code quality improvements
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::TYPE_DECLARATION,

// Modern PHP practices
SetList::PRIVATIZATION,
SetList::NAMING,
])
->withParallel()
->withCache(__DIR__.'/var/cache/rector');
Loading