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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
emacs-version:
- 26.3
- 27.2
- 28.2
- 29.1
experimental: [false]
include:
- os: ubuntu-latest
emacs-version: snapshot
experimental: true
- os: macos-latest
emacs-version: snapshot
experimental: true
- os: windows-latest
emacs-version: snapshot
experimental: true

steps:
- uses: actions/checkout@v4

- uses: jcs090218/setup-emacs@master
with:
version: ${{ matrix.emacs-version }}

- uses: emacs-eask/setup-eask@master
with:
version: 'snapshot'

- name: Run tests
run: |
eask package
eask install
eask compile
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.info
*.texi
.cask
.eask
dist

ede-php-autoload-autoloads.el
25 changes: 25 additions & 0 deletions Eask
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(package "ede-php-autoload"
"1.1.0"
"PHP autoloading implementation for Semantic")

(website-url "https://github.com/emacs-php/ede-php-autoload")
(keywords "PHP" "project" "ede")

(package-file "ede-php-autoload.el")
(files
"*.el"
"ede-php-autoload")

(script "test" "echo \"Error: no test specified\" && exit 1")

(source 'melpa)

(depends-on "emacs" "26.1")

(development
(depends-on "ecukes")
(depends-on "ert-runner")
(depends-on "f")
)

(setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432
21 changes: 11 additions & 10 deletions ede-php-autoload.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

;; Author: Steven Rémot <steven.remot@gmail.com>
;; original code for C++ by Eric M. Ludlam <eric@siege-engine.com>
;; Version: 1.1.0
;; Keywords: PHP project ede
;; Homepage: https://github.com/emacs-php/ede-php-autoload

Expand Down Expand Up @@ -216,7 +217,7 @@ ROOT-DIR is the root directory of the project."
:type list
:documentation "The class autoloads explicitly defined at initialization")))

(defmethod initialize-instance ((this ede-php-autoload-project) &rest fields)
(cl-defmethod initialize-instance ((this ede-php-autoload-project) &rest fields)
"Make sure the :file is fully expanded."
(call-next-method this (list
:file (plist-get (car fields) :file)
Expand Down Expand Up @@ -245,7 +246,7 @@ ROOT-DIR is the root directory of the project."
(unless (slot-boundp this 'targets)
(oset this :targets nil))))

(defmethod ede-php-autoload-reload-autoloads-for-project ((this ede-php-autoload-project))
(cl-defmethod ede-php-autoload-reload-autoloads-for-project ((this ede-php-autoload-project))
"Regenerate the class loaders.

This can be used when some composer dependencies changed, to take
Expand All @@ -260,11 +261,11 @@ the new autoloads into account."
(oset this class-loader
(ede-php-autoload-create-class-loader cleaned-autoloads))))

(defmethod ede-find-subproject-for-directory ((proj ede-php-autoload-project) dir)
(cl-defmethod ede-find-subproject-for-directory ((proj ede-php-autoload-project) dir)
"Return PROJ, for handling all subdirs below DIR."
proj)

(defmethod ede-find-target ((proj ede-php-autoload-project) buffer)
(cl-defmethod ede-find-target ((proj ede-php-autoload-project) buffer)
"Find an EDE target in PROJ for BUFFER.
If one doesn't exist, create a new one for this directory."
(let* ((targets (oref proj targets))
Expand All @@ -280,21 +281,21 @@ If one doesn't exist, create a new one for this directory."
(object-add-to-list proj :targets ans))
ans))

(defmethod ede-project-root ((this ede-php-autoload-project))
(cl-defmethod ede-project-root ((this ede-php-autoload-project))
"Return my root."
this)

(defmethod ede-project-root-directory ((this ede-php-autoload-project))
(cl-defmethod ede-project-root-directory ((this ede-php-autoload-project))
"Return my root."
(file-name-directory (oref this file)))

(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-project) class-name)
(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-project) class-name)
"Find the file in which CLASS-NAME is defined.

CLASS-NAME must be the full name of the class, with all its parent namespaces."
(ede-php-autoload-find-class-def-file (oref this class-loader) class-name))

(defmethod ede-php-autoload-get-class-name-for-file
(cl-defmethod ede-php-autoload-get-class-name-for-file
((this ede-php-autoload-project) file-name)
"Generate a suitable class name for the current FILE-NAME.

Expand All @@ -303,7 +304,7 @@ Generate this class name using the class loader information.
FILE-NAME must be absolute or relative to the project root."
(ede-php-autoload-get-class-name-for-file (oref this class-loader) file-name))

(defmethod ede-php-autoload-complete ((this ede-php-autoload-project) prefix)
(cl-defmethod ede-php-autoload-complete ((this ede-php-autoload-project) prefix)
"Get completion suggestions for the type PREFIX.

PREFIX is the beginning of a fully-qualified name.
Expand All @@ -312,7 +313,7 @@ The result is a list of completion suggestions for this
prefix."
(ede-php-autoload-complete (oref this class-loader) prefix))

(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-project) prefix)
(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-project) prefix)
"Get completion suggestions for the type PREFIX.

PREFIX is the beginning of a fully-qualified name.
Expand Down
6 changes: 3 additions & 3 deletions ede-php-autoload/class-loader/aggregate.el
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
They must be instances of `ede-php-autoload-class-loader'."))
"An aggregation of several class loaders.")

(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-aggregate-class-loader)
(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-aggregate-class-loader)
class-name)
"Find the file in which CLASS-NAME is defined.

Expand All @@ -44,7 +44,7 @@ Return nil if no file has been found."
loaders (cdr loaders)))
class-def-file))

(defmethod ede-php-autoload-get-class-name-for-file
(cl-defmethod ede-php-autoload-get-class-name-for-file
((this ede-php-autoload-aggregate-class-loader) file-name)
"Generate a suitable class name for the current FILE-NAME.

Expand All @@ -58,7 +58,7 @@ FILE-NAME must be absolute or relative to the project root."
loaders (cdr loaders)))
class-name))

(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-aggregate-class-loader) prefix)
(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-aggregate-class-loader) prefix)
"Get completion suggestions for the type PREFIX.

PREFIX is the beginning of a fully-qualified name.
Expand Down
6 changes: 3 additions & 3 deletions ede-php-autoload/class-loader/classmap.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
:documentation "A hash associating a class name and an absolute path to the file in whcih the class is defined."))
"Class loader for direct association between classes and files.")

(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-classmap-class-loader) class-name)
(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-classmap-class-loader) class-name)
"Find the file in which CLASS-NAME is defined.

Return nil if no file has been found."
(let ((file (gethash class-name (oref this class-hash))))
(when file
(expand-file-name file (ede-project-root-directory (ede-current-project))))))

(defmethod ede-php-autoload-get-class-name-for-file ((this ede-php-autoload-classmap-class-loader) file-name)
(cl-defmethod ede-php-autoload-get-class-name-for-file ((this ede-php-autoload-classmap-class-loader) file-name)
"Generate a suitable class name for the current FILE-NAME.

Generate this class name using the class loader information.
Expand All @@ -63,7 +63,7 @@ FILE-NAME must be absolute or relative to the project root."
(throw 'class-name class)))
(oref this class-hash)))))

(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-classmap-class-loader) prefix)
(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-classmap-class-loader) prefix)
"Get completion suggestions for the type PREFIX.

PREFIX is the beginning of a fully-qualified name.
Expand Down
8 changes: 4 additions & 4 deletions ede-php-autoload/class-loader/core.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
"Base class for finding the file in with some class is defined."
:abstract t)

(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-class-loader)
(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-class-loader)
class-name)
"Find the file in which CLASS-NAME is defined.

CLASS-NAME must be the full name of the class, with all its parent namespaces."
(error "Method `ede-php-autoload-find-class-def-file' must be overriden"))

(defmethod ede-php-autoload-get-class-name-for-file
(cl-defmethod ede-php-autoload-get-class-name-for-file
((this ede-php-autoload-class-loader) file-name)
"Generate a suitable class name for the current FILE-NAME.

Expand All @@ -45,7 +45,7 @@ Generate this class name using the class loader information.
FILE-NAME must be absolute or relative to the project root."
(error "Method `ede-php-autoload-find-class-def-file' must be overriden"))

(defmethod ede-php-autoload-complete ((this ede-php-autoload-class-loader) prefix)
(cl-defmethod ede-php-autoload-complete ((this ede-php-autoload-class-loader) prefix)
"Get completion suggestions for the PREFIX.

PREFIX is the beginning of a fully-qualified name.
Expand All @@ -66,7 +66,7 @@ prefix."
(cl-loop for completion in completions
collect (concat ns "\\" completion)))))

(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-class-loader) prefix)
(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-class-loader) prefix)
"Get type completion suggestions for the type PREFIX.

PREFIX is the beginning of a fully-qualified name.
Expand Down
6 changes: 3 additions & 3 deletions ede-php-autoload/class-loader/psr0.el
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ then The class \"Bar_Foo\" is considered to be defined in \"src/test/Bar/Foo\".
The include paths can be either a string or a list of strings."))
"Class loader for PSR-0 convention.")

(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-psr0-class-loader)
(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-psr0-class-loader)
class-name)
"Find the file in which CLASS-NAME is defined.

