Skip to content

Commit

Permalink
laminas/laminas-coding-standard:^3.0 + Apply code style (#175)
Browse files Browse the repository at this point in the history
---------

Signed-off-by: fezfez <[email protected]>
  • Loading branch information
fezfez authored Nov 21, 2024
1 parent 53ba28b commit a495029
Show file tree
Hide file tree
Showing 170 changed files with 2,009 additions and 1,700 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"laminas/laminas-view": "^2.18.0"
},
"require-dev": {
"laminas/laminas-coding-standard": "^2.5.0",
"laminas/laminas-json": "^3.6",
"laminas/laminas-coding-standard": "^3.0.1",
"laminas/laminas-json": "^3.7",
"phpunit/phpunit": "^10.5.38",
"webmozart/assert": "^1.11"
},
Expand Down
103 changes: 55 additions & 48 deletions composer.lock

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

35 changes: 20 additions & 15 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<?xml version="1.0"?>
<ruleset name="Laminas coding standard">
<!-- inherit rules from: -->
<rule ref="PSR2"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Formatting.SpaceAfterNot"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<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"/>
<arg name="parallel" value="80"/>

<!-- Show progress -->
<arg value="ps"/>

<!-- Paths to check -->
<file>src</file>
<file>test</file>

<!-- Include all rules from the Laminas Coding Standard -->
<rule ref="LaminasCodingStandard"/>
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<exclude-pattern>src/</exclude-pattern>
</rule>
<rule ref="WebimpressCodingStandard.PHP.CorrectClassNameCase.Invalid">
<exclude-pattern>test/_autoload.php</exclude-pattern>
</rule>
</ruleset>
30 changes: 11 additions & 19 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

namespace Laminas\Mvc;

use Laminas\Mvc\Service\ServiceManagerConfig;
use Laminas\EventManager\EventManagerAwareInterface;
use Laminas\EventManager\EventManagerInterface;
use Laminas\Mvc\Service\ServiceManagerConfig;
use Laminas\ServiceManager\ServiceManager;
use Laminas\Stdlib\RequestInterface;
use Laminas\Stdlib\ResponseInterface;

use function array_merge;
use function array_unique;

/**
* Main application class for invoking applications
*
Expand Down Expand Up @@ -66,31 +69,22 @@ class Application implements

/**
* MVC event token
*
* @var MvcEvent
*/
protected $event;

/**
* @var EventManagerInterface
*/
/** @var EventManagerInterface */
protected $events;

/**
* @var RequestInterface
*/
/** @var RequestInterface */
protected $request;

/**
* @var ResponseInterface
*/
/** @var ResponseInterface */
protected $response;

/**
* Constructor
*
* @param null|EventManagerInterface $events
* @param null|RequestInterface $request
* @param null|ResponseInterface $response
*/
public function __construct(
protected ServiceManager $serviceManager,
Expand All @@ -99,8 +93,8 @@ public function __construct(
?ResponseInterface $response = null
) {
$this->setEventManager($events ?: $serviceManager->get('EventManager'));
$this->request = $request ?: $serviceManager->get('Request');
$this->response = $response ?: $serviceManager->get('Response');
$this->request = $request ?: $serviceManager->get('Request');
$this->response = $response ?: $serviceManager->get('Response');
}

/**
Expand Down Expand Up @@ -193,7 +187,6 @@ public function getMvcEvent()
/**
* Set the event manager instance
*
* @param EventManagerInterface $eventManager
* @return Application
*/
public function setEventManager(EventManagerInterface $eventManager)
Expand Down Expand Up @@ -282,7 +275,7 @@ public function run()
$event = $this->event;

// Define callback used to determine whether or not to short-circuit
$shortCircuit = static function ($r) use ($event) : bool {
$shortCircuit = static function ($r) use ($event): bool {
if ($r instanceof ResponseInterface) {
return true;
}
Expand Down Expand Up @@ -341,7 +334,6 @@ public function run()
* Triggers "render" and "finish" events, and returns response from
* event object.
*
* @param MvcEvent $event
* @return Application
*/
protected function completeRequest(MvcEvent $event)
Expand Down
Loading

0 comments on commit a495029

Please sign in to comment.