updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -1,29 +0,0 @@
build:
nodes:
analysis:
environment:
php:
version: 7.1
cache:
disabled: false
directories:
- ~/.composer/cache
project_setup:
override: true
tests:
override:
- php-scrutinizer-run
- phpcs-run
dependencies:
override:
- composer install -noa
tools:
external_code_coverage:
timeout: 600
build_failure_conditions:
- 'elements.rating(<= C).new.exists' # No new classes/methods with a rating of C or worse allowed
- 'issues.label("coding-style").new.exists' # No new coding style issues allowed
- 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity
- 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection

View File

@@ -1,8 +1,8 @@
# Doctrine Event Manager
[![Build Status](https://travis-ci.org/doctrine/event-manager.svg)](https://travis-ci.org/doctrine/event-manager)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doctrine/event-manager/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/doctrine/event-manager/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/doctrine/event-manager/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/doctrine/event-manager/?branch=master)
[![Build Status](https://github.com/doctrine/event-manager/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/event-manager/actions)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doctrine/event-manager/badges/quality-score.png?b=1.2.x)](https://scrutinizer-ci.com/g/doctrine/event-manager/?branch=1.2.x)
[![Code Coverage](https://scrutinizer-ci.com/g/doctrine/event-manager/badges/coverage.png?b=1.2.x)](https://scrutinizer-ci.com/g/doctrine/event-manager/?branch=1.2.x)
The Doctrine Event Manager is a library that provides a simple event system.

View File

@@ -0,0 +1,7 @@
# Upgrade to 1.2
## Deprecated calling `EventManager::getListeners()` without an event name
When calling `EventManager::getListeners()` without an event name, all
listeners were returned, keyed by event name. A new method `getAllListeners()`
has been added to provide this functionality. It should be used instead.

View File

@@ -1,41 +1,69 @@
{
"name": "doctrine/event-manager",
"type": "library",
"description": "Doctrine Event Manager component",
"keywords": ["eventmanager", "eventdispatcher", "event"],
"homepage": "https://www.doctrine-project.org/projects/event-manager.html",
"description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.",
"license": "MIT",
"authors": [
{"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"},
{"name": "Roman Borschel", "email": "roman@code-factory.org"},
{"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"},
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"},
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"},
{"name": "Marco Pivetta", "email": "ocramius@gmail.com"}
"type": "library",
"keywords": [
"events",
"event",
"event dispatcher",
"event manager",
"event system"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
},
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"homepage": "https://www.doctrine-project.org/projects/event-manager.html",
"require": {
"php": "^7.1"
"php": "^7.1 || ^8.0",
"doctrine/deprecations": "^0.5.3 || ^1"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
"doctrine/coding-standard": "^4.0"
"doctrine/coding-standard": "^9 || ^10",
"phpstan/phpstan": "~1.4.10 || ^1.8.8",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.24"
},
"conflict": {
"doctrine/common": "<2.9@dev"
"doctrine/common": "<2.9"
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\": "lib/Doctrine/Common"
"Doctrine\\Common\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Doctrine\\Tests\\": "tests/Doctrine/Tests"
"Doctrine\\Tests\\Common\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
}
}

View File

@@ -1,22 +0,0 @@
Event Manager Documentation
===========================
The Doctrine Event Manager documentation is a reference guide to everything you need
to know about the project.
Getting Help
------------
If this documentation is not helping to answer questions you have about the
Doctrine DBAL, don't panic. You can get help from different sources:
- Gitter chat room `#doctrine/event-manager <https://gitter.im/doctrine/event-manager>`_
- On `Stack Overflow <http://stackoverflow.com/questions/tagged/doctrine-event-manager>`_
- The `Doctrine Mailing List <http://groups.google.com/group/doctrine-user>`_
- Report a bug on `GitHub <https://github.com/doctrine/event-manager/issues>`_.
Getting Started
---------------
The best way to get started is with the :doc:`Introduction <reference/index#introduction>` section
in the documentation. Use the sidebar to browse other documentation for the Doctrine Event Manager.

View File

@@ -1,133 +0,0 @@
Introduction
============
The Doctrine Event Manager is a simple event system used by the various Doctrine projects. It was originally built
for the DBAL and ORM but over time other projects adopted it and now it is available as a standalone library.
Installation
============
The library can easily be installed with composer.
.. code-block:: sh
$ composer require doctrine/event-manager
Setup
=====
The event system is controlled by the ``Doctrine\Common\EventManager`` class.
.. code-block:: php
use Doctrine\Common\EventManager;
$eventManager = new EventManager();
Listeners
=========
Now you are ready to listen for events. Here is an example of a custom event listener named ``TestEvent``.
.. code-block:: php
use Doctrine\Common\EventArgs;
use Doctrine\Common\EventManager;
final class TestEvent
{
public const preFoo = 'preFoo';
public const postFoo = 'postFoo';
/** @var EventManager */
private $eventManager;
/** @var bool */
public $preFooInvoked = false;
/** @var bool */
public $postFooInvoked = false;
public function __construct(EventManager $eventManager)
{
$eventManager->addEventListener([self::preFoo, self::postFoo], $this);
}
public function preFoo(EventArgs $eventArgs) : void
{
$this->preFooInvoked = true;
}
public function postFoo(EventArgs $eventArgs) : void
{
$this->postFooInvoked = true;
}
}
// Create a new instance
$testEvent = new TestEvent($eventManager);
Dispatching Events
==================
Now you can dispatch events with the ``dispatchEvent()`` method.
.. code-block:: php
$eventManager->dispatchEvent(TestEvent::preFoo);
$eventManager->dispatchEvent(TestEvent::postFoo);
Removing Event Listeners
========================
You can easily remove a listener with the ``removeEventListener()`` method.
.. code-block:: php
$eventManager->removeEventListener([TestEvent::preFoo, TestEvent::postFoo], $testEvent);
Event Subscribers
=================
The Doctrine event system also has a simple concept of event subscribers. We can define a simple ``TestEventSubscriber`` class which implements the ``Doctrine\Common\EventSubscriber`` interface with a ``getSubscribedEvents()`` method which returns an array of events it should be subscribed to.
.. code-block:: php
use Doctrine\Common\EventSubscriber;
final class TestEventSubscriber implements EventSubscriber
{
/** @var bool */
public $preFooInvoked = false;
public function preFoo() : void
{
$this->preFooInvoked = true;
}
public function getSubscribedEvents() : array
{
return [TestEvent::preFoo];
}
}
$eventSubscriber = new TestEventSubscriber();
$eventManager->addEventSubscriber($eventSubscriber);
.. note::
The array returned by the ``getSubscribedEvents()`` method is a simple array with the values being the event names. The subscriber must have a method that is named exactly like the event.
Now when you dispatch an event, any event subscribers will be notified of that event.
.. code-block:: php
$eventManager->dispatchEvent(TestEvent::preFoo);
Now you can check the ``preFooInvoked`` property to see if the event subscriber was notified of the event:
.. code-block:: php
if ($eventSubscriber->preFooInvoked) {
// the preFoo method was invoked
}

View File

@@ -1,4 +0,0 @@
.. toctree::
:depth: 3
reference/index

View File

@@ -0,0 +1,5 @@
parameters:
level: 9
paths:
- src/
- tests/

15
vendor/doctrine/event-manager/psalm.xml vendored Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>

View File

@@ -16,7 +16,7 @@ class EventArgs
/**
* Single instance of EventArgs.
*
* @var EventArgs
* @var EventArgs|null
*/
private static $_emptyEventArgsInstance;
@@ -29,9 +29,8 @@ class EventArgs
* The benefit from this is that only one empty instance is instantiated and shared
* (otherwise there would be instances for every dispatched in the abovementioned form).
*
* @see EventManager::dispatchEvent
*
* @link https://msdn.microsoft.com/en-us/library/system.eventargs.aspx
* @see EventManager::dispatchEvent
*
* @return EventArgs
*/

View File

@@ -1,6 +1,9 @@
<?php
namespace Doctrine\Common;
use Doctrine\Deprecations\Deprecation;
use function spl_object_hash;
/**
@@ -14,9 +17,9 @@ class EventManager
* Map of registered listeners.
* <event> => <listeners>
*
* @var object[][]
* @var array<string, object[]>
*/
private $_listeners = [];
private $listeners = [];
/**
* Dispatches an event to all registered listeners.
@@ -30,27 +33,49 @@ class EventManager
*/
public function dispatchEvent($eventName, ?EventArgs $eventArgs = null)
{
if (! isset($this->_listeners[$eventName])) {
if (! isset($this->listeners[$eventName])) {
return;
}
$eventArgs = $eventArgs ?? EventArgs::getEmptyInstance();
foreach ($this->_listeners[$eventName] as $listener) {
foreach ($this->listeners[$eventName] as $listener) {
$listener->$eventName($eventArgs);
}
}
/**
* Gets the listeners of a specific event or all listeners.
* Gets the listeners of a specific event.
*
* @param string|null $event The name of the event.
*
* @return object[]|object[][] The event listeners for the specified event, or all event listeners.
* @return object[]|array<string, object[]> The event listeners for the specified event, or all event listeners.
* @psalm-return ($event is null ? array<string, object[]> : object[])
*/
public function getListeners($event = null)
{
return $event ? $this->_listeners[$event] : $this->_listeners;
if ($event === null) {
Deprecation::trigger(
'doctrine/event-manager',
'https://github.com/doctrine/event-manager/pull/50',
'Calling %s without an event name is deprecated. Call getAllListeners() instead.',
__METHOD__
);
return $this->getAllListeners();
}
return $this->listeners[$event] ?? [];
}
/**
* Gets all listeners keyed by event name.
*
* @return array<string, object[]> The event listeners for the specified event, or all event listeners.
*/
public function getAllListeners(): array
{
return $this->listeners;
}
/**
@@ -62,7 +87,7 @@ class EventManager
*/
public function hasListeners($event)
{
return ! empty($this->_listeners[$event]);
return ! empty($this->listeners[$event]);
}
/**
@@ -81,7 +106,7 @@ class EventManager
foreach ((array) $events as $event) {
// Overrides listener if a previous one was associated already
// Prevents duplicate listeners on same event (same instance only)
$this->_listeners[$event][$hash] = $listener;
$this->listeners[$event][$hash] = $listener;
}
}
@@ -99,7 +124,7 @@ class EventManager
$hash = spl_object_hash($listener);
foreach ((array) $events as $event) {
unset($this->_listeners[$event][$hash]);
unset($this->listeners[$event][$hash]);
}
}

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Common;
/**
* An EventSubscriber knows himself what events he is interested in.
* An EventSubscriber knows what events it is interested in.
* If an EventSubscriber is added to an EventManager, the manager invokes
* {@link getSubscribedEvents} and registers the subscriber as a listener for all
* returned events.