Skip to content

Commit

Permalink
Merge pull request #42 from 2lenet/fixSymfonyInsightErrors
Browse files Browse the repository at this point in the history
Add dependencies to composer.json 2le/crudit#327
  • Loading branch information
valentin-helies authored Sep 6, 2023
2 parents b331ebb + 033cc96 commit 5954e19
Show file tree
Hide file tree
Showing 23 changed files with 5,488 additions and 5,402 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PHPStan

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
phpstan:
name: "PHPStan ${{ matrix.php-version }}"

runs-on: ubuntu-latest
strategy:
matrix:
php_version: [8.1]

steps:
- uses: actions/checkout@v2

- name: "Install dependencies with Composer"
uses: php-actions/composer@v5
with:
php_version: ${{ matrix.php_version }}
version: 2
args: --profile --ignore-platform-reqs

- name: 'PHPStan Static Analysis'
uses: php-actions/phpstan@v2
with:
configuration: tests/phpstan.neon
memory_limit: 256M
35 changes: 35 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: PHPUnit

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
phpunit:
name: "PHPUnit ${{ matrix.php-version }}"

runs-on: ubuntu-latest
strategy:
matrix:
php_version: [8.1]

steps:
- uses: actions/checkout@v2

- name: "Install dependencies with Composer"
uses: php-actions/composer@v5
with:
php_version: ${{ matrix.php_version }}
version: 2
args: --profile --ignore-platform-reqs

- name: "Run PHPUnit"
uses: php-actions/phpunit@v2
with:
php_version: ${{ matrix.php_version }}
php_extensions: xdebug
version: 10.3
configuration: tests/phpunit/phpunit.xml
bootstrap: vendor/autoload.php
41 changes: 41 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Validate

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
php-coding-standard:
name: "PHP Coding Standard ${{ matrix.php-version }}"

runs-on: ubuntu-latest
strategy:
matrix:
php_version: [8.1]

steps:
- uses: actions/checkout@v2

- name: 'Validate composer.json'
run: composer validate

- name: 'Cache Composer packages'
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: 'Install dependencies with Composer'
uses: php-actions/composer@v5
with:
php_version: ${{ matrix.php_version }}
version: 2
args: --profile --ignore-platform-reqs

- name: 'PHP CodeSniffer Validations'
run: vendor/bin/phpcs
28 changes: 26 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,36 @@
"require": {
"php": ">=7.2",
"friendsofsymfony/jsrouting-bundle": "^2.2 || ^2.7 || ^3.0",
"sensio/framework-extra-bundle": ">=5.2"
"sensio/framework-extra-bundle": "^6.0",
"doctrine/doctrine-bundle": "^2.10",
"doctrine/orm": "^2.10",
"symfony/security-bundle": "^6.0",
"symfony/form": "^6.0",
"twig/twig": "^3.0"
},
"autoload": {
"psr-4": {
"Lle\\DashboardBundle\\": "src/"
}
},
"minimum-stability": "stable"
"minimum-stability": "stable",
"require-dev": {
"symfony/maker-bundle": "^1.50",
"phpstan/phpstan": "*",
"phpstan/phpstan-doctrine": "*",
"phpstan/phpstan-mockery": "*",
"phpstan/phpstan-phpunit": "*",
"phpstan/phpstan-symfony": "*",
"phpstan/phpstan-deprecation-rules": "^1.1",
"ergebnis/phpstan-rules": "^2.1",
"phpunit/phpunit": "^10.3",
"phpstan/phpstan-strict-rules": "^1.5",
"slevomat/coding-standard": "^8.13",
"squizlabs/php_codesniffer": "^3.7"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
41 changes: 41 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>

<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

<arg name="basepath" value="."/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<rule ref="Squiz.NamingConventions.ValidVariableName.NotCamelCaps"/>
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>*/lib/Doctrine/Common/Annotations/DocParser.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints.UsedLongTypeHint"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace.UseFromSameNamespace"/>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps"/>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" type="bool" value="true"/>
</properties>
</rule>

<rule ref="Generic.Files.LineLength">
<exclude name="Generic.Files.LineLength"/>
</rule>

<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint"/>
</rule>

<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace">
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace"/>
</rule>

<rule ref="PSR12"/>

<file>src/</file>
<exclude-pattern>src/Resources/skeleton/**/*$</exclude-pattern>


</ruleset>
106 changes: 28 additions & 78 deletions src/Contracts/WidgetTypeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,35 @@

namespace Lle\DashboardBundle\Contracts;

use Symfony\Component\HttpFoundation\Response;
use Lle\DashboardBundle\Entity\Widget;

interface WidgetTypeInterface
{
/**
* @return mixed get unique ID
*/
public function getId();

/**
* @return string return widget HTML source
*/
public function render();

/**
* @return integer returns widget height
*/
public function getHeight();

/**
* @return integer returns widget width
*/
public function getWidth();

/**
* @return integer returns widget X position
*/
public function getX();

/**
* @return integer returns widget Y position
*/
public function getY();

/**
* @return string returns widget type
*/
public function getType();

/**
* @return string returns widget name
*/
public function getName();

/**
* @return string returns widget title
*/
public function getTitle();

/**
* @param \Lle\DashboardBundle\Entity\Widget $widget
*/
public function setParams(\Lle\DashboardBundle\Entity\Widget $widget);

/**
* @return bool
*
* Is the widget supported ?
*/
public function supports(): bool;

/**
* @return bool
*
* Should the widget be asynchronously loaded ?
*/
public function supportsAjax(): bool;

/**
* @return string
*
* Returns the widget's cache key. It should be based on widget's properties.
*/
public function getCacheKey(): string;

/**
* @return int
*
* In seconds, how long should the cache last.
*/
public function getCacheTimeout(): int;
public function getId(): ?int;

public function render(): ?string;

public function getHeight(): ?int;

public function getWidth(): ?int;

public function getX(): ?int;

public function getY(): ?int;

public function getType(): ?string;

public function getName(): ?string;

public function getTitle(): ?string;

public function setParams(Widget $widget): WidgetTypeInterface;

public function supports(): ?bool;

public function supportsAjax(): ?bool;

public function getCacheKey(): ?string;

public function getCacheTimeout(): ?int;
}
Loading

0 comments on commit 5954e19

Please sign in to comment.