Expand All @@ -66,7 +66,7 @@ Return nil if no file has been found."
(setq namespaces (cdr namespaces))))
class-def-file))

(defmethod ede-php-autoload-get-class-name-for-file
(cl-defmethod ede-php-autoload-get-class-name-for-file
((this ede-php-autoload-psr0-class-loader) file-name)
"Generate a suitable class name for the current FILE-NAME.

Expand Down Expand Up @@ -137,7 +137,7 @@ PREFIX is the beginning of the type to complete."
(car (last split-prefix)))))))))
suggestions))

(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-psr0-class-loader) prefix)
(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-psr0-class-loader) prefix)
"Get completion suggestions for the type PREFIX.

PREFIX is the beginning of a fully-qualified name.
Expand Down
6 changes: 3 additions & 3 deletions ede-php-autoload/class-loader/psr4.el
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ For example, if :namespaces has the value '((\"Foo\" . \"src/Foo\") (\"Bar\" . \
then The class \"Bar\\Foo\" is considered to be defined in \"src/test/Bar/Foo\"."))
"Class loader for PSR-4 convention.")

(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-psr4-class-loader)
(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-psr4-class-loader)
class-name)
"Find the file in which CLASS-NAME is defined.

Expand Down Expand Up @@ -88,7 +88,7 @@ TARGET is a string."
(setq current-pairs (cdr current-pairs)))
longest-pair))

(defmethod ede-php-autoload-get-class-name-for-file
(cl-defmethod ede-php-autoload-get-class-name-for-file
((this ede-php-autoload-psr4-class-loader) file-name)
"Generate a suitable class name for the current FILE-NAME.

Expand Down Expand Up @@ -158,7 +158,7 @@ PREFIX is the beginning of the type to complete."
(car (last split-prefix)))))))))
suggestions))

(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-psr4-class-loader) prefix)
(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-psr4-class-loader) prefix)
"Get completion suggestions for the type PREFIX.

PREFIX is the beginning of a fully-qualified name.
Expand Down